Title: [236021] trunk/LayoutTests
Revision
236021
Author
commit-qu...@webkit.org
Date
2018-09-14 16:15:27 -0700 (Fri, 14 Sep 2018)

Log Message

Add stability to tests for web API statistics
https://bugs.webkit.org/show_bug.cgi?id=189560
<rdar://problem/44396413>

Patch by Woodrow Wang <woodrow_w...@apple.com> on 2018-09-14
Reviewed by Chris Dumez.

Using js-test added some data to the font loading collection, which made the tests dependent on
js-test.js. Thus, if any changes were made to js-test.js the tests for web API statistics would
fail. This patch removes the dependency on js-test. Also, this patch speeds up each test
significantly by bypassing the timer in ResourceLoadObserver for recording the statistics.

* http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt:
* http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html:
* http/tests/webAPIStatistics/font-load-data-collection-expected.txt:
* http/tests/webAPIStatistics/font-load-data-collection.html:
* http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt:
* http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html:
* http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt:
* http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (236020 => 236021)


--- trunk/LayoutTests/ChangeLog	2018-09-14 22:09:30 UTC (rev 236020)
+++ trunk/LayoutTests/ChangeLog	2018-09-14 23:15:27 UTC (rev 236021)
@@ -1,3 +1,25 @@
+2018-09-14  Woodrow Wang  <woodrow_w...@apple.com>
+
+        Add stability to tests for web API statistics
+        https://bugs.webkit.org/show_bug.cgi?id=189560
+        <rdar://problem/44396413>
+
+        Reviewed by Chris Dumez.
+
+        Using js-test added some data to the font loading collection, which made the tests dependent on
+        js-test.js. Thus, if any changes were made to js-test.js the tests for web API statistics would
+        fail. This patch removes the dependency on js-test. Also, this patch speeds up each test 
+        significantly by bypassing the timer in ResourceLoadObserver for recording the statistics.  
+
+        * http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt:
+        * http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html:
+        * http/tests/webAPIStatistics/font-load-data-collection-expected.txt:
+        * http/tests/webAPIStatistics/font-load-data-collection.html:
+        * http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt:
+        * http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html:
+        * http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt:
+        * http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html:
+
 2018-09-14  Eric Carlson  <eric.carl...@apple.com>
 
         Support arbitrary video resolution in getUserMedia API

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt (236020 => 236021)


--- trunk/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt	2018-09-14 22:09:30 UTC (rev 236020)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt	2018-09-14 23:15:27 UTC (rev 236021)
@@ -1,12 +1,4 @@
 Tests for canvas read and write data collection in ResourceLoadStatistics plist by rendering and reading text on the canvas and dumping the entire resource load statistics map.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
 Resource load statistics:
 
 High level domain: 127.0.0.1
@@ -21,9 +13,8 @@
     fontsSuccessfullyLoaded:
         Helvetica
         Times
-        Courier
     topFrameRegistrableDomainsWhichAccessedWebAPIs:
-        127.0.0.1: 8
+        127.0.0.1: 4
     canvasTextWritten:
         suspicious invisible text
     canvasReadData: Yes

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html (236020 => 236021)


--- trunk/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html	2018-09-14 22:09:30 UTC (rev 236020)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html	2018-09-14 23:15:27 UTC (rev 236021)
@@ -2,17 +2,17 @@
 <head>
     <meta charset="UTF-8">
     <title>Test for canvas read and write data collection in resource load statistics</title>
-    <script src=""
 </head>
+<script>
+    internals.setResourceLoadStatisticsEnabled(false);
+</script>
 <body>
+<p> Tests for canvas read and write data collection in ResourceLoadStatistics plist by rendering and reading text on the canvas and dumping the entire resource load statistics map. </p>
 <script>
-    description("Tests for canvas read and write data collection in ResourceLoadStatistics plist by rendering and reading text on the canvas and dumping the entire resource load statistics map.");
     const hostUnderTest = "127.0.0.1:8000";
     const statisticsUrl = "http://" + hostUnderTest + "/temp";
 
