| Index: chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
|
| diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
|
| index cf419c1f565cbbf216f185a2648246df112a202a..922abe1edd945aa14e894e8e09904dbd1fefd7b8 100644
|
| --- a/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
|
| +++ b/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
|
| @@ -4,21 +4,23 @@
|
|
|
| #include <string.h>
|
|
|
| -#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
|
| -#include "chrome/browser/chromeos/bluetooth/test/mock_bluetooth_adapter.h"
|
| -#include "chrome/browser/chromeos/bluetooth/test/mock_bluetooth_device.h"
|
| -#include "chrome/browser/chromeos/extensions/bluetooth_event_router.h"
|
| #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h"
|
| +#include "chrome/browser/extensions/bluetooth_event_router.h"
|
| #include "chrome/browser/extensions/extension_apitest.h"
|
| #include "chrome/browser/extensions/extension_function_test_utils.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| #include "chrome/browser/extensions/extension_test_message_listener.h"
|
| #include "chrome/browser/ui/browser.h"
|
| -#include "chromeos/dbus/bluetooth_out_of_band_client.h"
|
| -#include "chromeos/dbus/bluetooth_out_of_band_pairing_data.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| +#include "device/bluetooth/bluetooth_adapter.h"
|
| +#include "device/bluetooth/bluetooth_out_of_band_pairing_data.h"
|
| +#include "device/bluetooth/test/mock_bluetooth_adapter.h"
|
| +#include "device/bluetooth/test/mock_bluetooth_device.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
|
|
| +using bluetooth::BluetoothAdapter;
|
| +using bluetooth::BluetoothDevice;
|
| +using bluetooth::BluetoothOutOfBandPairingData;
|
| using extensions::Extension;
|
|
|
| namespace utils = extension_function_test_utils;
|
| @@ -35,14 +37,15 @@ class BluetoothApiTest : public PlatformAppApiTest {
|
|
|
| virtual void SetUpOnMainThread() OVERRIDE {
|
| // The browser will clean this up when it is torn down
|
| - mock_adapter_ = new testing::StrictMock<chromeos::MockBluetoothAdapter>(
|
| - kAdapterAddress, kName);
|
| + mock_adapter_ =
|
| + new testing::StrictMock<bluetooth::MockBluetoothAdapter>(
|
| + kAdapterAddress, kName);
|
| event_router()->SetAdapterForTest(mock_adapter_);
|
|
|
| - device1_.reset(new testing::NiceMock<chromeos::MockBluetoothDevice>(
|
| + device1_.reset(new testing::NiceMock<bluetooth::MockBluetoothDevice>(
|
| mock_adapter_, "d1", "11:12:13:14:15:16",
|
| true /* paired */, false /* bonded */, true /* connected */));
|
| - device2_.reset(new testing::NiceMock<chromeos::MockBluetoothDevice>(
|
| + device2_.reset(new testing::NiceMock<bluetooth::MockBluetoothDevice>(
|
| mock_adapter_, "d2", "21:22:23:24:25:26",
|
| false /* paired */, true /* bonded */, false /* connected */));
|
| }
|
| @@ -81,11 +84,11 @@ class BluetoothApiTest : public PlatformAppApiTest {
|
| }
|
|
|
| protected:
|
| - testing::StrictMock<chromeos::MockBluetoothAdapter>* mock_adapter_;
|
| - scoped_ptr<testing::NiceMock<chromeos::MockBluetoothDevice> > device1_;
|
| - scoped_ptr<testing::NiceMock<chromeos::MockBluetoothDevice> > device2_;
|
| + testing::StrictMock<bluetooth::MockBluetoothAdapter>* mock_adapter_;
|
| + scoped_ptr<testing::NiceMock<bluetooth::MockBluetoothDevice> > device1_;
|
| + scoped_ptr<testing::NiceMock<bluetooth::MockBluetoothDevice> > device2_;
|
|
|
| - chromeos::ExtensionBluetoothEventRouter* event_router() {
|
| + extensions::ExtensionBluetoothEventRouter* event_router() {
|
| return browser()->profile()->GetExtensionService()->
|
| bluetooth_event_router();
|
| }
|
| @@ -98,12 +101,12 @@ class BluetoothApiTest : public PlatformAppApiTest {
|
| static const char kOutOfBandPairingDataHash[] = "0123456789ABCDEh";
|
| static const char kOutOfBandPairingDataRandomizer[] = "0123456789ABCDEr";
|
|
|
| -static chromeos::BluetoothOutOfBandPairingData GetOutOfBandPairingData() {
|
| - chromeos::BluetoothOutOfBandPairingData data;
|
| +static BluetoothOutOfBandPairingData GetOutOfBandPairingData() {
|
| + BluetoothOutOfBandPairingData data;
|
| memcpy(&(data.hash), kOutOfBandPairingDataHash,
|
| - chromeos::kBluetoothOutOfBandPairingDataSize);
|
| + bluetooth::kBluetoothOutOfBandPairingDataSize);
|
| memcpy(&(data.randomizer), kOutOfBandPairingDataRandomizer,
|
| - chromeos::kBluetoothOutOfBandPairingDataSize);
|
| + bluetooth::kBluetoothOutOfBandPairingDataSize);
|
| return data;
|
| }
|
|
|
| @@ -113,16 +116,15 @@ static bool CallClosure(const base::Closure& callback) {
|
| }
|
|
|
| static void CallOutOfBandPairingDataCallback(
|
| - const chromeos::BluetoothAdapter::BluetoothOutOfBandPairingDataCallback&
|
| - callback,
|
| - const chromeos::BluetoothAdapter::ErrorCallback& error_callback) {
|
| + const BluetoothAdapter::BluetoothOutOfBandPairingDataCallback& callback,
|
| + const bluetooth::BluetoothAdapter::ErrorCallback& error_callback) {
|
| callback.Run(GetOutOfBandPairingData());
|
| }
|
|
|
| template <bool Value>
|
| static void CallProvidesServiceCallback(
|
| - const std::string& name,
|
| - const chromeos::BluetoothDevice::ProvidesServiceCallback& callback) {
|
| + const std::string& name,
|
| + const BluetoothDevice::ProvidesServiceCallback& callback) {
|
| callback.Run(Value);
|
| }
|
|
|
| @@ -385,7 +387,7 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetDevices) {
|
| ResultCatcher catcher;
|
| catcher.RestrictToProfile(browser()->profile());
|
|
|
| - chromeos::BluetoothAdapter::ConstDeviceList devices;
|
| + bluetooth::BluetoothAdapter::ConstDeviceList devices;
|
| devices.push_back(device1_.get());
|
| devices.push_back(device2_.get());
|
|
|
| @@ -420,12 +422,12 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetDevicesConcurrently) {
|
| ResultCatcher catcher;
|
| catcher.RestrictToProfile(browser()->profile());
|
|
|
| - chromeos::BluetoothAdapter::ConstDeviceList devices;
|
| + bluetooth::BluetoothAdapter::ConstDeviceList devices;
|
| devices.push_back(device1_.get());
|
|
|
| // Save the callback to delay execution so that we can force the calls to
|
| // happen concurrently. This will be called after the listener is satisfied.
|
| - chromeos::BluetoothDevice::ProvidesServiceCallback callback;
|
| + BluetoothDevice::ProvidesServiceCallback callback;
|
| EXPECT_CALL(*device1_, ProvidesServiceWithName(testing::_, testing::_))
|
| .WillOnce(testing::SaveArg<1>(&callback));
|
|
|
|
|