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

Unified Diff: chrome/browser/resources/bluetooth_internals/interfaces.js

Issue 2428773005: bluetooth: Basic browser tests for chrome://bluetooth-internals. (Closed)
Patch Set: Fix tests Created 4 years, 1 month 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
Index: chrome/browser/resources/bluetooth_internals/interfaces.js
diff --git a/chrome/browser/resources/bluetooth_internals/interfaces.js b/chrome/browser/resources/bluetooth_internals/interfaces.js
index 2054100ce11e530620c02795fc24715ff086974e..675e6cfc749ac09b3114ffbe464e617a3eb12979 100644
--- a/chrome/browser/resources/bluetooth_internals/interfaces.js
+++ b/chrome/browser/resources/bluetooth_internals/interfaces.js
@@ -8,21 +8,6 @@
*/
cr.define('interfaces', function() {
-
- /**
- * TODO(crbug.com/652361): Move to shared location.
- * Helper to convert callback-based define() API to a promise-based API.
- * @param {!Array<string>} moduleNames
- * @return {!Promise}
- */
- function importModules(moduleNames) {
- return new Promise(function(resolve, reject) {
- define(moduleNames, function(var_args) {
- resolve(Array.prototype.slice.call(arguments, 0));
- });
- });
- }
-
/**
* Initializes Mojo proxies for page and Bluetooth services.
* @return {!Promise} resolves if adapter is acquired, rejects if Bluetooth
@@ -63,7 +48,18 @@ cr.define('interfaces', function() {
});
}
+ /**
+ * Overriden by tests to give them a chance to setup a fake Mojo browser proxy
+ * before any other code executes.
+ * @return {!Promise} A promise firing once necessary setup has been completed.
+ */
+ var setupFn = window.setupFn || function() { return Promise.resolve(); };
+
+ function initialize() {
+ return setupFn().then(initializeProxies);
+ }
+
return {
- initialize: initializeProxies,
+ initialize: initialize,
};
});

Powered by Google App Engine
This is Rietveld 408576698