Make http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame...
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Jan 2020 01:52:56 +0000 (01:52 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Jan 2020 01:52:56 +0000 (01:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=206100
<rdar://problem/58492335>

Unreviewed test gardening.

* http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins-database.html:
* http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html:
    These two tests now use setEnableFeature() in resources/util.js which makes sure
    testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned() is called with
    false before ending the test.

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

LayoutTests/ChangeLog
LayoutTests/http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins-database.html
LayoutTests/http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html

index 1046204..baad634 100644 (file)
@@ -1,3 +1,17 @@
+2020-01-10  John Wilander  <wilander@apple.com>
+
+        Make http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins* use resource/util.js
+        https://bugs.webkit.org/show_bug.cgi?id=206100
+        <rdar://problem/58492335>
+
+        Unreviewed test gardening.
+
+        * http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins-database.html:
+        * http/tests/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html:
+            These two tests now use setEnableFeature() in resources/util.js which makes sure 
+            testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned() is called with
+            false before ending the test.
+
 2020-01-10  Ryan Haddad  <ryanhaddad@apple.com>
 
         3 editing/spelling test failures on Mojave Release WK1
index b854090..ca2ec6d 100644 (file)
@@ -4,8 +4,9 @@
     <meta charset="UTF-8">
     <title>Tests for Classification Based on Sub Frame Under Top Frame Origins</title>
     <script src="/js-test-resources/js-test.js"></script>
+    <script src="resources/util.js"></script>
 </head>
-<body>
+<body onload="run()">
 <script>
     const hostUnderTest = "127.0.0.1:8000";
     const statisticsUrl = "http://" + hostUnderTest + "/temp";
         else
             testPassed("Host did not get classified as prevalent resource.");
 
-        testRunner.statisticsResetToConsistentState(function() {
+        setEnableFeature(false, function() {
             testRunner.notifyDone();
         });
     }
 
     function runTestRunnerTest() {
-        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
-
         testRunner.setStatisticsPrevalentResource(statisticsUrl, false, function() {
             if (testRunner.isStatisticsPrevalentResource(statisticsUrl))
                 testFailed("Host did not get set as non-prevalent resource.");
         });
     }
 
-    if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
-        testRunner.setUseITPDatabase(true);
-        testRunner.waitUntilDone();
-        internals.setResourceLoadStatisticsEnabled(true);
-        runTestRunnerTest();
+    function run() {
+        if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
+            testRunner.setUseITPDatabase(true);
+            testRunner.waitUntilDone();
+            setEnableFeature(true, runTestRunnerTest);
+        }
     }
 </script>
 </body>
index 9ce13df..d91de94 100644 (file)
@@ -4,8 +4,9 @@
     <meta charset="UTF-8">
     <title>Tests for Classification Based on Sub Frame Under Top Frame Origins</title>
     <script src="/js-test-resources/js-test.js"></script>
+    <script src="resources/util.js"></script>
 </head>
-<body>
+<body onload="run()">
 <script>
     const hostUnderTest = "127.0.0.1:8000";
     const statisticsUrl = "http://" + hostUnderTest + "/temp";
         else
             testPassed("Host did not get classified as prevalent resource.");
 
-        testRunner.statisticsResetToConsistentState(function() {
+        setEnableFeature(false, function() {
             testRunner.notifyDone();
         });
     }
 
     function runTestRunnerTest() {
-        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
-
         testRunner.setStatisticsPrevalentResource(statisticsUrl, false, function() {
             if (testRunner.isStatisticsPrevalentResource(statisticsUrl))
                 testFailed("Host did not get set as non-prevalent resource.");
         });
     }
 
-    if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
-        testRunner.waitUntilDone();
-        internals.setResourceLoadStatisticsEnabled(true);
-        runTestRunnerTest();
+    function run() {
+        if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
+            testRunner.waitUntilDone();
+            setEnableFeature(true, runTestRunnerTest);
+        }
     }
 </script>
 </body>