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

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

Issue 1639233004: Revert of [mojo] Enable ServiceRegistryImpl to override remote services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@usb-testing-3
Patch Set: 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 | « third_party/WebKit/LayoutTests/harness-tests/mojo-helpers.html ('k') | no next file » | 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 // Runs a promise_test which depends on the Mojo system API modules available to 7 // 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 8 // all layout tests. The test implementation function is called with an Object
9 // that exposes common Mojo module interfaces. 9 // that exposes common Mojo module interfaces.
10 function mojo_test(func, name, properties) { 10 function mojo_test(func, name, properties) {
(...skipping 17 matching lines...) Expand all
28 // called |serviceRegistry|, so let's call it that here. 28 // called |serviceRegistry|, so let's call it that here.
29 serviceRegistry: serviceProvider, 29 serviceRegistry: serviceProvider,
30 })); 30 }));
31 } catch (e) { 31 } catch (e) {
32 reject(e); 32 reject(e);
33 } 33 }
34 }); 34 });
35 }); 35 });
36 }, name, properties); 36 }, name, properties);
37 } 37 }
38
39 // Polls aggressively for a message to become available on a pipe.
40 function mojo_wait_for_incoming_message(mojo, pipe) {
41 return new Promise((resolve, reject) => {
42 let wait = () => {
43 let result = mojo.core.readMessage(pipe, 0);
44 if (result.result === mojo.core.RESULT_SHOULD_WAIT) {
45 setTimeout(wait);
46 return;
47 }
48
49 if (result.result !== mojo.core.RESULT_OK) {
50 reject(result.result);
51 return;
52 }
53
54 resolve({ buffer: result.buffer, handles: result.handles });
55 };
56
57 wait();
58 });
59 };
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/harness-tests/mojo-helpers.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698