| 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,
|
| };
|
| });
|
|
|