summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http/tests
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-08-13 05:20:16 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-08-13 05:20:16 -0700
commitf4958a7d95cd5fbc1c74905e229b02c95cd5ee78 (patch)
tree14a0f1b07a19948c2ed93d0d8547caa7fe10aa0e /LayoutTests/http/tests
parentd074a7997da8ce379434eb6e208b97cde8a0841c (diff)
parentf964bc1fd59a545a80a0cc2529ad8830be514871 (diff)
downloadexternal_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.zip
external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.gz
external_webkit-f4958a7d95cd5fbc1c74905e229b02c95cd5ee78.tar.bz2
Merge changes I60a96064,I6929172f,Idefd9bec,I8cf448f2,I8791737a,I992c56b0,Ibb4b089d,I779a8ec0,Ife412e30,I2da1ae98,Ibcf41849
* changes: Merge WebKit at r65072 : Update WebKit revision number. Merge WebKit at r65072 : Update test_expectations. Merge WebKit at r65072 : Complete cherry-pick of WebKit change 43848 to add EmptyDeviceMotionClient Merge WebKit at r65072 : Implement DeviceMotionClientAndroid Merge WebKit at r65072: JSC build fix in InspectorController.h Merge WebKit at r65072: Fix V8 code generator. Merge WebKit at r65072 : Build fix for JSC, update ambiguous usage of JSLock. Merge WebKit at r65072: String class has moved to the WTF namespace. Merge Webkit at r65072 : Fix conflicts. Merge Webkit at r65072 : Fix Makefiles. Merge WebKit at r65072 : Initial merge by git.
Diffstat (limited to 'LayoutTests/http/tests')
-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