diff options
Diffstat (limited to 'LayoutTests/http/tests')
6 files changed, 125 insertions, 0 deletions
diff --git a/LayoutTests/http/tests/appcache/online-fallback-layering-expected.txt b/LayoutTests/http/tests/appcache/online-fallback-layering-expected.txt new file mode 100644 index 0000000..00b913c --- /dev/null +++ b/LayoutTests/http/tests/appcache/online-fallback-layering-expected.txt @@ -0,0 +1,10 @@ +Test that a network namespace trumps a fallback namespace where they overlap. + +Sanity check the presence of the fallback namespace, should get the fallback resource. +Getting a network namespace resource that exists on the server, should succeed. +Getting a network namespace resource that does not exist on the server, should get a 404. +Creating two iframes for an existing and non-existing page, one should say "hello" the other should 404. +- hello heard +- 404 detected +PASS + diff --git a/LayoutTests/http/tests/appcache/online-fallback-layering.html b/LayoutTests/http/tests/appcache/online-fallback-layering.html new file mode 100644 index 0000000..bc607ee --- /dev/null +++ b/LayoutTests/http/tests/appcache/online-fallback-layering.html @@ -0,0 +1,97 @@ +<html manifest=resources/online-fallback-layering.manifest> +<head> +<script> + +if (window.layoutTestController) { + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); +} + +function log(message) { + document.getElementById("log").innerHTML += message + "<br>"; +} + +function testComplete(result) { + log(result); + if (window.layoutTestController) + layoutTestController.notifyDone(); +} + +function syncGet(url) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(); + if (xhr.status == 200) + return xhr.responseText; + if (xhr.status == 404) + return "404 not found"; + log ("unexpected status code"); + return ""; +} + +applicationCache.oncached = function() { setTimeout(startTest, 0); } +applicationCache.onnoupdate = function() { setTimeout(startTest, 0); } +applicationCache.onupdateready = function() { log('onupdateready'); location.reload(); } +applicationCache.onerror = function() { testComplete('FAIL - onerror'); } +applicationCache.onobsolete = function() { testComplete('FAIL - onobsolete'); } + +function startTest() { + applicationCache.oncached = null; + applicationCache.onnoupdate = null; + + var response; + + log('Sanity check the presence of the fallback namespace, should get the fallback resource.'); + response = syncGet('resources/fallbacknamespace-nonexisting-resource'); + if (!response.match('fallback resource')) + return testComplete('FAIL - did not get the fallback resource'); + + log('Getting a network namespace resource that exists on the server, should succeed.'); + response = syncGet('resources/fallbacknamespace-networknamespace-existing-resource.html'); + if (!response.match('hello')) + return testComplete('FAIL - did not get the existing resource'); + + log('Getting a network namespace resource that does not exist on the server, should get a 404.'); + response = syncGet('resources/fallbacknamespace-networknamespace-nonexisting-resource'); + if (response != "404 not found") + return testComplete('FAIL - did not get a 404 for the nonexisting resource'); + + log('Creating two iframes for an existing and non-existing page, one should say "hello" the other should 404.'); + createFrame('resources/fallbacknamespace-networknamespace-existing-resource.html'); + createFrame('resources/fallbacknamespace-networknamespace-nonexisting-resource'); +} + +function createFrame(src) { + var frame = document.createElement("iframe"); + frame.setAttribute("src", src); + document.body.appendChild(frame); +} + +function frameCreated() { + log('- hello heard'); + setTimeout(waitFor404, 0); +} + +function waitFor404() { + try { + var frameContent = frames[1].document.documentElement.innerHTML; + if (frameContent.match("Not Found")) { + log('- 404 detected'); + testComplete('PASS'); + } else if (frameContent.match("fallback resource")) + testComplete('FAIL - subframe was loaded with the fallback resource.'); + else + throw "Try again"; + } catch (ex) { + setTimeout(waitFor404, 100); + } +} + +</script> +</head> + +<body> +<p>Test that a network namespace trumps a fallback namespace where they overlap.</p> +<div id=log></div> +</body> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/fallbacknamespace-fallback-resource.txt b/LayoutTests/http/tests/appcache/resources/fallbacknamespace-fallback-resource.txt new file mode 100644 index 0000000..c8beda4 --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/fallbacknamespace-fallback-resource.txt @@ -0,0 +1 @@ +This is the fallback resource used for the fallbacknamespace in the online-fallback-layering.html test. diff --git a/LayoutTests/http/tests/appcache/resources/fallbacknamespace-networknamespace-existing-resource.html b/LayoutTests/http/tests/appcache/resources/fallbacknamespace-networknamespace-existing-resource.html new file mode 100644 index 0000000..42362dc --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/fallbacknamespace-networknamespace-existing-resource.html @@ -0,0 +1,9 @@ +<!-- Used in the online-fallback-layering.html layout test. --> +<html> +<body> +hello +<script> +parent.frameCreated(); +</script> +</body> +</html> diff --git a/LayoutTests/http/tests/appcache/resources/online-fallback-layering.manifest b/LayoutTests/http/tests/appcache/resources/online-fallback-layering.manifest new file mode 100644 index 0000000..d6507ff --- /dev/null +++ b/LayoutTests/http/tests/appcache/resources/online-fallback-layering.manifest @@ -0,0 +1,7 @@ +CACHE MANIFEST + +FALLBACK: +fallbacknamespace- fallbacknamespace-fallback-resource.txt + +NETWORK: +fallbacknamespace-networknamespace- diff --git a/LayoutTests/http/tests/resources/absolute-url-strip-whitespace.js b/LayoutTests/http/tests/resources/absolute-url-strip-whitespace.js new file mode 100644 index 0000000..252a630 --- /dev/null +++ b/LayoutTests/http/tests/resources/absolute-url-strip-whitespace.js @@ -0,0 +1 @@ +document.getElementById("test").innerHTML = "PASS"; |