| 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 => { |
| 11 assert_true(mojo instanceof Object); | 11 assert_true(mojo instanceof Object); |
| 12 assert_true(mojo.core instanceof Object); | 12 assert_true(mojo.core instanceof Object); |
| 13 assert_true(mojo.router instanceof Object); | 13 assert_true(mojo.router instanceof Object); |
| 14 assert_true(mojo.frameServiceRegistry instanceof Object); |
| 14 assert_true(mojo.serviceRegistry instanceof Object); | 15 assert_true(mojo.serviceRegistry instanceof Object); |
| 15 }, 'Mojo system APIs should be available to layout tests.'); | 16 }, 'Mojo system APIs should be available to layout tests.'); |
| 16 | 17 |
| 17 mojo_test(mojo => { | 18 mojo_test(mojo => { |
| 18 return new Promise(resolve => { | 19 return new Promise(resolve => { |
| 19 let calls = 0; | 20 let calls = 0; |
| 20 // Complete the test as soon as two requests come in for a Frobinator servic
e. | 21 // Complete the test as soon as two requests come in for a Frobinator servic
e. |
| 22 mojo.frameServiceRegistry.addServiceOverrideForTesting('Frobinator', () => { |
| 23 if (++calls == 2) |
| 24 resolve(); |
| 25 }); |
| 26 |
| 27 // Try to connect to the browser's Frobinator service. This should be |
| 28 // intercepted by the above override. |
| 29 mojo.frameServiceRegistry.connectToService('Frobinator'); |
| 30 mojo.frameServiceRegistry.connectToService('Frobinator'); |
| 31 }); |
| 32 }, 'Frame service registry overrides should be properly intercepted.'); |
| 33 |
| 34 mojo_test(mojo => { |
| 35 return new Promise(resolve => { |
| 36 let calls = 0; |
| 37 // Complete the test as soon as two requests come in for a Frobinator servic
e. |
| 21 mojo.serviceRegistry.addServiceOverrideForTesting('Frobinator', () => { | 38 mojo.serviceRegistry.addServiceOverrideForTesting('Frobinator', () => { |
| 22 if (++calls == 2) | 39 if (++calls == 2) |
| 23 resolve(); | 40 resolve(); |
| 24 }); | 41 }); |
| 25 | 42 |
| 26 // Try to connect to the browser's Frobinator service. This should be | 43 // Try to connect to the browser's Frobinator service. This should be |
| 27 // intercepted by the above override. | 44 // intercepted by the above override. |
| 28 mojo.serviceRegistry.connectToService('Frobinator'); | 45 mojo.serviceRegistry.connectToService('Frobinator'); |
| 29 mojo.serviceRegistry.connectToService('Frobinator'); | 46 mojo.serviceRegistry.connectToService('Frobinator'); |
| 30 }); | 47 }); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 popup.close(); | 124 popup.close(); |
| 108 window.removeEventListener('message', listener); | 125 window.removeEventListener('message', listener); |
| 109 assert_true(result.data); | 126 assert_true(result.data); |
| 110 resolve(); | 127 resolve(); |
| 111 } | 128 } |
| 112 window.addEventListener('message', listener); | 129 window.addEventListener('message', listener); |
| 113 popup = window.open('resources/mojo-helpers-inner.html'); | 130 popup = window.open('resources/mojo-helpers-inner.html'); |
| 114 }); | 131 }); |
| 115 }, 'Mojo bindings are accessible from popups'); | 132 }, 'Mojo bindings are accessible from popups'); |
| 116 </script> | 133 </script> |
| OLD | NEW |