summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-25 19:08:45 +0100
committerSteve Block <steveblock@google.com>2011-06-08 13:51:31 +0100
commit2bde8e466a4451c7319e3a072d118917957d6554 (patch)
tree28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /LayoutTests/http
parent6939c99b71d9372d14a0c74a772108052e8c48c8 (diff)
downloadexternal_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'LayoutTests/http')
-rw-r--r--LayoutTests/http/tests/appcache/origin-delete-expected.txt7
-rw-r--r--LayoutTests/http/tests/appcache/origin-delete.html58
-rw-r--r--LayoutTests/http/tests/appcache/origins-with-appcache-expected.txt5
-rw-r--r--LayoutTests/http/tests/appcache/origins-with-appcache.html57
-rw-r--r--LayoutTests/http/tests/appcache/resources/origin-delete-iframe.html20
-rw-r--r--LayoutTests/http/tests/appcache/resources/origin-delete-iframe.manifest6
-rw-r--r--LayoutTests/http/tests/appcache/resources/origins-with-appcache-iframe.html9
-rw-r--r--LayoutTests/http/tests/appcache/resources/origins-with-appcache-iframe.manifest6
8 files changed, 168 insertions, 0 deletions
diff --git a/LayoutTests/http/tests/appcache/origin-delete-expected.txt b/LayoutTests/http/tests/appcache/origin-delete-expected.txt
new file mode 100644
index 0000000..e91767d
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/origin-delete-expected.txt
@@ -0,0 +1,7 @@
+This test checks that application cache groups correctly become obsolete after application cache is deletion for a specific origin.
+
+PASS - cached iframe-1
+clearing cache for origin
+appcache_status=5
+SUCCESS - cache was made obsolete
+
diff --git a/LayoutTests/http/tests/appcache/origin-delete.html b/LayoutTests/http/tests/appcache/origin-delete.html
new file mode 100644
index 0000000..26c4890
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/origin-delete.html
@@ -0,0 +1,58 @@
+<html>
+<head>
+<script>
+
+// Helpers.
+
+function log(message) {
+ document.getElementById("console").innerHTML += message + "<br>";
+}
+
+// Start and end.
+
+function startTest() {
+ if (window.layoutTestController) {
+ layoutTestController.clearAllApplicationCaches();
+ layoutTestController.dumpApplicationCacheDelegateCallbacks();
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ addIFrameWithAppCache();
+}
+
+function finishTest() {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function addIFrameWithAppCache() {
+ var iframe = document.createElement("iframe");
+ iframe.src = "resources/origin-delete-iframe.html";
+ iframe.id = "cachedFrame";
+ document.body.appendChild(iframe);
+
+ window.onmessage = function(event) {
+ log(event.data);
+ if (event.data === "PASS - cached iframe-1") {
+ log("clearing cache for origin");
+ layoutTestController.clearApplicationCacheForOrigin("http://127.0.0.1:8000");
+ var frame = document.getElementById('cachedFrame');
+ frame.contentWindow.postMessage("appcache_status", "*");
+ } else if (event.data === "appcache_status=5"){
+ log("SUCCESS - cache was made obsolete");
+ finishTest();
+ } else {
+ log("FAIL - received unexpected message " + event.data);
+ finishTest();
+ }
+ };
+}
+</script>
+</head>
+<body onload="startTest()">
+<p>This test checks that application cache groups correctly become obsolete after application cache is deletion for a specific origin.
+</p>
+<pre id="console"></pre>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/origins-with-appcache-expected.txt b/LayoutTests/http/tests/appcache/origins-with-appcache-expected.txt
new file mode 100644
index 0000000..e3b20f6
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/origins-with-appcache-expected.txt
@@ -0,0 +1,5 @@
+This test verifies that ApplicationCacheStorage can report the set of origins that have an application cache. First, it tests that no origins are reported after all application caches are removed. Then, it loads an iframe that places a PNG into an application cache for the DumpRenderTree origin, and tests that this origin is now reported to have application cache.
+
+Origins with application cache after deletion:
+Origins with application cache after frame was cached: http_127.0.0.1_8000
+
diff --git a/LayoutTests/http/tests/appcache/origins-with-appcache.html b/LayoutTests/http/tests/appcache/origins-with-appcache.html
new file mode 100644
index 0000000..0730f12
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/origins-with-appcache.html
@@ -0,0 +1,57 @@
+<html>
+<head>
+<script>
+
+// Helpers.
+
+function log(message) {
+ document.getElementById("console").innerHTML += message + "<br>";
+}
+
+function handleMessage(event) {
+ if (event.data === "created_cache") {
+ log("Origins with application cache after frame was cached: " + layoutTestController.originsWithApplicationCache());
+ } else {
+ log("received invalid message from frame '" + event.data + "'");
+ }
+
+ finishTest();
+}
+
+function addIFrameWithCache()
+{
+ var iframe = document.createElement("iframe");
+ iframe.src = "resources/origins-with-appcache-iframe.html";
+ document.body.appendChild(iframe);
+}
+
+// Start and end.
+
+function startTest() {
+ if (window.layoutTestController) {
+ layoutTestController.clearAllApplicationCaches();
+ log("Origins with application cache after deletion: " + layoutTestController.originsWithApplicationCache());
+ layoutTestController.dumpApplicationCacheDelegateCallbacks();
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ window.onmessage = handleMessage;
+
+ addIFrameWithCache();
+}
+
+function finishTest() {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+</script>
+</head>
+<body onload="startTest()">
+<p>
+This test verifies that ApplicationCacheStorage can report the set of origins that have an application cache. First, it tests that no origins are reported after all application caches are removed. Then, it loads an iframe that places a PNG into an application cache for the DumpRenderTree origin, and tests that this origin is now reported to have application cache.
+</p>
+<pre id="console"></pre>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/origin-delete-iframe.html b/LayoutTests/http/tests/appcache/resources/origin-delete-iframe.html
new file mode 100644
index 0000000..e2565f7
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/origin-delete-iframe.html
@@ -0,0 +1,20 @@
+<html manifest="origin-delete-iframe.manifest">
+<script>
+// iframe-1 is expected to succeed.
+applicationCache.oncached = function() { parent.postMessage("PASS - cached iframe-1", "*"); };
+applicationCache.onerror = function() { parent.postMessage("FAIL - error caching iframe-1, expected this to succeed", "*"); };
+applicationCache.onnoupdate = function() { parent.postMessage("FAIL - no update iframe-1, all caches should have been deleted before this test", "*"); };
+
+
+function frameMessageReceived(event) {
+ if (event.data === "appcache_status") {
+ parent.postMessage("appcache_status=" + applicationCache.status, "*");
+ } else {
+ parent.postMessage("FAIL - unrecognized message", "*");
+ }
+}
+
+window.addEventListener("message", frameMessageReceived, false);
+
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/origin-delete-iframe.manifest b/LayoutTests/http/tests/appcache/resources/origin-delete-iframe.manifest
new file mode 100644
index 0000000..6b48448
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/origin-delete-iframe.manifest
@@ -0,0 +1,6 @@
+CACHE MANIFEST
+
+# This adds ~13K to the app cache
+
+CACHE:
+abe.png
diff --git a/LayoutTests/http/tests/appcache/resources/origins-with-appcache-iframe.html b/LayoutTests/http/tests/appcache/resources/origins-with-appcache-iframe.html
new file mode 100644
index 0000000..92cf1ff
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/origins-with-appcache-iframe.html
@@ -0,0 +1,9 @@
+<html manifest="origins-with-appcache-iframe.manifest">
+<script>
+// iframe-1 is expected to succeed.
+applicationCache.oncached = function() { parent.postMessage("created_cache", "*"); };
+applicationCache.onerror = function() { parent.postMessage("FAIL - error caching iframe, expected this to succeed", "*"); };
+applicationCache.onnoupdate = function() { parent.postMessage("FAIL - no update iframe, all caches should have been deleted before this test", "*"); };
+
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/origins-with-appcache-iframe.manifest b/LayoutTests/http/tests/appcache/resources/origins-with-appcache-iframe.manifest
new file mode 100644
index 0000000..6b48448
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/origins-with-appcache-iframe.manifest
@@ -0,0 +1,6 @@
+CACHE MANIFEST
+
+# This adds ~13K to the app cache
+
+CACHE:
+abe.png