| Index: third_party/WebKit/LayoutTests/nfc/nfc-block-iframe.html
|
| diff --git a/third_party/WebKit/LayoutTests/nfc/nfc-block-iframe.html b/third_party/WebKit/LayoutTests/nfc/nfc-block-iframe.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8ee6e38684c31bd794063c414b88e7cacf520c3f
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/nfc/nfc-block-iframe.html
|
| @@ -0,0 +1,39 @@
|
| +<!DOCTYPE html>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script src="../resources/mojo-helpers.js"></script>
|
| +<script src="resources/nfc-helpers.js"></script>
|
| +<script>
|
| +'use strict';
|
| +
|
| +nfc_test(nfc => {
|
| + return new Promise((resolve,reject) => {
|
| + let iframeMockNFC = new nfc.MockNFC;
|
| + let iframe = document.createElement('iframe');
|
| + iframe.src = 'resources/push-from-iframe.html';
|
| + iframe.onload = () => {
|
| + iframe.contentWindow.gin.define(
|
| + "Mojo Service Registry",
|
| + [ 'content/public/renderer/frame_interfaces' ],
|
| + (frameInterfaces) => {
|
| + frameInterfaces.addInterfaceOverrideForTesting(
|
| + nfc.NFC.name,
|
| + handle => { iframeMockNFC.bindingSet.addBinding(
|
| + iframeMockNFC, handle); });
|
| + iframe.contentWindow.postMessage('Ready', '*');
|
| + });
|
| + }
|
| +
|
| + document.body.appendChild(iframe);
|
| +
|
| + window.onmessage = message => {
|
| + if (message.data == 'Success') {
|
| + resolve();
|
| + } else if (message.data == 'Failure') {
|
| + reject();
|
| + }
|
| + }
|
| + });
|
| +}, 'Test that WebNFC API is not accessible from iframe context.');
|
| +
|
| +</script>
|
|
|