https://bugs.webkit.org/show_bug.cgi?id=189560
<rdar://problem/
44396413>
Patch by Woodrow Wang <woodrow_wang@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:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236021
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-09-14 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-14 Eric Carlson <eric.carlson@apple.com>
Support arbitrary video resolution in getUserMedia API
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
fontsSuccessfullyLoaded:
Helvetica
Times
- Courier
topFrameRegistrableDomainsWhichAccessedWebAPIs:
- 127.0.0.1: 8
+ 127.0.0.1: 4
canvasTextWritten:
suspicious invisible text
canvasReadData: Yes
<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();
});
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);
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:
notARealFont
fontsSuccessfullyLoaded:
Times
- Courier
topFrameRegistrableDomainsWhichAccessedWebAPIs:
- 127.0.0.1: 9
+ 127.0.0.1: 5
canvasReadData: No
<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();
});
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);
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
isMarkedForCookieBlocking: No
fontsSuccessfullyLoaded:
Times
- Courier
topFrameRegistrableDomainsWhichAccessedWebAPIs:
- 127.0.0.1: 12
+ 127.0.0.1: 8
navigatorFunctionsAccessed:
appVersion
userAgent
<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();
});
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);
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
isMarkedForCookieBlocking: No
fontsSuccessfullyLoaded:
Times
- Courier
topFrameRegistrableDomainsWhichAccessedWebAPIs:
- 127.0.0.1: 13
+ 127.0.0.1: 9
screenFunctionsAccessed:
height
width
<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();
});
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);