summaryrefslogtreecommitdiffstats
path: root/LayoutTests
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2010-11-10 15:31:59 -0800
committerTeng-Hui Zhu <ztenghui@google.com>2010-11-17 13:35:59 -0800
commit28040489d744e0c5d475a88663056c9040ed5320 (patch)
treec463676791e4a63e452a95f0a12b2a8519730693 /LayoutTests
parenteff9be92c41913c92fb1d3b7983c071f3e718678 (diff)
downloadexternal_webkit-28040489d744e0c5d475a88663056c9040ed5320.zip
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.gz
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.bz2
Merge WebKit at r71558: Initial merge by git.
Change-Id: Ib345578fa29df7e4bc72b4f00e4a6fddcb754c4c
Diffstat (limited to 'LayoutTests')
-rw-r--r--LayoutTests/http/tests/appcache/fallback.html26
-rw-r--r--LayoutTests/http/tests/appcache/resources/offline-access-frame.html9
-rw-r--r--LayoutTests/http/tests/resources/network-simulator.php11
-rw-r--r--LayoutTests/storage/indexeddb/tutorial-expected.txt4
-rw-r--r--LayoutTests/storage/indexeddb/tutorial.html10
5 files changed, 23 insertions, 37 deletions
diff --git a/LayoutTests/http/tests/appcache/fallback.html b/LayoutTests/http/tests/appcache/fallback.html
index aaf7a82..ed641e0 100644
--- a/LayoutTests/http/tests/appcache/fallback.html
+++ b/LayoutTests/http/tests/appcache/fallback.html
@@ -29,18 +29,6 @@ function setNetworkEnabled(state)
}
}
-function canLoad(url)
-{
- try {
- var req = new XMLHttpRequest();
- req.open("GET", url, false);
- req.send("");
- return true;
- } catch (e) {
- return false;
- }
-}
-
function load(url)
{
try {
@@ -49,8 +37,9 @@ function load(url)
req.send("");
return req.responseText;
} catch (ex) {
- alert("Unexpected error loading " + url + ": " + ex);
+ log("FAIL: Cannot load " + url + ", ex = " + ex);
hadError = true;
+ return ""; // This value should not be expected as the responseText for a url presented to this function.
}
}
@@ -65,17 +54,17 @@ function test()
setNetworkEnabled(true);
- if (!canLoad(testURL) || !/not in the cache/.test(load(testURL))) {
+ if (!/not in the cache/.test(load(testURL))) {
log("FAIL: Cannot load an URL from fallback namespace when network is enabled");
hadError = true;
}
- if (!canLoad(nonexistentURL) || load(nonexistentURL) != "Hello, World!") {
+ if (load(nonexistentURL) != "Hello, World!") {
log("FAIL: Fallback resource wasn't used for a 404 response");
hadError = true;
}
- if (!canLoad(redirectURL) || load(redirectURL) != "Hello, World!") {
+ if (load(redirectURL) != "Hello, World!") {
log("FAIL: Fallback resource wasn't used for a redirect to a resource with another origin");
hadError = true;
}
@@ -147,10 +136,7 @@ function test6()
{
setNetworkEnabled(false);
- if (!canLoad(testURL)) {
- log("FAIL: Cannot load an URL from fallback namespace when network is disabled");
- hadError = true;
- } else if (load(testURL) != load("resources/simple.txt")) {
+ if (load(testURL) != load("resources/simple.txt")) {
log("FAIL: Loading an URL from fallback namespace when network is disabled returned unexpected response");
hadError = true;
}
diff --git a/LayoutTests/http/tests/appcache/resources/offline-access-frame.html b/LayoutTests/http/tests/appcache/resources/offline-access-frame.html
index 68ef274..43015ae 100644
--- a/LayoutTests/http/tests/appcache/resources/offline-access-frame.html
+++ b/LayoutTests/http/tests/appcache/resources/offline-access-frame.html
@@ -17,14 +17,5 @@ applicationCache.onobsolete = function() { log("obsolete") }
applicationCache.oncached = function() { log("cached"); test() }
applicationCache.onnoupdate = function() { log("noupdate"); test() }
applicationCache.onerror = function() { log("error"); test() }
-
-if (applicationCache.status == applicationCache.IDLE) {
- // Update finished while we were waiting for offline-access.js to load.
- applicationCache.oncached = function() { log("cached") }
- applicationCache.onnoupdate = function() { log("noupdate") }
- applicationCache.onerror = function() { log("error") }
- test();
-}
-
</script>
</html>
diff --git a/LayoutTests/http/tests/resources/network-simulator.php b/LayoutTests/http/tests/resources/network-simulator.php
index 4860028..ccfcf5c 100644
--- a/LayoutTests/http/tests/resources/network-simulator.php
+++ b/LayoutTests/http/tests/resources/network-simulator.php
@@ -2,7 +2,7 @@
require_once 'portabilityLayer.php';
// This script acts as a stateful proxy for retrieving files. When the state is set to
-// offline, it simulates a network error by redirecting to itself.
+// offline, it simulates a network error with a nonsense response.
if (!sys_get_temp_dir()) {
echo "FAIL: No temp dir was returned.\n";
@@ -59,9 +59,12 @@ function generateResponse($path)
global $stateFile;
$state = getState($stateFile);
if ($state == "Offline") {
+ # Simulate a network error by replying with a nonsense response.
header('HTTP/1.1 307 Temporary Redirect');
- # Simulate a network error by redirecting to self.
- header('Location: ' . $_SERVER['REQUEST_URI']);
+ header('Location: ' . $_SERVER['REQUEST_URI']); # Redirect to self.
+ header('Content-Length: 1');
+ header('Content-Length: 5', false); # Multiple content-length headers, some network stacks can detect this condition faster.
+ echo "Intentionally incorrect response.";
} else {
// A little securuty checking can't hurt.
if (strstr($path, ".."))
@@ -70,7 +73,7 @@ function generateResponse($path)
if ($path[0] == '/')
$path = '..' . $path;
- generateNoCacheHTTPHeader();
+ generateNoCacheHTTPHeader();
if (file_exists($path)) {
header("Last-Modified: " . gmdate("D, d M Y H:i:s T", filemtime($path)));
diff --git a/LayoutTests/storage/indexeddb/tutorial-expected.txt b/LayoutTests/storage/indexeddb/tutorial-expected.txt
index 1e424ef..f9175b7 100644
--- a/LayoutTests/storage/indexeddb/tutorial-expected.txt
+++ b/LayoutTests/storage/indexeddb/tutorial-expected.txt
@@ -1,2 +1,4 @@
-All done!
+Please view source for more information on what this is doing and why...
+
+Everything worked!
diff --git a/LayoutTests/storage/indexeddb/tutorial.html b/LayoutTests/storage/indexeddb/tutorial.html
index 2e7e41f..db9f2fa 100644
--- a/LayoutTests/storage/indexeddb/tutorial.html
+++ b/LayoutTests/storage/indexeddb/tutorial.html
@@ -24,8 +24,10 @@
// goal of teaching people IndexedDB. That said, it does have a good amount of coverage and
// serves as a living document describing what's expected to work and how within WebKit so it
// seems well worth having checked in.
-if (window.layoutTestController)
- layoutTestController.dumpAsText(true);
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
function setup()
@@ -51,7 +53,7 @@ function setup()
function log(txt)
{
- document.write(txt + "<br>");
+ document.getElementById("logger").innerHTML += txt + "<br>";
}
function logError(txt)
@@ -394,6 +396,7 @@ function onIndexGetSuccess()
function onAllDone()
{
log("Everything worked!");
+ layoutTestController.notifyDone();
}
// The way setVersion is supposed to work:
@@ -429,5 +432,6 @@ function onAllDone()
</script>
<body onload="start()">
Please view source for more information on what this is doing and why...<br><br>
+<div id="logger"></div>
</body>
</html>