Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / navigation / beacon-cross-origin.html
blob4f959a4f82d85968e317245d93427a1614b47c9c
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="/js-test-resources/js-test.js"></script>
5 <script>
6 description("Testing navigator.sendBeacon() cross-origin.");
8 window.jsTestIsAsync = true;
10 function test() {
11 if (window.testRunner) {
12 testRunner.dumpAsText();
13 testRunner.waitUntilDone();
14 testRunner.dumpPingLoaderCallbacks();
17 shouldBeTrue('navigator.sendBeacon("http://localhost:8000/navigation/resources/save-beacon.php?name=cross-origin", "CrossOrigin");');
18 var xhr = new XMLHttpRequest();
19 xhr.open("GET", "resources/check-beacon.php?name=cross-origin");
20 xhr.onload = function () {
21 var lines = xhr.responseText.split("\n");
22 for (var i in lines)
23 testPassed(lines[i]);
24 finishJSTest();
26 xhr.onerror = function () {
27 testFailed("Unable to fetch beacon status");
28 finishJSTest();
30 xhr.send();
32 </script>
33 </head>
34 <body onload="test();">
35 </body>
36 </html>