summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-08-11 14:44:44 +0100
committerBen Murdoch <benm@google.com>2010-08-12 19:15:41 +0100
commitdd8bb3de4f353a81954234999f1fea748aee2ea9 (patch)
tree729b52bf09294f0d6c67cd5ea80aee1b727b7bd8 /LayoutTests/http
parentf3d41ba51d86bf719c7a65ab5297aea3c17e2d98 (diff)
downloadexternal_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.zip
external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.gz
external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.bz2
Merge WebKit at r65072 : Initial merge by git.
Change-Id: Ibcf418498376b2660aacb7f8d46ea7085ef91585
Diffstat (limited to 'LayoutTests/http')
-rw-r--r--LayoutTests/http/tests/appcache/origin-quota-expected.txt9
-rw-r--r--LayoutTests/http/tests/appcache/origin-quota.html77
-rw-r--r--LayoutTests/http/tests/appcache/resources/quota-origin-iframe-1.html8
-rw-r--r--LayoutTests/http/tests/appcache/resources/quota-origin-iframe-1.manifest7
-rw-r--r--LayoutTests/http/tests/appcache/resources/quota-origin-iframe-2.html8
-rw-r--r--LayoutTests/http/tests/appcache/resources/quota-origin-iframe-2.manifest8
-rw-r--r--LayoutTests/http/tests/appcache/resources/quota-origin-iframe-3.html8
-rw-r--r--LayoutTests/http/tests/appcache/resources/quota-origin-iframe-3.manifest8
8 files changed, 133 insertions, 0 deletions
diff --git a/LayoutTests/http/tests/appcache/origin-quota-expected.txt b/LayoutTests/http/tests/appcache/origin-quota-expected.txt
new file mode 100644
index 0000000..1d530bb
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/origin-quota-expected.txt
@@ -0,0 +1,9 @@
+UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{http, 127.0.0.1, 8000}
+This test checks that per-origin application cache quotas are enforced.
+
+This test sets the quota for the origin to 20kb, and attempts to fill it up with 2 iframes that are 13kb each. The application cache download process should fail on the 2nd iframe and the UI Delegate should be informed of the exceeded quota. Increasing the size to 40kb. A 3rd iframe is added, which should succeed.
+
+PASS - cached iframe-1
+PASS - error caching iframe-2 as expected
+PASS - cached iframe-3
+
diff --git a/LayoutTests/http/tests/appcache/origin-quota.html b/LayoutTests/http/tests/appcache/origin-quota.html
new file mode 100644
index 0000000..a7322fd
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/origin-quota.html
@@ -0,0 +1,77 @@
+<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.setApplicationCacheOriginQuota(20*1024);
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ addFirstIFrame();
+}
+
+function finishTest() {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+// Stages.
+
+function addIFrameWithContinuation(src, continuation) {
+ window.onmessage = continuation;
+ var iframe = document.createElement("iframe");
+ iframe.src = src;
+ document.body.appendChild(iframe);
+}
+
+function addFirstIFrame() {
+ // Expected to succeed.
+ addIFrameWithContinuation("resources/quota-origin-iframe-1.html", function(event) {
+ log(event.data);
+ addSecondIFrame();
+ });
+}
+
+function addSecondIFrame() {
+ // Expected to fail, then increase the quota.
+ // NOTE: When this fails, the exceed callback will automatically increase it back to the default quota size.
+ addIFrameWithContinuation("resources/quota-origin-iframe-2.html", function(event) {
+ log(event.data);
+ addThirdIFrame();
+ });
+}
+
+function addThirdIFrame() {
+ // Expected to succeed.
+ addIFrameWithContinuation("resources/quota-origin-iframe-3.html", function(event) {
+ log(event.data);
+ finishTest();
+ });
+}
+
+</script>
+</head>
+<body onload="startTest()">
+<p>This test checks that per-origin application cache quotas are enforced.</p>
+<p>
+ This test sets the quota for the origin to 20kb, and attempts to fill
+ it up with 2 iframes that are 13kb each. The application cache download
+ process should fail on the 2nd iframe and the UI Delegate should be
+ informed of the exceeded quota. Increasing the size to 40kb. A 3rd
+ iframe is added, which should succeed.
+</p>
+<pre id="console"></pre>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-1.html b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-1.html
new file mode 100644
index 0000000..c50959f
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-1.html
@@ -0,0 +1,8 @@
+<html manifest="quota-origin-iframe-1.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 and fit in the quota", "*"); };
+applicationCache.onnoupdate = function() { parent.postMessage("FAIL - no update iframe-1, all caches should have been deleted before this test", "*"); };
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-1.manifest b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-1.manifest
new file mode 100644
index 0000000..63d3784
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-1.manifest
@@ -0,0 +1,7 @@
+CACHE MANIFEST
+
+# iframe-1 should succeed. The origin quota has been set to
+# 20kb. Caching abe.png and this manifest will be ~13kb.
+
+CACHE:
+abe.png
diff --git a/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-2.html b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-2.html
new file mode 100644
index 0000000..0f1c11b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-2.html
@@ -0,0 +1,8 @@
+<html manifest="quota-origin-iframe-2.manifest">
+<script>
+// iframe-2 is expected to fail due to exceeding the origin quota.
+applicationCache.oncached = function() { parent.postMessage("FAIL - cached iframe-2, expected this this fail because it reached the quota", "*"); };
+applicationCache.onerror = function() { parent.postMessage("PASS - error caching iframe-2 as expected", "*"); };
+applicationCache.onnoupdate = function() { parent.postMessage("FAIL - no update iframe-2, all caches should have been deleted before this test", "*"); };
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-2.manifest b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-2.manifest
new file mode 100644
index 0000000..64292b0
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-2.manifest
@@ -0,0 +1,8 @@
+CACHE MANIFEST
+
+# iframe-2 should fail. The origin quota has been set to
+# 20kb, with ~13kb already cached. Caching abe.png and this
+# manifest (~13kb) should exceed the quota and fail.
+
+CACHE:
+abe.png
diff --git a/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-3.html b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-3.html
new file mode 100644
index 0000000..a185e54
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-3.html
@@ -0,0 +1,8 @@
+<html manifest="quota-origin-iframe-3.manifest">
+<script>
+// iframe-3 is expected to succeed once the quota has been increased.
+applicationCache.oncached = function() { parent.postMessage("PASS - cached iframe-3", "*"); };
+applicationCache.onerror = function() { parent.postMessage("FAIL - error caching iframe-3, expected this to succeed with the quota increased", "*"); };
+applicationCache.onnoupdate = function() { parent.postMessage("FAIL - no update iframe-3, all caches should have been deleted before this test", "*"); };
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-3.manifest b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-3.manifest
new file mode 100644
index 0000000..bc29867
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/quota-origin-iframe-3.manifest
@@ -0,0 +1,8 @@
+CACHE MANIFEST
+
+# iframe-3 should succeed. The origin quota shuld have been
+# raised to 40kb, with ~13kb already cached. Caching abe.png
+# and this manifest will be ~13kb, bringing us up to 26kb.
+
+CACHE:
+abe.png