-    function completeTest() {
-        testRunner.dumpResourceLoadStatistics();
-            
+    function completeTest() {  
         testRunner.statisticsResetToConsistentState(function() {
             testRunner.notifyDone();
         });
@@ -27,9 +27,12 @@
         var context = canvas.getContext('2d');
         context.fillText('suspicious invisible text', 2, 15);
         canvas.toDataURL();
+        testRunner.statisticsNotifyObserver();
     }
 
     if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
+        testRunner.dumpAsText();
+        testRunner.dumpResourceLoadStatistics();
         testRunner.waitUntilDone();
         internals.setResourceLoadStatisticsEnabled(true);
         testRunner.setWebAPIStatisticsEnabled(true);

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt (236020 => 236021)


--- trunk/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt	2018-09-14 22:09:30 UTC (rev 236020)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt	2018-09-14 23:15:27 UTC (rev 236021)
@@ -1,11 +1,5 @@
 Tests for font loading data collection in ResourceLoadStatistics plist by loading fonts and dumping the entire resource load statistics map. The test tries to load various fonts through a comma separated font-family list to draw a string with many m's since they differ in width more prominently among fonts.
 
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
 mmmmmmmmmmlli
 Resource load statistics:
 
@@ -24,8 +18,7 @@
         notARealFont
     fontsSuccessfullyLoaded:
         Times
-        Courier
     topFrameRegistrableDomainsWhichAccessedWebAPIs:
-        127.0.0.1: 9
+        127.0.0.1: 5
     canvasReadData: No
 

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html (236020 => 236021)


--- trunk/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html	2018-09-14 22:09:30 UTC (rev 236020)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html	2018-09-14 23:15:27 UTC (rev 236021)
@@ -2,17 +2,17 @@
 <head>
     <meta charset="UTF-8">
     <title>Test for font loading data collection in resource load statistics</title>
-    <script src=""
 </head>
+<script>
+    internals.setResourceLoadStatisticsEnabled(false);
+</script>
 <body>
+<p> Tests for font loading data collection in ResourceLoadStatistics plist by loading fonts and dumping the entire resource load statistics map. The test tries to load various fonts through a comma separated font-family list to draw a string with many m's since they differ in width more prominently among fonts. </p>
 <script>
-    description("Tests for font loading data collection in ResourceLoadStatistics plist by loading fonts and dumping the entire resource load statistics map. The test tries to load various fonts through a comma separated font-family list to draw a string with many m's since they differ in width more prominently among fonts.");
     const hostUnderTest = "127.0.0.1:8000";
     const statisticsUrl = "http://" + hostUnderTest + "/temp";
 
-    function completeTest() {
-        testRunner.dumpResourceLoadStatistics();
-            
+    function completeTest() {       
         testRunner.statisticsResetToConsistentState(function() {
             testRunner.notifyDone();
         });
@@ -31,9 +31,15 @@
         span.innerHTML = testFontString;
         span.style.fontFamily = 'Andale, Fransiscan, notARealFont, serif';
         body.appendChild(span);
+        // Adds a timeout to allow font loads to be recorded.
+        setTimeout(function() {
+            testRunner.statisticsNotifyObserver();
+        }, 0);
     }
 
     if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
+        testRunner.dumpAsText();
+        testRunner.dumpResourceLoadStatistics();
         testRunner.waitUntilDone();
         internals.setResourceLoadStatisticsEnabled(true);
         testRunner.setWebAPIStatisticsEnabled(true);

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt (236020 => 236021)


--- trunk/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt	2018-09-14 22:09:30 UTC (rev 236020)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt	2018-09-14 23:15:27 UTC (rev 236021)
@@ -1,12 +1,4 @@
 Tests for navigator functions accessed data collection in ResourceLoadStatistics plist by querying for all the navigator properties and dumping the entire resource load statistics map.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
 Resource load statistics:
 
 High level domain: 127.0.0.1
@@ -20,9 +12,8 @@
     isMarkedForCookieBlocking: No
     fontsSuccessfullyLoaded:
         Times
-        Courier
     topFrameRegistrableDomainsWhichAccessedWebAPIs:
-        127.0.0.1: 12
+        127.0.0.1: 8
     navigatorFunctionsAccessed:
         appVersion
         userAgent

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html (236020 => 236021)


--- trunk/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html	2018-09-14 22:09:30 UTC (rev 236020)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html	2018-09-14 23:15:27 UTC (rev 236021)
@@ -2,17 +2,17 @@
 <head>
     <meta charset="UTF-8">
     <title>Test for navigator functions accessed data collection in resource load statistics</title>
-    <script src=""
 </head>
+<script>
+    internals.setResourceLoadStatisticsEnabled(false);
+</script>
 <body>
+<p> Tests for navigator functions accessed data collection in ResourceLoadStatistics plist by querying for all the navigator properties and dumping the entire resource load statistics map. </p>
 <script>
-    description("Tests for navigator functions accessed data collection in ResourceLoadStatistics plist by querying for all the navigator properties and dumping the entire resource load statistics map.");
     const hostUnderTest = "127.0.0.1:8000";
     const statisticsUrl = "http://" + hostUnderTest + "/temp";
 
     function completeTest() {
-        testRunner.dumpResourceLoadStatistics();
-            
         testRunner.statisticsResetToConsistentState(function() {
             testRunner.notifyDone();
         });
@@ -29,9 +29,12 @@
         var mimetypes = navigator.mimeTypes;
         var plugins = navigator.plugins;
         var appversion = navigator.appVersion;
+        testRunner.statisticsNotifyObserver();
     }
 
     if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
+        testRunner.dumpAsText();
+        testRunner.dumpResourceLoadStatistics();
         testRunner.waitUntilDone();
         internals.setResourceLoadStatisticsEnabled(true);
         testRunner.setWebAPIStatisticsEnabled(true);

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt (236020 => 236021)


--- trunk/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt	2018-09-14 22:09:30 UTC (rev 236020)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt	2018-09-14 23:15:27 UTC (rev 236021)
@@ -1,12 +1,4 @@
 Tests for screen functions accessed data collection in ResourceLoadStatistics plist by querying for all the screen properties and dumping the entire resource load statistics map.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
 Resource load statistics:
 
 High level domain: 127.0.0.1
@@ -20,9 +12,8 @@
     isMarkedForCookieBlocking: No
     fontsSuccessfullyLoaded:
         Times
-        Courier
     topFrameRegistrableDomainsWhichAccessedWebAPIs:
-        127.0.0.1: 13
+        127.0.0.1: 9
     screenFunctionsAccessed:
         height
         width

Modified: trunk/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html (236020 => 236021)


--- trunk/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html	2018-09-14 22:09:30 UTC (rev 236020)
+++ trunk/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html	2018-09-14 23:15:27 UTC (rev 236021)
@@ -2,17 +2,17 @@
 <head>
     <meta charset="UTF-8">
     <title>Test for screen functions accessed data collection in resource load statistics</title>
-    <script src=""
 </head>
+<script>
+    internals.setResourceLoadStatisticsEnabled(false);
+</script>
 <body>
+<p> Tests for screen functions accessed data collection in ResourceLoadStatistics plist by querying for all the screen properties and dumping the entire resource load statistics map. </p>
 <script>
-    description("Tests for screen functions accessed data collection in ResourceLoadStatistics plist by querying for all the screen properties and dumping the entire resource load statistics map.");
     const hostUnderTest = "127.0.0.1:8000";
     const statisticsUrl = "http://" + hostUnderTest + "/temp";
 
-    function completeTest() {
-        testRunner.dumpResourceLoadStatistics();
-            
+    function completeTest() { 
         testRunner.statisticsResetToConsistentState(function() {
             testRunner.notifyDone();
         });
@@ -31,9 +31,12 @@
         var availLeft = screen.availLeft;
         var availHeight = screen.availHeight;
         var availWidth = screen.availWidth;
+        testRunner.statisticsNotifyObserver();
     }
 
     if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
+        testRunner.dumpAsText();
+        testRunner.dumpResourceLoadStatistics();
         testRunner.waitUntilDone();
         internals.setResourceLoadStatisticsEnabled(true);
         testRunner.setWebAPIStatisticsEnabled(true);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to