diff options
Diffstat (limited to 'testing/web-platform/tests/webusb/resources/open-in-iframe.html')
-rw-r--r-- | testing/web-platform/tests/webusb/resources/open-in-iframe.html | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webusb/resources/open-in-iframe.html b/testing/web-platform/tests/webusb/resources/open-in-iframe.html new file mode 100644 index 0000000000..730db24902 --- /dev/null +++ b/testing/web-platform/tests/webusb/resources/open-in-iframe.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<!-- Intentionally use relative paths here because this file is also used by blink/web_tests/usb/usbDevice-iframe.html. --> +<script src="../../resources/test-only-api.js"></script> +<script src="usb-helpers.js"></script> +<script> +'use strict'; +window.onmessage = messageEvent => { + if (messageEvent.data === 'Ready') { + navigator.usb.addEventListener('connect', connectEvent => { + connectEvent.device.open().then(() => { + parent.postMessage('Success', '*'); + }).catch(error => { + parent.postMessage('FAIL: open rejected ' + error, '*'); + }); + }); + parent.postMessage('Ready', '*'); + } +}; +</script> |