| OLD | NEW |
| 1 /* | 1 /* |
| 2 * mojo-helpers contains extensions to testharness.js useful for consuming | 2 * mojo-helpers contains extensions to testharness.js useful for consuming |
| 3 * and mocking Mojo services directly within test code. | 3 * and mocking Mojo services directly within test code. |
| 4 */ | 4 */ |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 // Fix up the global window.define, since all baked-in Mojo modules expect to |
| 8 // find it there. |
| 9 window.define = mojo.define; |
| 10 |
| 7 // Runs a promise_test which depends on the Mojo system API modules available to | 11 // Runs a promise_test which depends on the Mojo system API modules available to |
| 8 // all layout tests. The test implementation function is called with an Object | 12 // all layout tests. The test implementation function is called with an Object |
| 9 // that exposes common Mojo module interfaces. | 13 // that exposes common Mojo module interfaces. |
| 10 function mojo_test(func, name, properties) { | 14 function mojo_test(func, name, properties) { |
| 11 // Fix up the global window.define, since all baked-in Mojo modules expect to | |
| 12 // find it there. | |
| 13 window.define = mojo.define; | |
| 14 | |
| 15 promise_test(() => { | 15 promise_test(() => { |
| 16 return new Promise((resolve, reject) => { | 16 return new Promise((resolve, reject) => { |
| 17 define('Mojo layout test module: ' + name, [ | 17 define('Mojo layout test module: ' + name, [ |
| 18 'mojo/public/js/core', | 18 'mojo/public/js/core', |
| 19 'mojo/public/js/router', | 19 'mojo/public/js/router', |
| 20 'content/public/renderer/service_provider', | 20 'content/public/renderer/service_provider', |
| 21 ], (core, router, serviceProvider) => { | 21 ], (core, router, serviceProvider) => { |
| 22 try { | 22 try { |
| 23 resolve(func({ | 23 resolve(func({ |
| 24 core: core, | 24 core: core, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 50 reject(result.result); | 50 reject(result.result); |
| 51 return; | 51 return; |
| 52 } | 52 } |
| 53 | 53 |
| 54 resolve({ buffer: result.buffer, handles: result.handles }); | 54 resolve({ buffer: result.buffer, handles: result.handles }); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 wait(); | 57 wait(); |
| 58 }); | 58 }); |
| 59 }; | 59 }; |
| OLD | NEW |