Source/WebCore:
[WebKit-https.git] / LayoutTests / http / tests / resourceLoadStatistics / set-custom-prevalent-resource-in-debug-mode-database.html
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4     <meta charset="UTF-8">
5     <script src="/js-test-resources/js-test.js"></script>
6     <script src="resources/util.js"></script>
7 </head>
8 <body>
9 <script>
10     description("Test for enabling debug mode and that it allows setting a custom domain as a prevalent resource.");
11     jsTestIsAsync = true;
12
13     const thirdPartyOrigin = "http://localhost:8000";
14
15     if (window.testRunner && window.internals) {
16         testRunner.setUseITPDatabase(true);
17         setEnableFeature(true, function() {
18             if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
19                 testFailed(thirdPartyOrigin + " already set as prevalent resource.");
20
21             testRunner.setStatisticsPrevalentResourceForDebugMode(thirdPartyOrigin, function() {
22                 testRunner.setStatisticsDebugMode(true, function() {
23                     if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
24                         testFailed(thirdPartyOrigin + " didn't get set as prevalent resource.");
25                     else
26                         testPassed(thirdPartyOrigin + " got set as a custom prevalent resource in debug mode.");
27                     testRunner.setStatisticsDebugMode(false, function() {
28                         setEnableFeature(false, finishJSTest);
29                     });
30                 });
31             });
32         });
33     }
34 </script>
35 </body>
36 </html>