Index: third_party/WebKit/LayoutTests/bluetooth/resources/requestDevice-in-sandboxed-iframe.html |
diff --git a/third_party/WebKit/LayoutTests/bluetooth/resources/requestDevice-in-sandboxed-iframe.html b/third_party/WebKit/LayoutTests/bluetooth/resources/requestDevice-in-sandboxed-iframe.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..10fa000684dcda61f69d62bb4f4911a9b0a26f07 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/bluetooth/resources/requestDevice-in-sandboxed-iframe.html |
@@ -0,0 +1,18 @@ |
+<!DOCTYPE html> |
+<button onclick="RequestDevice()">Request</button> |
+<script> |
+ window.onmessage = messageEvent => { |
+ // For requestDevice to work, 'Go' should be sent while |
+ // handling a user gesture. |
+ if (messageEvent.data === 'Go') { |
+ navigator.bluetooth.requestDevice({ |
+ filters: [{services: ['heart_rate']}] |
+ }).then(() => { |
+ parent.postMessage('Should have failed.', '*'); |
+ }).catch(err => { |
+ parent.postMessage(err.name + ': ' + err.message, '*'); |
+ }); |
+ } |
+ }; |
+ parent.postMessage("Ready", "*"); |
+</script> |