Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="/js-test-resources/js-test.js"></script> | |
| 5 <script> | |
| 6 description('Test that event sourceCapabilities object is not shared cross-origi n'); | |
| 7 | |
| 8 window.jsTestIsAsync = true; | |
|
dcheng
2017/02/07 06:53:04
Nit: can we write this using testharness.js?
sof
2017/02/07 08:58:05
Done.
| |
| 9 | |
| 10 var finalStep = false; | |
| 11 | |
| 12 if (window.testRunner) { | |
| 13 testRunner.waitUntilDone(); | |
| 14 testRunner.dumpAsText(); | |
| 15 } | |
| 16 | |
| 17 window.addEventListener('message', function(evt) { | |
| 18 if (evt.data === "start") { | |
| 19 setTimeout(runTest); | |
| 20 return; | |
| 21 } | |
| 22 | |
| 23 shouldBeUndefined(evt.data); | |
| 24 finalStep = true; | |
| 25 runTest(); | |
| 26 }); | |
| 27 | |
| 28 function handler(event) { | |
| 29 shouldBeNonNull("event.sourceCapabilities"); | |
| 30 if (finalStep) { | |
| 31 shouldBeEqualToNumber("event.sourceCapabilities.customProperty", 42); | |
| 32 finishJSTest(); | |
| 33 return; | |
| 34 } | |
| 35 event.sourceCapabilities.customProperty = 42; | |
| 36 } | |
| 37 | |
| 38 function runTest() { | |
| 39 document.querySelector("button").click(); | |
| 40 } | |
| 41 </script> | |
| 42 </head> | |
| 43 <body> | |
| 44 <button onclick="handler(event)"></button> | |
| 45 <iframe src="http://localhost:8000/security/resources/cross-frame-mouse-source-c apabilities.html"></iframe> | |
| 46 </body> | |
| 47 </html> | |
| OLD | NEW |