2011-01-19 Andrey Kosyakov <caseq@chromium.org>
authorcaseq@chromium.org <caseq@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jan 2011 07:36:10 +0000 (07:36 +0000)
committercaseq@chromium.org <caseq@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jan 2011 07:36:10 +0000 (07:36 +0000)
        Reviewed by Yury Semikhatsky.

        Flaky Test: http/tests/inspector/extensions-resources-redirect.html
        https://bugs.webkit.org/show_bug.cgi?id=52709

        * http/tests/inspector/extensions-resources-redirect-expected.txt:
        * http/tests/inspector/extensions-resources-redirect.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76210 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/extensions-resources-redirect-expected.txt
LayoutTests/http/tests/inspector/extensions-resources-redirect.html

index 543861f..aec5e65 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-19  Andrey Kosyakov  <caseq@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Flaky Test: http/tests/inspector/extensions-resources-redirect.html
+        https://bugs.webkit.org/show_bug.cgi?id=52709
+
+        * http/tests/inspector/extensions-resources-redirect-expected.txt:
+        * http/tests/inspector/extensions-resources-redirect.html:
+
 2011-01-19  Dominic Cooney  <dominicc@google.com>
 
         Reviewed by Kent Tamura.
index c1903de..97cd996 100644 (file)
@@ -8,8 +8,8 @@ RUNNING TEST: extension_testGetRedirectResourceContent
 
 content: undefined, encoding: undefined
 RUNNING TEST: extension_testRedirectResourceFinished
-Finished resource: http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true
 Finished resource: http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?status=302
+Finished resource: http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true
 RUNNING TEST: extension_testRedirectResourcesInHAR
 Resources in HAR:
 http://127.0.0.1:8000/inspector/extensions-resources-redirect.html
index 399d7fc..908f645 100755 (executable)
@@ -5,28 +5,28 @@
 <script src="extensions-test.js"></script>
 <script type="text/javascript">
 
-function extension_doRequest(callback)
+function extension_doRequest(force, callback, nextTest)
 {
-    var userCallbackCalled = false;
-    function callbackWrapper()
+    function callbackWrapper(resource)
     {
-        if (!userCallbackCalled) {
-            userCallbackCalled = true;
+        var lastCallback = !resource || /\?redirected=true$/.test(resource.request.url);
+        if (lastCallback)
             webInspector.resources.onFinished.removeListener(callbackWrapper);
-            callback();
-        }
+        callback(resource, lastCallback);
     }
     webInspector.resources.onFinished.addListener(callbackWrapper);
-    webInspector.inspectedWindow.eval("doRequest()", function(result) {
+    webInspector.inspectedWindow.eval("doRequest(" + force + ")", function(result) {
         if (result)
-            callbackWrapper();
+            callbackWrapper(null);
     });
 }
 
 function extension_testGetRedirectResourceContent(nextTest)
 {
-    function onFinished()
+    function onFinished(resource, lastCallback)
     {
+        if (!lastCallback)
+            return;
         extension_getResourceByUrl([ /redirect-methods-result.php\?status=302$/ ], function(resource) {
             resource.getContent(onContent)
         });
@@ -36,14 +36,15 @@ function extension_testGetRedirectResourceContent(nextTest)
         output("content: " + content + ", encoding: " + encoding);
         nextTest();
     }
-    extension_doRequest(onFinished);
+    extension_doRequest(false, onFinished);
 }
 
 function extension_testRedirectResourcesInHAR(nextTest)
 {
-    function onFinished()
+    function onFinished(resource, lastCallback)
     {
-        webInspector.resources.getHAR(onHAR);
+        if (lastCallback)
+            webInspector.resources.getHAR(onHAR);
     }
     function onHAR(har)
     {
@@ -59,22 +60,18 @@ function extension_testRedirectResourcesInHAR(nextTest)
         output("Resources in HAR:\n" + urls.join("\n"));
         nextTest();
     }
-    extension_doRequest(onFinished);
+    extension_doRequest(false, onFinished);
 }
 
 function extension_testRedirectResourceFinished(nextTest)
 {
-    var finishedCount = 0;
-    function onFinished(resource)
+    function onFinished(resource, lastCallback)
     {
         output("Finished resource: " + resource.request.url);
-        if (++finishedCount === 2) {
-            webInspector.resources.onFinished.removeListener(onFinished);
+        if (lastCallback)
             nextTest();
-        }
     }
-    webInspector.resources.onFinished.addListener(onFinished);
-    webInspector.inspectedWindow.eval("doRequest(true)");
+    extension_doRequest(true, onFinished);
 }
 
 var requestDone = false;