Index: third_party/WebKit/LayoutTests/external/wpt/webusb/usbFeaturePolicy.https.sub.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/webusb/usbFeaturePolicy.https.sub.html b/third_party/WebKit/LayoutTests/external/wpt/webusb/usbFeaturePolicy.https.sub.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..189fde7d29cc907746dd7e7bb45f4c4c24431f74 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/external/wpt/webusb/usbFeaturePolicy.https.sub.html |
@@ -0,0 +1,65 @@ |
+<!DOCTYPE html> |
+<html> |
+<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.
|
+ <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.
|
+ <title>WebUSB Feature Policy Tests</title> |
+ <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.
|
+ <script src=/resources/testharness.js></script> |
+ <script src=/resources/testharnessreport.js></script> |
iclelland.google
2017/05/02 14:42:52
@lunalu, you've been looking that the use of testh
|
+</head> |
+<body> |
+ <script> |
+ 'use strict'; |
+ |
+ promise_test( |
+ () => navigator.usb.getDevices(), |
+ 'WebUSB is available in the top-level document.'); |
+ |
+ async_test(t => { |
lunalu1
2017/05/03 15:01:21
The 3 async_tests look very similar in format. We
|
+ let frame = document.createElement('iframe'); |
+ frame.src = '/webusb/resources/check-availability.html'; |
+ |
+ window.addEventListener('message', t.step_func(evt => { |
+ if (evt.source == frame.contentWindow) { |
+ assert_equals(evt.data, '#OK'); |
+ document.body.removeChild(frame); |
+ t.done(); |
+ } |
+ })); |
+ |
+ document.body.appendChild(frame); |
+ }, 'WebUSB is available in same-origin iframes.'); |
+ |
+ async_test(t => { |
+ let frame = document.createElement('iframe'); |
+ frame.src = 'https://{{domains[www]}}:{{ports[https][0]}}/webusb/resources/check-availability.html'; |
+ |
+ window.addEventListener('message', t.step_func(evt => { |
+ if (evt.source == frame.contentWindow) { |
+ assert_equals(evt.data, '#MISSING'); |
+ document.body.removeChild(frame); |
+ t.done(); |
+ } |
+ })); |
+ |
+ document.body.appendChild(frame); |
+ }, 'WebUSB is not available cross-origin iframes.'); |
+ |
+ async_test(t => { |
+ let frame = document.createElement('iframe'); |
+ frame.src = 'https://{{domains[www]}}:{{ports[https][0]}}/webusb/resources/check-availability.html'; |
+ frame.allow = 'usb'; |
+ |
+ window.addEventListener('message', t.step_func(evt => { |
+ if (evt.source == frame.contentWindow) { |
+ assert_equals(evt.data, '#OK'); |
+ document.body.removeChild(frame); |
+ t.done(); |
+ } |
+ })); |
+ |
+ document.body.appendChild(frame); |
+ }, 'WebUSB can be enabled in cross-origin iframes using Feature Policy.'); |
+ </script> |
+</body> |
+</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.
|