| <!DOCTYPE html> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> |
| <script src="file:///gen/services/device/public/mojom/nfc.mojom.js"></script> |
| <script src="resources/nfc-helpers.js"></script> |
| <body> |
| <script> |
| 'use strict'; |
| |
| nfc_test(() => { |
| let iframe = document.createElement('iframe'); |
| iframe.src = 'resources/push-from-iframe.html'; |
| iframe.onload = () => { |
| mockNFC.attachToWindow(iframe.contentWindow); |
| iframe.contentWindow.postMessage('Ready', '*'); |
| } |
| |
| document.body.appendChild(iframe); |
| |
| return new Promise((resolve,reject) => { |
| 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> |
| </body> |