| Index: device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
|
| diff --git a/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc b/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
|
| index 1b9c0b32a683977bbe13ac69526a9a2e0b5c64b7..be99901964e9f6fa3ab67f06e118588db8699920 100644
|
| --- a/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
|
| +++ b/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
|
| @@ -4,17 +4,17 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/message_loop/message_loop.h"
|
| -#include "chromeos/dbus/bluetooth_profile_service_provider.h"
|
| -#include "chromeos/dbus/dbus_thread_manager.h"
|
| -#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
|
| -#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
|
| -#include "chromeos/dbus/fake_bluetooth_device_client.h"
|
| -#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
|
| #include "device/bluetooth/bluetooth_adapter.h"
|
| #include "device/bluetooth/bluetooth_adapter_chromeos.h"
|
| #include "device/bluetooth/bluetooth_adapter_factory.h"
|
| #include "device/bluetooth/bluetooth_adapter_profile_chromeos.h"
|
| #include "device/bluetooth/bluetooth_uuid.h"
|
| +#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
|
| +#include "device/bluetooth/dbus/bluez_dbus_manager.h"
|
| +#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
|
| +#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
|
| +#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
|
| +#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| using device::BluetoothAdapter;
|
| @@ -27,25 +27,29 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test {
|
| BluetoothAdapterProfileChromeOSTest()
|
| : success_callback_count_(0),
|
| error_callback_count_(0),
|
| - fake_delegate_paired_(FakeBluetoothDeviceClient::kPairedDevicePath),
|
| - fake_delegate_autopair_(FakeBluetoothDeviceClient::kLegacyAutopairPath),
|
| + fake_delegate_paired_(
|
| + bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
|
| + fake_delegate_autopair_(
|
| + bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath),
|
| fake_delegate_listen_(""),
|
| profile_user_ptr_(nullptr) {}
|
|
|
| void SetUp() override {
|
| - scoped_ptr<DBusThreadManagerSetter> dbus_setter =
|
| - DBusThreadManager::GetSetterForTesting();
|
| + scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
|
| + bluez::BluezDBusManager::GetSetterForTesting();
|
|
|
| dbus_setter->SetBluetoothAdapterClient(
|
| - scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
|
| + scoped_ptr<bluez::BluetoothAdapterClient>(
|
| + new bluez::FakeBluetoothAdapterClient));
|
| dbus_setter->SetBluetoothAgentManagerClient(
|
| - scoped_ptr<BluetoothAgentManagerClient>(
|
| - new FakeBluetoothAgentManagerClient));
|
| + scoped_ptr<bluez::BluetoothAgentManagerClient>(
|
| + new bluez::FakeBluetoothAgentManagerClient));
|
| dbus_setter->SetBluetoothDeviceClient(
|
| - scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient));
|
| + scoped_ptr<bluez::BluetoothDeviceClient>(
|
| + new bluez::FakeBluetoothDeviceClient));
|
| dbus_setter->SetBluetoothProfileManagerClient(
|
| - scoped_ptr<BluetoothProfileManagerClient>(
|
| - new FakeBluetoothProfileManagerClient));
|
| + scoped_ptr<bluez::BluetoothProfileManagerClient>(
|
| + new bluez::FakeBluetoothProfileManagerClient));
|
|
|
| // Grab a pointer to the adapter.
|
| device::BluetoothAdapterFactory::GetAdapter(
|
| @@ -64,21 +68,20 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test {
|
| void TearDown() override {
|
| profile_.reset();
|
| adapter_ = nullptr;
|
| - DBusThreadManager::Shutdown();
|
| + bluez::BluezDBusManager::Shutdown();
|
| }
|
|
|
| void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) {
|
| adapter_ = adapter;
|
| }
|
|
|
| - class FakeDelegate
|
| - : public chromeos::BluetoothProfileServiceProvider::Delegate {
|
| + class FakeDelegate : public bluez::BluetoothProfileServiceProvider::Delegate {
|
| public:
|
| FakeDelegate(const std::string& device_path) : connections_(0) {
|
| device_path_ = dbus::ObjectPath(device_path);
|
| }
|
|
|
| - // BluetoothProfileServiceProvider::Delegate:
|
| + // bluez::BluetoothProfileServiceProvider::Delegate:
|
| void Released() override {
|
| // noop
|
| }
|
| @@ -86,7 +89,8 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test {
|
| void NewConnection(
|
| const dbus::ObjectPath& device_path,
|
| scoped_ptr<dbus::FileDescriptor> fd,
|
| - const BluetoothProfileServiceProvider::Delegate::Options& options,
|
| + const bluez::BluetoothProfileServiceProvider::Delegate::Options&
|
| + options,
|
| const ConfirmationCallback& callback) override {
|
| ++connections_;
|
| fd->CheckValidity();
|
| @@ -157,8 +161,8 @@ class BluetoothAdapterProfileChromeOSTest : public testing::Test {
|
| };
|
|
|
| TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) {
|
| - BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
|
| - BluetoothProfileManagerClient::Options options;
|
| + BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
|
| + bluez::BluetoothProfileManagerClient::Options options;
|
|
|
| options.require_authentication.reset(new bool(false));
|
|
|
| @@ -194,8 +198,8 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) {
|
| }
|
|
|
| TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) {
|
| - BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
|
| - BluetoothProfileManagerClient::Options options;
|
| + BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
|
| + bluez::BluetoothProfileManagerClient::Options options;
|
|
|
| options.require_authentication.reset(new bool(false));
|
|
|
| @@ -212,9 +216,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) {
|
| EXPECT_EQ(1U, success_callback_count_);
|
| EXPECT_EQ(0U, error_callback_count_);
|
|
|
| - DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
|
| - dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath),
|
| - FakeBluetoothProfileManagerClient::kRfcommUuid,
|
| + bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
|
| + dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
|
| + bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
|
| base::Bind(
|
| &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
|
| base::Unretained(this)),
|
| @@ -230,8 +234,8 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) {
|
| }
|
|
|
| TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
|
| - BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
|
| - BluetoothProfileManagerClient::Options options;
|
| + BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
|
| + bluez::BluetoothProfileManagerClient::Options options;
|
|
|
| options.require_authentication.reset(new bool(false));
|
|
|
| @@ -255,9 +259,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
|
| profile_->SetDelegate(fake_delegate_listen_.device_path_,
|
| &fake_delegate_listen_);
|
|
|
| - DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
|
| - dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath),
|
| - FakeBluetoothProfileManagerClient::kRfcommUuid,
|
| + bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
|
| + dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
|
| + bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
|
| base::Bind(
|
| &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
|
| base::Unretained(this)),
|
| @@ -271,9 +275,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
|
|
|
| EXPECT_EQ(1U, fake_delegate_paired_.connections_);
|
|
|
| - DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
|
| - dbus::ObjectPath(FakeBluetoothDeviceClient::kLegacyAutopairPath),
|
| - FakeBluetoothProfileManagerClient::kRfcommUuid,
|
| + bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
|
| + dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath),
|
| + bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
|
| base::Bind(
|
| &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
|
| base::Unretained(this)),
|
| @@ -288,9 +292,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
|
| EXPECT_EQ(1U, fake_delegate_autopair_.connections_);
|
|
|
| // Incoming connections look the same from BlueZ.
|
| - DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
|
| - dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPinCodePath),
|
| - FakeBluetoothProfileManagerClient::kRfcommUuid,
|
| + bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
|
| + dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath),
|
| + bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
|
| base::Bind(
|
| &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
|
| base::Unretained(this)),
|
| @@ -306,8 +310,8 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
|
| }
|
|
|
| TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegister) {
|
| - BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
|
| - BluetoothProfileManagerClient::Options options;
|
| + BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
|
| + bluez::BluetoothProfileManagerClient::Options options;
|
| BluetoothAdapterChromeOS* adapter =
|
| static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
|
|
|
| @@ -347,8 +351,9 @@ TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegister) {
|
| }
|
|
|
| TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegisterFail) {
|
| - BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kUnregisterableUuid);
|
| - BluetoothProfileManagerClient::Options options;
|
| + BluetoothUUID uuid(
|
| + bluez::FakeBluetoothProfileManagerClient::kUnregisterableUuid);
|
| + bluez::BluetoothProfileManagerClient::Options options;
|
| BluetoothAdapterChromeOS* adapter =
|
| static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
|
|
|
|
|