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

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

Issue 1472693004: [Do not commit] Sample USB layout tests with Mojo service mocks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@usb-testing-4
Patch Set: rebase Created 4 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/usb/getDevice.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
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
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 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/usb/getDevice.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698