Chromium Code Reviews| 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..dba2423924bfb040d6fc5b44c174fb4bc078381a 100644 |
| --- a/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc |
| +++ b/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc |
| @@ -4,21 +4,25 @@ |
| #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 bluetooth::MockBluetoothAdapter; |
| +using bluetooth::MockBluetoothDevice; |
| using extensions::Extension; |
| namespace utils = extension_function_test_utils; |
| @@ -35,14 +39,14 @@ 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<MockBluetoothAdapter>(kAdapterAddress, kName); |
|
bryeung
2012/10/11 15:15:39
why the wrapping change?
youngki
2012/10/11 16:21:18
Done.
|
| event_router()->SetAdapterForTest(mock_adapter_); |
| - device1_.reset(new testing::NiceMock<chromeos::MockBluetoothDevice>( |
| + device1_.reset(new testing::NiceMock<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<MockBluetoothDevice>( |
| mock_adapter_, "d2", "21:22:23:24:25:26", |
| false /* paired */, true /* bonded */, false /* connected */)); |
| } |
| @@ -81,11 +85,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<MockBluetoothAdapter>* mock_adapter_; |
| + scoped_ptr<testing::NiceMock<MockBluetoothDevice> > device1_; |
| + scoped_ptr<testing::NiceMock<MockBluetoothDevice> > device2_; |
| - chromeos::ExtensionBluetoothEventRouter* event_router() { |
| + extensions::ExtensionBluetoothEventRouter* event_router() { |
| return browser()->profile()->GetExtensionService()-> |
| bluetooth_event_router(); |
| } |
| @@ -98,12 +102,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 +117,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 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); |
| } |
| @@ -308,7 +311,7 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, DiscoveryCallback) { |
| catcher.RestrictToProfile(browser()->profile()); |
| ExtensionTestMessageListener discovery_started("ready", true); |
| - const extensions::Extension* extension = |
| + const Extension* extension = |
| LoadExtension(test_data_dir_.AppendASCII("bluetooth")); |
| GURL page_url = extension->GetResourceURL("test_discovery.html"); |
| ui_test_utils::NavigateToURL(browser(), page_url); |
| @@ -338,7 +341,7 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, DiscoveryInProgress) { |
| catcher.RestrictToProfile(browser()->profile()); |
| ExtensionTestMessageListener discovery_started("ready", true); |
| - const extensions::Extension* extension = |
| + const Extension* extension = |
| LoadExtension(test_data_dir_.AppendASCII("bluetooth")); |
| GURL page_url = extension->GetResourceURL("test_discovery_in_progress.html"); |
| ui_test_utils::NavigateToURL(browser(), page_url); |
| @@ -363,7 +366,7 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, Events) { |
| // Load and wait for setup |
| ExtensionTestMessageListener listener("ready", true); |
| - const extensions::Extension* extension = |
| + const Extension* extension = |
| LoadExtension(test_data_dir_.AppendASCII("bluetooth")); |
| GURL page_url = extension->GetResourceURL("test_events.html"); |
| ui_test_utils::NavigateToURL(browser(), page_url); |
| @@ -385,7 +388,7 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetDevices) { |
| ResultCatcher catcher; |
| catcher.RestrictToProfile(browser()->profile()); |
| - chromeos::BluetoothAdapter::ConstDeviceList devices; |
| + BluetoothAdapter::ConstDeviceList devices; |
| devices.push_back(device1_.get()); |
| devices.push_back(device2_.get()); |
| @@ -405,7 +408,7 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetDevices) { |
| // Load and wait for setup |
| ExtensionTestMessageListener listener("ready", true); |
| - const extensions::Extension* extension = |
| + const Extension* extension = |
| LoadExtension(test_data_dir_.AppendASCII("bluetooth")); |
| GURL page_url = extension->GetResourceURL("test_getdevices.html"); |
| ui_test_utils::NavigateToURL(browser(), page_url); |
| @@ -420,12 +423,12 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetDevicesConcurrently) { |
| ResultCatcher catcher; |
| catcher.RestrictToProfile(browser()->profile()); |
| - chromeos::BluetoothAdapter::ConstDeviceList devices; |
| + 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)); |
| @@ -434,7 +437,7 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetDevicesConcurrently) { |
| // Load and wait for setup |
| ExtensionTestMessageListener listener("ready", true); |
| - const extensions::Extension* extension = |
| + const Extension* extension = |
| LoadExtension(test_data_dir_.AppendASCII("bluetooth")); |
| GURL page_url = |
| extension->GetResourceURL("test_getdevices_concurrently.html"); |