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 | 7 // Fix up the global window.define, since all baked-in Mojo modules expect to |
8 // find it there. This define() also returns a promise to the module. | 8 // find it there. This define() also returns a promise to the module. |
9 let define = (function(){ | 9 let define = (function(){ |
10 let moduleCache = new Map(); | 10 let moduleCache = new Map(); |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 })(); | 28 })(); |
29 | 29 |
30 define('Mojo Helpers', [ | 30 define('Mojo Helpers', [ |
31 'mojo/public/js/core', | 31 'mojo/public/js/core', |
32 'mojo/public/js/router', | 32 'mojo/public/js/router', |
33 'mojo/public/js/support', | 33 'mojo/public/js/support', |
34 'content/public/renderer/frame_service_registry', | 34 'content/public/renderer/frame_service_registry', |
35 'content/public/renderer/service_registry', | 35 'content/public/renderer/service_registry', |
36 ], (core, router, support, frameServiceRegistry, serviceRegistry) => { | 36 ], (core, router, support, frameServiceRegistry, serviceRegistry) => { |
37 if (window.add_completion_callback) { | 37 add_completion_callback(() => { |
38 add_completion_callback(() => { | 38 frameServiceRegistry.clearServiceOverridesForTesting(); |
39 frameServiceRegistry.clearServiceOverridesForTesting(); | 39 serviceRegistry.clearServiceOverridesForTesting(); |
40 serviceRegistry.clearServiceOverridesForTesting(); | 40 }); |
41 }); | |
42 } | |
43 | 41 |
44 return { | 42 return { |
45 core, | 43 core, |
46 router, | 44 router, |
47 support, | 45 support, |
48 frameServiceRegistry, | 46 frameServiceRegistry, |
49 serviceRegistry, | 47 serviceRegistry, |
50 }; | 48 }; |
51 }); | 49 }); |
52 | 50 |
(...skipping 29 matching lines...) Expand all Loading... |
82 let buffer, handles; | 80 let buffer, handles; |
83 ({ result, buffer, handles } = mojo.core.readMessage(pipe, 0)); | 81 ({ result, buffer, handles } = mojo.core.readMessage(pipe, 0)); |
84 if (result !== mojo.core.RESULT_OK) { | 82 if (result !== mojo.core.RESULT_OK) { |
85 reject(result); | 83 reject(result); |
86 return; | 84 return; |
87 } | 85 } |
88 resolve({ buffer, handles }); | 86 resolve({ buffer, handles }); |
89 }); | 87 }); |
90 }); | 88 }); |
91 }; | 89 }; |
OLD | NEW |