OLD | NEW |
| (Empty) |
1 <!DOCTYPE HTML> | |
2 <html> | |
3 <head> | |
4 <script src="/js-test-resources/js-test.js"></script> | |
5 <script> | |
6 description("Checking transmission of Beacons involving cookies."); | |
7 | |
8 window.jsTestIsAsync = true; | |
9 | |
10 function test() { | |
11 if (window.testRunner) { | |
12 testRunner.dumpAsText(); | |
13 testRunner.waitUntilDone(); | |
14 testRunner.dumpPingLoaderCallbacks(); | |
15 } | |
16 try { | |
17 var xhr = new XMLHttpRequest(); | |
18 xhr.open("GET", "../cookies/resources/setCookies.cgi", false); | |
19 xhr.setRequestHeader("SET-COOKIE", "hello=world;path=/"); | |
20 xhr.send(null); | |
21 if (xhr.status != 200) { | |
22 testFailed("cookie not set"); | |
23 finishJSTest(); | |
24 } | |
25 } catch (e) { | |
26 testFailed("cookie not set"); | |
27 finishJSTest(); | |
28 } | |
29 | |
30 shouldBeTrue('navigator.sendBeacon("resources/save-beacon.php?name=cookie",
"Blip");'); | |
31 var xhr = new XMLHttpRequest(); | |
32 xhr.open("GET", "resources/check-beacon.php?name=cookie"); | |
33 xhr.onload = function () { | |
34 var lines = xhr.responseText.split("\n"); | |
35 for (var i in lines) | |
36 testPassed(lines[i]); | |
37 finishJSTest(); | |
38 }; | |
39 xhr.onerror = function () { | |
40 testFailed("Unable to fetch beacon status"); | |
41 finishJSTest(); | |
42 }; | |
43 | |
44 xhr.send(); | |
45 } | |
46 </script> | |
47 </head> | |
48 <body onload="test();"> | |
49 </body> | |
50 </html> | |
OLD | NEW |