WebKit Bugzilla
Attachment 349804 Details for
Bug 189560
: Add stability to tests for web API statistics
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189560-20180914142550.patch (text/plain), 14.76 KB, created by
Woodrow Wang
on 2018-09-14 14:25:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Woodrow Wang
Created:
2018-09-14 14:25:51 PDT
Size:
14.76 KB
patch
obsolete
>Subversion Revision: 236017 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 334e72844d378dacef4ca44f8c9e1e281f86c5b8..a3553c803a8b1687b0a1a5bb1073bb5bf614824a 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,25 @@ >+2018-09-12 Woodrow Wang <woodrow_wang@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-10 Woodrow Wang <woodrow_wang@apple.com> > > Add Web API Statistics Collection >diff --git a/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt b/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt >index 16a6e6986af2c01396302f2e16e9d967b727934e..a2c27087dc2d1f1852482838329a7d5b3bdc4b29 100644 >--- a/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt >+++ b/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt >@@ -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 @@ High level domain: 127.0.0.1 > fontsSuccessfullyLoaded: > Helvetica > Times >- Courier > topFrameRegistrableDomainsWhichAccessedWebAPIs: >- 127.0.0.1: 8 >+ 127.0.0.1: 4 > canvasTextWritten: > suspicious invisible text > canvasReadData: Yes >diff --git a/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html b/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html >index 53f2b7c0124849d3c05930d274289bc9a3eec5e7..1b6b3974fa8a27611ce968c16fc7cc956ea2d326 100644 >--- a/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html >+++ b/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection.html >@@ -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="/js-test-resources/js-test.js"></script> > </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); >diff --git a/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt b/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt >index a9ef32f34faab89b1bc211fff4c59be35601f791..9d136be0cc8ca369fcec8cab914ad907bd96d692 100644 >--- a/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt >+++ b/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt >@@ -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 @@ High level domain: 127.0.0.1 > notARealFont > fontsSuccessfullyLoaded: > Times >- Courier > topFrameRegistrableDomainsWhichAccessedWebAPIs: >- 127.0.0.1: 9 >+ 127.0.0.1: 5 > canvasReadData: No > >diff --git a/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html b/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html >index 6fcd1a05fd9fa3a826409439eb1b2658d2e26064..a1db3e2c73f011d125c0be03b62479cede3e578f 100644 >--- a/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html >+++ b/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection.html >@@ -2,17 +2,17 @@ > <head> > <meta charset="UTF-8"> > <title>Test for font loading data collection in resource load statistics</title> >- <script src="/js-test-resources/js-test.js"></script> > </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); >diff --git a/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt b/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt >index 05310683d2ca1f8ef8e07de40635d4489184a24f..b565c5975d9074ef6cccbe98a6dd4ab1fb1b2a24 100644 >--- a/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt >+++ b/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt >@@ -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 @@ High level domain: 127.0.0.1 > isMarkedForCookieBlocking: No > fontsSuccessfullyLoaded: > Times >- Courier > topFrameRegistrableDomainsWhichAccessedWebAPIs: >- 127.0.0.1: 12 >+ 127.0.0.1: 8 > navigatorFunctionsAccessed: > appVersion > userAgent >diff --git a/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html b/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html >index cfac11d88858b485b9d55ea88da099f48b0cf54e..8aabc322ca933b6e6c61778ff38ceafb4dedb278 100644 >--- a/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html >+++ b/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection.html >@@ -2,17 +2,17 @@ > <head> > <meta charset="UTF-8"> > <title>Test for navigator functions accessed data collection in resource load statistics</title> >- <script src="/js-test-resources/js-test.js"></script> > </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); >diff --git a/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt b/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt >index c1eaaa5d07abbaf29489d53d72a09618f73ce595..e428db5b5c4828eb0774d1931bcc978f5e7b8bbe 100644 >--- a/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt >+++ b/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt >@@ -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 @@ High level domain: 127.0.0.1 > isMarkedForCookieBlocking: No > fontsSuccessfullyLoaded: > Times >- Courier > topFrameRegistrableDomainsWhichAccessedWebAPIs: >- 127.0.0.1: 13 >+ 127.0.0.1: 9 > screenFunctionsAccessed: > height > width >diff --git a/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html b/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html >index 4a49203231f97389020f8cd548185999a6af081a..8d553795070b0dd2e14eb21a38252c135d24e456 100644 >--- a/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html >+++ b/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection.html >@@ -2,17 +2,17 @@ > <head> > <meta charset="UTF-8"> > <title>Test for screen functions accessed data collection in resource load statistics</title> >- <script src="/js-test-resources/js-test.js"></script> > </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);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189560
:
349586
|
349615
|
349622
|
349686
|
349717
|
349781
|
349787
|
349796
| 349804