1 <!DOCTYPE html><!-- webkit-test-runner [ internal:WebAPIStatisticsEnabled=true ] -->
4 <title>Test for canvas read and write data collection in resource load statistics</title>
7 internals.setResourceLoadStatisticsEnabled(false);
10 <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>
12 const hostUnderTest = "127.0.0.1:8000";
13 const statisticsUrl = "http://" + hostUnderTest + "/temp";
15 function completeTest() {
16 testRunner.statisticsResetToConsistentState(function() {
17 testRunner.notifyDone();
21 function runTestRunnerTest() {
22 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
24 testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
26 var canvas = document.createElement('canvas');
27 var context = canvas.getContext('2d');
28 context.fillText('suspicious invisible text', 2, 15);
30 testRunner.statisticsNotifyObserver();
33 if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
34 testRunner.dumpAsText();
35 testRunner.dumpResourceLoadStatistics();
36 testRunner.waitUntilDone();
37 internals.setResourceLoadStatisticsEnabled(true);
38 testRunner.setWebAPIStatisticsEnabled(true);