Title: [252067] trunk/LayoutTests
Revision
252067
Author
drou...@apple.com
Date
2019-11-05 11:53:40 -0800 (Tue, 05 Nov 2019)

Log Message

Layout test http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html is a flakey failure
https://bugs.webkit.org/show_bug.cgi?id=203841
<rdar://problem/51752151>

Reviewed by Brian Burg.

* http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html:
Rewrite the test so it actually waits for the resource response information to be received
in the frontend before testing any information about the resource, as the response is what
contains the status code and source. Previously, we would only wait for the inspected page
to finish loading, which did guarantee that the inspector frontend at least knew about the
resource being loaded, but not necessarily that it had been told about the response.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (252066 => 252067)


--- trunk/LayoutTests/ChangeLog	2019-11-05 19:50:18 UTC (rev 252066)
+++ trunk/LayoutTests/ChangeLog	2019-11-05 19:53:40 UTC (rev 252067)
@@ -1,3 +1,18 @@
+2019-11-05  Devin Rousso  <drou...@apple.com>
+
+        Layout test http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html is a flakey failure
+        https://bugs.webkit.org/show_bug.cgi?id=203841
+        <rdar://problem/51752151>
+
+        Reviewed by Brian Burg.
+
+        * http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html:
+        Rewrite the test so it actually waits for the resource response information to be received
+        in the frontend before testing any information about the resource, as the response is what
+        contains the status code and source. Previously, we would only wait for the inspected page
+        to finish loading, which did guarantee that the inspector frontend at least knew about the
+        resource being loaded, but not necessarily that it had been told about the response.
+
 2019-11-05  Daniel Bates  <daba...@apple.com>
 
         [Cocoa] Right Command key should have location DOM_KEY_LOCATION_RIGHT instead of DOM_KEY_LOCATION_STANDARD

Modified: trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html (252066 => 252067)


--- trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html	2019-11-05 19:50:18 UTC (rev 252066)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html	2019-11-05 19:53:40 UTC (rev 252067)
@@ -5,8 +5,6 @@
 <script src=""
 <script src=""
 <script>
-TestPage.dispatchEventToFrontend("LoadComplete");
-
 function test()
 {
     let suite = InspectorTest.createAsyncSuite("Resource.ResponseSource.MemoryCache");
@@ -15,24 +13,20 @@
         suite.addTestCase({
             name, description,
             test(resolve, reject) {
-                InspectorTest.reloadPage({ignoreCache, revalidateAllResources: true});
-                InspectorTest.awaitEvent("LoadComplete").then((event) => {
-                    let resource = null;
-                    for (let item of WI.networkManager.mainFrame.resourceCollection) {
-                        if (pattern.test(item.url)) {
-                            resource = item;
-                            break;
-                        }
-                    }
-                    if (!resource) {
-                        InspectorTest.fail("Failed to find specific resource.");
-                        reject();
+                let listener = WI.Resource.addEventListener(WI.Resource.Event.ResponseReceived, (event) => {
+                    let resource = event.target;
+                    if (!pattern.test(resource.url))
                         return;
-                    }
+
                     InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should exist.");
                     InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}`);
                     InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}`);
-                }).then(resolve, reject);
+
+                    WI.Resource.removeEventListener(WI.Resource.Event.ResponseReceived, listener);
+                    resolve();
+                });
+
+                InspectorTest.reloadPage({ignoreCache, revalidateAllResources: true});
             }
         });
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to