Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
|
lunalu1
2017/05/03 15:01:21
"File names should generally be somewhat descripti
Reilly Grant (use Gerrit)
2017/05/04 01:16:50
Done.
| |
| 4 <meta charset="utf-8"> | |
|
lunalu1
2017/05/03 15:01:21
We also need more tests for this with feature poli
Reilly Grant (use Gerrit)
2017/05/04 01:16:50
Done.
| |
| 5 <title>WebUSB Feature Policy Tests</title> | |
| 6 <link rel="help" href="https://wicg.github.io/webusb/"> | |
|
lunalu1
2017/05/03 15:01:21
By the way, I assume you tested this file followin
Reilly Grant (use Gerrit)
2017/05/04 01:16:50
Yes.
| |
| 7 <script src=/resources/testharness.js></script> | |
| 8 <script src=/resources/testharnessreport.js></script> | |
|
iclelland.google
2017/05/02 14:42:52
@lunalu, you've been looking that the use of testh
| |
| 9 </head> | |
| 10 <body> | |
| 11 <script> | |
| 12 'use strict'; | |
| 13 | |
| 14 promise_test( | |
| 15 () => navigator.usb.getDevices(), | |
| 16 'WebUSB is available in the top-level document.'); | |
| 17 | |
| 18 async_test(t => { | |
|
lunalu1
2017/05/03 15:01:21
The 3 async_tests look very similar in format. We
| |
| 19 let frame = document.createElement('iframe'); | |
| 20 frame.src = '/webusb/resources/check-availability.html'; | |
| 21 | |
| 22 window.addEventListener('message', t.step_func(evt => { | |
| 23 if (evt.source == frame.contentWindow) { | |
| 24 assert_equals(evt.data, '#OK'); | |
| 25 document.body.removeChild(frame); | |
| 26 t.done(); | |
| 27 } | |
| 28 })); | |
| 29 | |
| 30 document.body.appendChild(frame); | |
| 31 }, 'WebUSB is available in same-origin iframes.'); | |
| 32 | |
| 33 async_test(t => { | |
| 34 let frame = document.createElement('iframe'); | |
| 35 frame.src = 'https://{{domains[www]}}:{{ports[https][0]}}/webusb/resources/c heck-availability.html'; | |
| 36 | |
| 37 window.addEventListener('message', t.step_func(evt => { | |
| 38 if (evt.source == frame.contentWindow) { | |
| 39 assert_equals(evt.data, '#MISSING'); | |
| 40 document.body.removeChild(frame); | |
| 41 t.done(); | |
| 42 } | |
| 43 })); | |
| 44 | |
| 45 document.body.appendChild(frame); | |
| 46 }, 'WebUSB is not available cross-origin iframes.'); | |
| 47 | |
| 48 async_test(t => { | |
| 49 let frame = document.createElement('iframe'); | |
| 50 frame.src = 'https://{{domains[www]}}:{{ports[https][0]}}/webusb/resources/c heck-availability.html'; | |
| 51 frame.allow = 'usb'; | |
| 52 | |
| 53 window.addEventListener('message', t.step_func(evt => { | |
| 54 if (evt.source == frame.contentWindow) { | |
| 55 assert_equals(evt.data, '#OK'); | |
| 56 document.body.removeChild(frame); | |
| 57 t.done(); | |
| 58 } | |
| 59 })); | |
| 60 | |
| 61 document.body.appendChild(frame); | |
| 62 }, 'WebUSB can be enabled in cross-origin iframes using Feature Policy.'); | |
| 63 </script> | |
| 64 </body> | |
| 65 </html> | |
|
lunalu1
2017/05/03 15:01:21
I don't think <head> <html> and <body> are needed
Reilly Grant (use Gerrit)
2017/05/04 01:16:50
<body> is required but the rest are not.
| |
| OLD | NEW |