OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 <script src="../resources/mojo-helpers.js"></script> | 4 <script src="../resources/mojo-helpers.js"></script> |
5 <script> | 5 <script> |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 // Verify that the mojo_test helper functions properly and Mojo bindings | 8 // Verify that the mojo_test helper functions properly and Mojo bindings |
9 // are available. | 9 // are available. |
10 mojo_test(mojo => { | 10 mojo_test(mojo => { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 let pipe = mojo.serviceRegistry.connectToService('Reversinator'); | 66 let pipe = mojo.serviceRegistry.connectToService('Reversinator'); |
67 assert_equals(mojo.core.writeMessage(pipe, TEST_REQUEST, [], 0), | 67 assert_equals(mojo.core.writeMessage(pipe, TEST_REQUEST, [], 0), |
68 mojo.core.RESULT_OK); | 68 mojo.core.RESULT_OK); |
69 | 69 |
70 return mojo_wait_for_incoming_message(mojo, pipe) | 70 return mojo_wait_for_incoming_message(mojo, pipe) |
71 .then(response => { | 71 .then(response => { |
72 assert_array_equals(new Uint8Array(response.buffer), EXPECTED_RESPONSE); | 72 assert_array_equals(new Uint8Array(response.buffer), EXPECTED_RESPONSE); |
73 assert_array_equals(response.handles, []); | 73 assert_array_equals(response.handles, []); |
74 }); | 74 }); |
75 }, 'Test code can receive response messages from mock services.'); | 75 }, 'Test code can receive response messages from mock services.'); |
| 76 |
| 77 mojo_test(() => { |
| 78 return new Promise(resolve => { |
| 79 let iframe = document.createElement('iframe'); |
| 80 let listener = result => { |
| 81 document.body.removeChild(iframe); |
| 82 window.removeEventListener('message', listener); |
| 83 assert_true(result.data); |
| 84 resolve(); |
| 85 } |
| 86 window.addEventListener('message', listener); |
| 87 iframe.setAttribute('src', 'resources/mojo-helpers-inner.html'); |
| 88 document.body.appendChild(iframe); |
| 89 }); |
| 90 }, 'Mojo bindings are accessible from iframes'); |
76 </script> | 91 </script> |
OLD | NEW |