Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/WebKit/LayoutTests/resources/mojo-helpers.js

Issue 2823693002: Migrate RenderThreadImpl to use ConnectionFilter instead of the ChildThread's InterfaceRegistry to … (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
29 29
30 define( 30 define(
31 'Mojo Helpers', 31 'Mojo Helpers',
32 [ 32 [
33 'mojo/public/js/core', 33 'mojo/public/js/core',
34 'mojo/public/js/router', 34 'mojo/public/js/router',
35 'mojo/public/js/support', 35 'mojo/public/js/support',
36 'content/public/renderer/connector', 36 'content/public/renderer/connector',
37 'content/public/renderer/frame_interfaces', 37 'content/public/renderer/frame_interfaces',
38 'content/public/renderer/interfaces', 38 'content/public/renderer/interfaces',
39 'content/shell/renderer/layout_test/frame_interface_registry',
40 'content/shell/renderer/layout_test/interface_registry',
41 ], 39 ],
42 (core, router, support, connector, frameInterfaces, interfaces, 40 (core, router, support, connector, frameInterfaces, interfaces) => {
43 frameInterfaceRegistry, interfaceRegistry) => {
44 let tearDown = () => { 41 let tearDown = () => {
45 connector.clearInterfaceOverridesForTesting(); 42 connector.clearInterfaceOverridesForTesting();
46 frameInterfaces.clearInterfaceOverridesForTesting(); 43 frameInterfaces.clearInterfaceOverridesForTesting();
47 interfaces.clearInterfaceOverridesForTesting(); 44 interfaces.clearInterfaceOverridesForTesting();
48 }; 45 };
49 addEventListener('unload', tearDown); 46 addEventListener('unload', tearDown);
50 if (window.add_completion_callback) 47 if (window.add_completion_callback)
51 add_completion_callback(tearDown); 48 add_completion_callback(tearDown);
52 49
53 return { 50 return {
54 core, 51 core,
55 router, 52 router,
56 support, 53 support,
57 connector, 54 connector,
58 frameInterfaces, 55 frameInterfaces,
59 frameInterfaceRegistry,
60 interfaces, 56 interfaces,
61 interfaceRegistry,
62 }; 57 };
63 }); 58 });
64 59
65 // Returns a promise to an object that exposes common Mojo module interfaces. 60 // Returns a promise to an object that exposes common Mojo module interfaces.
66 // Additional modules to load can be specified in the |modules| parameter. The 61 // Additional modules to load can be specified in the |modules| parameter. The
67 // result will contain them, in the same order, in the |modules| field. 62 // result will contain them, in the same order, in the |modules| field.
68 function loadMojoModules(name, modules = []) { 63 function loadMojoModules(name, modules = []) {
69 return define('Mojo modules: ' + name, 64 return define('Mojo modules: ' + name,
70 [ 'Mojo Helpers' ].concat(modules), 65 [ 'Mojo Helpers' ].concat(modules),
71 (mojo, ...rest) => { 66 (mojo, ...rest) => {
(...skipping 22 matching lines...) Expand all
94 let buffer, handles; 89 let buffer, handles;
95 ({ result, buffer, handles } = mojo.core.readMessage(pipe, 0)); 90 ({ result, buffer, handles } = mojo.core.readMessage(pipe, 0));
96 if (result !== mojo.core.RESULT_OK) { 91 if (result !== mojo.core.RESULT_OK) {
97 reject(result); 92 reject(result);
98 return; 93 return;
99 } 94 }
100 resolve({ buffer, handles }); 95 resolve({ buffer, handles });
101 }); 96 });
102 }); 97 });
103 }; 98 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698