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

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

Issue 1734753003: Revert of First set of WebUSB layout tests with Mojo service mocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/usb/mock-services.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/resources/mojo-helpers.js
diff --git a/third_party/WebKit/LayoutTests/resources/mojo-helpers.js b/third_party/WebKit/LayoutTests/resources/mojo-helpers.js
index aca02bc9b78c7375375d4a1a43c11a5e4d427eae..10350f7fc6da14d53e0c579956f578d7d414356b 100644
--- a/third_party/WebKit/LayoutTests/resources/mojo-helpers.js
+++ b/third_party/WebKit/LayoutTests/resources/mojo-helpers.js
@@ -6,26 +6,15 @@
// Fix up the global window.define, since all baked-in Mojo modules expect to
// find it there. This define() also returns a promise to the module.
-let define = (function(){
- let moduleCache = new Map();
-
- return function(name, deps, factory) {
- let promise = moduleCache.get(name);
- if (promise === undefined) {
- // This promise must be cached as mojo.define will only call the factory
- // function the first time the module is defined.
- promise = new Promise(resolve => {
- mojo.define(name, deps, (...modules) => {
- let result = factory(...modules);
- resolve(result);
- return result;
- });
- });
- moduleCache.set(name, promise);
- }
- return promise;
- }
-})();
+function define(name, deps, factory) {
+ return new Promise(resolve => {
+ mojo.define(name, deps, (...modules) => {
+ let result = factory(...modules);
+ resolve(result);
+ return result;
+ });
+ });
+}
// Returns a promise to an object that exposes common Mojo module interfaces.
// Additional modules to load can be specified in the |modules| parameter. The
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/usb/mock-services.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698