Commit fa763730 authored by mbrunson's avatar mbrunson Committed by Commit bot

bluetooth: Update internals page browser test fixture.

With the change in the Mojo binding system, the existing test fixture is overly
complex. A layer of indirection can be removed now that Mojo connections can be
created with arbitrary JavaScript classes.

This patch removes the TestAdapter class from bluetooth internals browser test
and directly binds the TestAdapterProxy directly to an Adapter interface.

BUG=651282

Review-Url: https://codereview.chromium.org/2620583002
Cr-Commit-Position: refs/heads/master@{#442116}
parent 68f6cfe0
......@@ -65,7 +65,7 @@ BluetoothInternalsTest.prototype = {
]);
this.binding = new bindings.Binding(adapter.AdapterFactory, this);
this.adapter = new TestAdapter();
this.adapter = new TestAdapterProxy();
this.adapterBinding_ = new bindings.Binding(adapter.Adapter,
this.adapter);
};
......@@ -82,22 +82,6 @@ BluetoothInternalsTest.prototype = {
}
};
/**
* A test adapter for the chrome://bluetooth-internals page.
* Must be used to create message pipe handle from test code.
*
* @constructor
*/
var TestAdapter = function() {
this.proxy = new TestAdapterProxy();
};
TestAdapter.prototype = {
getInfo: function() { return this.proxy.getInfo(); },
getDevices: function() { return this.proxy.getDevices(); },
setClient: function(client) { return this.proxy.setClient(client); }
};
/**
* A test adapter proxy for the chrome://bluetooth-internals page.
*
......@@ -146,11 +130,11 @@ BluetoothInternalsTest.prototype = {
this.adapterFactory = new TestAdapterFactoryProxy();
this.adapterFactory.binding.bind(handle);
this.adapterFactory.adapter.proxy.setTestDevices([
this.adapterFactory.adapter.setTestDevices([
this.fakeDeviceInfo1(),
this.fakeDeviceInfo2(),
]);
this.adapterFactory.adapter.proxy.setTestAdapter(
this.adapterFactory.adapter.setTestAdapter(
this.fakeAdapterInfo());
this.setupResolver.resolve();
......@@ -239,9 +223,9 @@ TEST_F('BluetoothInternalsTest', 'Startup_BluetoothInternals', function() {
return setupPromise.then(function() {
return Promise.all([
adapterFactory.whenCalled('getAdapter'),
adapterFactory.adapter.proxy.whenCalled('getInfo'),
adapterFactory.adapter.proxy.whenCalled('getDevices'),
adapterFactory.adapter.proxy.whenCalled('setClient'),
adapterFactory.adapter.whenCalled('getInfo'),
adapterFactory.adapter.whenCalled('getDevices'),
adapterFactory.adapter.whenCalled('setClient'),
]);
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment