| Index: trunk/src/chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc
|
| ===================================================================
|
| --- trunk/src/chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc (revision 262179)
|
| +++ trunk/src/chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc (working copy)
|
| @@ -74,6 +74,7 @@
|
| device3_.reset(new testing::NiceMock<MockBluetoothDevice>(
|
| mock_adapter_, 0, "d3", "31:32:33:34:35:36",
|
| false /* paired */, false /* connected */));
|
| +
|
| }
|
|
|
| void DiscoverySessionCallback(
|
| @@ -104,13 +105,10 @@
|
| scoped_ptr<testing::NiceMock<MockBluetoothProfile> > profile2_;
|
|
|
| extensions::BluetoothEventRouter* event_router() {
|
| - return bluetooth_api()->event_router();
|
| + return extensions::BluetoothAPI::Get(browser()->profile())
|
| + ->bluetooth_event_router();
|
| }
|
|
|
| - extensions::BluetoothAPI* bluetooth_api() {
|
| - return extensions::BluetoothAPI::Get(browser()->profile());
|
| - }
|
| -
|
| private:
|
| scoped_refptr<Extension> empty_extension_;
|
| };
|
| @@ -156,11 +154,6 @@
|
| return true;
|
| }
|
|
|
| -static bool CallErrorClosure(const BluetoothDevice::ErrorCallback& callback) {
|
| - callback.Run();
|
| - return true;
|
| -}
|
| -
|
| static void StopDiscoverySessionCallback(const base::Closure& callback,
|
| const base::Closure& error_callback) {
|
| callback.Run();
|
| @@ -325,9 +318,9 @@
|
| testing::Mock::VerifyAndClearExpectations(device1_.get());
|
| EXPECT_CALL(*mock_adapter_, GetDevice(device1_->GetAddress()))
|
| .WillOnce(testing::Return(device1_.get()));
|
| - EXPECT_CALL(
|
| - *device1_,
|
| - ClearOutOfBandPairingData(testing::_, testing::Truly(CallErrorClosure)));
|
| + EXPECT_CALL(*device1_,
|
| + ClearOutOfBandPairingData(testing::_,
|
| + testing::Truly(CallClosure)));
|
|
|
| set_oob_function = setupFunction(
|
| new api::BluetoothSetOutOfBandPairingDataFunction);
|
| @@ -569,17 +562,11 @@
|
| scoped_refptr<device::MockBluetoothSocket> socket =
|
| new device::MockBluetoothSocket();
|
|
|
| - EXPECT_CALL(*mock_adapter_, GetDevice(device1_->GetAddress()))
|
| - .WillOnce(testing::Return(device1_.get()));
|
| -
|
| event_router()->AddProfile(
|
| - BluetoothUUID("1234"), extension->id(), profile1_.get());
|
| - bluetooth_api()->DispatchConnectionEvent(
|
| + BluetoothUUID("1234"),
|
| + extension->id(), profile1_.get());
|
| + event_router()->DispatchConnectionEvent(
|
| extension->id(), BluetoothUUID("1234"), device1_.get(), socket);
|
| - // Connection events are dispatched using a couple of PostTask to the UI
|
| - // thread. Waiting until idle ensures the event is dispatched to the
|
| - // receiver(s).
|
| - base::RunLoop().RunUntilIdle();
|
|
|
| listener.Reply("go");
|
| EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
|
|
|