Title: [167601] trunk/LayoutTests
Revision
167601
Author
[email protected]
Date
2014-04-21 11:55:14 -0700 (Mon, 21 Apr 2014)

Log Message

http/tests/cache/subresource-failover-to-network.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=131936

Reviewed by Brady Eidson.

The test was racy, because it was unintentionally queuing TestRunner operations
twice. Also, it failed to clean up its cookie.

Rewrote to not use TestRunner queuing, making the test work in browser.

* http/tests/cache/resources/subresource-failover-to-network.cgi:
* http/tests/cache/subresource-failover-to-network.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (167600 => 167601)


--- trunk/LayoutTests/ChangeLog	2014-04-21 18:43:01 UTC (rev 167600)
+++ trunk/LayoutTests/ChangeLog	2014-04-21 18:55:14 UTC (rev 167601)
@@ -1,3 +1,18 @@
+2014-04-21  Alexey Proskuryakov  <[email protected]>
+
+        http/tests/cache/subresource-failover-to-network.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=131936
+
+        Reviewed by Brady Eidson.
+
+        The test was racy, because it was unintentionally queuing TestRunner operations
+        twice. Also, it failed to clean up its cookie.
+
+        Rewrote to not use TestRunner queuing, making the test work in browser.
+
+        * http/tests/cache/resources/subresource-failover-to-network.cgi:
+        * http/tests/cache/subresource-failover-to-network.html:
+
 2014-04-21  David Hyatt  <[email protected]>
 
         [New Multicolumn] Pagination mode messed up with non-inline axis and reversed direction.

Modified: trunk/LayoutTests/http/tests/cache/resources/subresource-failover-to-network.cgi (167600 => 167601)


--- trunk/LayoutTests/http/tests/cache/resources/subresource-failover-to-network.cgi	2014-04-21 18:43:01 UTC (rev 167600)
+++ trunk/LayoutTests/http/tests/cache/resources/subresource-failover-to-network.cgi	2014-04-21 18:55:14 UTC (rev 167601)
@@ -6,7 +6,6 @@
 <script>
 try {
   var result = document.cookie.split(';')[0].split('=')[1];
-  document.cookie = "result=PASS"; // for next time
 
   var r = new XMLHttpRequest();
   r.open('POST', 'echo-no-store.cgi', false);
@@ -15,5 +14,16 @@
 } catch (e) {
   document.write(e);
 }
+if (!sessionStorage.subresourceFailoverToNetworkCGILoadedBefore) {
+  sessionStorage.subresourceFailoverToNetworkCGILoadedBefore = true;
+  document.cookie = "subresourceFailoverToNetwork=PASS"; // for next time
+  history.back();
+} else {
+  sessionStorage.removeItem("subresourceFailoverToNetworkLoadedBefore");
+  sessionStorage.removeItem("subresourceFailoverToNetworkCGILoadedBefore");
+  document.cookie = "subresourceFailoverToNetwork=; expires=Thu, 01 Jan 1970 00:00:01 GMT;";
+  if (window.testRunner)
+    testRunner.notifyDone();
+}
 </script>
 EOF

Modified: trunk/LayoutTests/http/tests/cache/subresource-failover-to-network.html (167600 => 167601)


--- trunk/LayoutTests/http/tests/cache/subresource-failover-to-network.html	2014-04-21 18:43:01 UTC (rev 167600)
+++ trunk/LayoutTests/http/tests/cache/subresource-failover-to-network.html	2014-04-21 18:55:14 UTC (rev 167601)
@@ -1,19 +1,26 @@
 <body>
 <script>
-  if ("testRunner" in window) {
-    testRunner.dumpAsText();
+function test() {
+  if (!sessionStorage.subresourceFailoverToNetworkLoadedBefore) {
+    if (window.testRunner) {
+      testRunner.dumpAsText();
+      testRunner.waitUntilDone();
+    }
+    sessionStorage.subresourceFailoverToNetworkLoadedBefore = true;
 
-    document.cookie = "result=FAIL"
+    document.cookie = "subresourceFailoverToNetwork=FAIL";
 
     // The results of the form submission is a page that performs a non-
     // cacheable sync XHR request.  Upon returning to that page, we expect the
     // sync XHR request to still succeed.  This relies on it loading from the
     // network and not being restricted to loading from the cache (as the main
     // page is).
-    testRunner.queueLoadingScript("document.forms[0].submit()");
-    testRunner.queueBackNavigation(1);
-    testRunner.queueForwardNavigation(1);
-  }
+    setTimeout( function() { document.forms[0].submit(); }, 0);
+  } else
+    history.forward();
+}
+
+_onload_ = test;
 </script>
 <form method="POST" action="" enctype="multipart/form-data">
   <input type="submit">
@@ -27,4 +34,6 @@
 is loaded with the ReturnCacheDataDontLoad cache policy.  It is important that
 subresources (including XMLHttpRequest instances) do not inherit this cache
 policy.
+<p>
+This test doesn't work in browser, because it expects page cache to be disabled.
 </body>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to