Header parsing for experimental and internal debug features
[WebKit-https.git] / LayoutTests / http / tests / webAPIStatistics / canvas-read-and-write-data-collection.html
1 <!DOCTYPE html><!-- webkit-test-runner [ internal:WebAPIStatisticsEnabled=true ] -->
2 <head>
3     <meta charset="UTF-8">
4     <title>Test for canvas read and write data collection in resource load statistics</title>
5     <script src="/js-test-resources/js-test.js"></script>
6 </head>
7 <body>
8 <script>
9     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.");
10     const hostUnderTest = "127.0.0.1:8000";
11     const statisticsUrl = "http://" + hostUnderTest + "/temp";
12
13     function completeTest() {
14         testRunner.dumpResourceLoadStatistics();
15             
16         testRunner.statisticsResetToConsistentState(function() {
17             testRunner.notifyDone();
18         });
19     }
20
21     function runTestRunnerTest() {
22         testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
23
24         testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
25     
26         var canvas = document.createElement('canvas');
27         var context = canvas.getContext('2d');
28         context.fillText('suspicious invisible text', 2, 15);
29         canvas.toDataURL();
30     }
31
32     if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
33         testRunner.waitUntilDone();
34         internals.setResourceLoadStatisticsEnabled(true);
35         testRunner.setWebAPIStatisticsEnabled(true);
36         runTestRunnerTest();
37     }
38 </script>
39 </body>
40 </html>