-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathclassify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
50 lines (44 loc) · 1.84 KB
/
classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tests for Classification Based on Sub Frame Under Top Frame Origins</title>
<script src="/js-test-resources/js-test.js"></script>
<script src="resources/util.js"></script>
</head>
<body onload="run()">
<script>
const hostUnderTest = "127.0.0.1:8000";
const statisticsUrl = "http://" + hostUnderTest + "/temp";
const topFrameOrigin1 = "http://127.0.0.2:8000/temp";
const topFrameOrigin2 = "http://127.0.0.3:8000/temp";
const topFrameOrigin3 = "http://127.0.0.4:8000/temp";
function completeTest() {
if (testRunner.isStatisticsPrevalentResource(statisticsUrl))
testFailed("Host classified as prevalent resource.");
else
testPassed("Host did not get classified as prevalent resource.");
setEnableFeature(false, function() {
testRunner.notifyDone();
});
}
function runTestRunnerTest() {
testRunner.setStatisticsPrevalentResource(statisticsUrl, false, async function() {
if (testRunner.isStatisticsPrevalentResource(statisticsUrl))
testFailed("Host did not get set as non-prevalent resource.");
testRunner.setStatisticsSubframeUnderTopFrameOrigin(statisticsUrl, topFrameOrigin1);
testRunner.setStatisticsSubframeUnderTopFrameOrigin(statisticsUrl, topFrameOrigin2);
testRunner.setStatisticsSubframeUnderTopFrameOrigin(statisticsUrl, topFrameOrigin3);
await testRunner.statisticsProcessStatisticsAndDataRecords();
completeTest();
});
}
function run() {
if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
testRunner.waitUntilDone();
setEnableFeature(true, runTestRunnerTest);
}
}
</script>
</body>
</html>