Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1398)

Unified Diff: device/bluetooth/bluetooth_chromeos_unittest.cc

Issue 1347193004: Refactor DBusThreadManager to split away BT clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_chromeos_unittest.cc
diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc
index 079cce6fc78d94e398fc16cd4a7d37e41e9e97e3..cd17a9ab0c7f9ab343dfa409fde2b1d9110fc669 100644
--- a/device/bluetooth/bluetooth_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_chromeos_unittest.cc
@@ -6,12 +6,6 @@
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.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_gatt_service_client.h"
-#include "chromeos/dbus/fake_bluetooth_input_client.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
@@ -20,6 +14,12 @@
#include "device/bluetooth/bluetooth_device_chromeos.h"
#include "device/bluetooth/bluetooth_discovery_session.h"
#include "device/bluetooth/bluetooth_pairing_chromeos.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_gatt_service_client.h"
+#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
#include "device/bluetooth/test/test_bluetooth_adapter_observer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -45,17 +45,18 @@ void SaveConnectionInfo(BluetoothDevice::ConnectionInfo* out,
};
class FakeBluetoothProfileServiceProviderDelegate
- : public chromeos::BluetoothProfileServiceProvider::Delegate {
+ : public bluez::BluetoothProfileServiceProvider::Delegate {
public:
FakeBluetoothProfileServiceProviderDelegate() {}
- // BluetoothProfileServiceProvider::Delegate:
+ // bluez::BluetoothProfileServiceProvider::Delegate:
void Released() override {}
- void NewConnection(const dbus::ObjectPath&,
- scoped_ptr<dbus::FileDescriptor>,
- const BluetoothProfileServiceProvider::Delegate::Options&,
- const ConfirmationCallback&) override {}
+ void NewConnection(
+ const dbus::ObjectPath&,
+ scoped_ptr<dbus::FileDescriptor>,
+ const bluez::BluetoothProfileServiceProvider::Delegate::Options&,
+ const ConfirmationCallback&) override {}
void RequestDisconnection(const dbus::ObjectPath&,
const ConfirmationCallback&) override {}
@@ -153,25 +154,28 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate {
class BluetoothChromeOSTest : public testing::Test {
public:
void SetUp() override {
- scoped_ptr<DBusThreadManagerSetter> dbus_setter =
- chromeos::DBusThreadManager::GetSetterForTesting();
- // We need to initialize DBusThreadManager early to prevent
+ scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
+ bluez::BluezDBusManager::GetSetterForTesting();
+ // We need to initialize BluezDBusManager early to prevent
// Bluetooth*::Create() methods from picking the real instead of fake
// implementations.
- fake_bluetooth_adapter_client_ = new FakeBluetoothAdapterClient;
+ fake_bluetooth_adapter_client_ = new bluez::FakeBluetoothAdapterClient;
dbus_setter->SetBluetoothAdapterClient(
- scoped_ptr<BluetoothAdapterClient>(fake_bluetooth_adapter_client_));
- fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient;
+ scoped_ptr<bluez::BluetoothAdapterClient>(
+ fake_bluetooth_adapter_client_));
+ fake_bluetooth_device_client_ = new bluez::FakeBluetoothDeviceClient;
dbus_setter->SetBluetoothDeviceClient(
- scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_));
+ scoped_ptr<bluez::BluetoothDeviceClient>(
+ fake_bluetooth_device_client_));
dbus_setter->SetBluetoothInputClient(
- scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
+ scoped_ptr<bluez::BluetoothInputClient>(
+ new bluez::FakeBluetoothInputClient));
dbus_setter->SetBluetoothAgentManagerClient(
- scoped_ptr<BluetoothAgentManagerClient>(
- new FakeBluetoothAgentManagerClient));
+ scoped_ptr<bluez::BluetoothAgentManagerClient>(
+ new bluez::FakeBluetoothAgentManagerClient));
dbus_setter->SetBluetoothGattServiceClient(
- scoped_ptr<BluetoothGattServiceClient>(
- new FakeBluetoothGattServiceClient));
+ scoped_ptr<bluez::BluetoothGattServiceClient>(
+ new bluez::FakeBluetoothGattServiceClient));
fake_bluetooth_adapter_client_->SetSimulationIntervalMs(10);
@@ -196,7 +200,7 @@ class BluetoothChromeOSTest : public testing::Test {
}
discovery_sessions_.clear();
adapter_ = nullptr;
- DBusThreadManager::Shutdown();
+ bluez::BluezDBusManager::Shutdown();
}
// Generic callbacks
@@ -325,8 +329,8 @@ class BluetoothChromeOSTest : public testing::Test {
protected:
base::MessageLoop message_loop_;
- FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_;
- FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
+ bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_;
+ bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
scoped_refptr<BluetoothAdapter> adapter_;
int callback_count_;
@@ -354,16 +358,16 @@ TEST_F(BluetoothChromeOSTest, AlreadyPresent) {
// and initializes with an existing adapter if there is one.
EXPECT_TRUE(adapter_->IsPresent());
EXPECT_FALSE(adapter_->IsPowered());
- EXPECT_EQ(FakeBluetoothAdapterClient::kAdapterAddress,
+ EXPECT_EQ(bluez::FakeBluetoothAdapterClient::kAdapterAddress,
adapter_->GetAddress());
EXPECT_FALSE(adapter_->IsDiscovering());
// There should be a device
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
EXPECT_EQ(2U, devices.size());
- EXPECT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
- EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
devices[1]->GetAddress());
}
@@ -385,7 +389,7 @@ TEST_F(BluetoothChromeOSTest, BecomePresent) {
// We should have had a device announced.
EXPECT_EQ(2, observer.device_added_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
observer.last_device_address());
// Other callbacks shouldn't be called if the values are false.
@@ -412,7 +416,7 @@ TEST_F(BluetoothChromeOSTest, BecomeNotPresent) {
// We should have had a device removed.
EXPECT_EQ(2, observer.device_removed_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
observer.last_device_address());
// Other callbacks shouldn't be called since the values are false.
@@ -435,7 +439,7 @@ TEST_F(BluetoothChromeOSTest, SecondAdapter) {
EXPECT_EQ(0, observer.present_changed_count());
EXPECT_TRUE(adapter_->IsPresent());
- EXPECT_EQ(FakeBluetoothAdapterClient::kAdapterAddress,
+ EXPECT_EQ(bluez::FakeBluetoothAdapterClient::kAdapterAddress,
adapter_->GetAddress());
// Try removing the first adapter, we should now act as if the adapter
@@ -449,7 +453,7 @@ TEST_F(BluetoothChromeOSTest, SecondAdapter) {
// We should have had a device removed.
EXPECT_EQ(2, observer.device_removed_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
observer.last_device_address());
// Other callbacks shouldn't be called since the values are false.
@@ -720,7 +724,7 @@ TEST_F(BluetoothChromeOSTest, Discovery) {
message_loop_.Run();
EXPECT_EQ(2, observer.device_added_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kLowEnergyAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress,
observer.last_device_address());
// Next we should get another two devices...
@@ -732,7 +736,7 @@ TEST_F(BluetoothChromeOSTest, Discovery) {
message_loop_.Run();
EXPECT_EQ(1, observer.device_removed_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kVanishingDeviceAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress,
observer.last_device_address());
}
@@ -752,7 +756,7 @@ TEST_F(BluetoothChromeOSTest, PoweredAndDiscovering) {
// Stop the timers that the simulation uses
fake_bluetooth_device_client_->EndDiscoverySimulation(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
ASSERT_TRUE(adapter_->IsPowered());
ASSERT_TRUE(adapter_->IsDiscovering());
@@ -946,21 +950,23 @@ TEST_F(BluetoothChromeOSTest,
// Stop the timers that the simulation uses
fake_bluetooth_device_client_->EndDiscoverySimulation(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
ASSERT_TRUE(adapter_->IsPowered());
ASSERT_TRUE(adapter_->IsDiscovering());
// Stop device discovery behind the adapter. The adapter and the observer
// should be notified of the change and the reference count should be reset.
- // Even though FakeBluetoothAdapterClient does its own reference counting and
+ // Even though bluez::FakeBluetoothAdapterClient does its own reference
+ // counting and
// we called 3 BluetoothAdapter::StartDiscoverySession 3 times, the
- // FakeBluetoothAdapterClient's count should be only 1 and a single call to
- // FakeBluetoothAdapterClient::StopDiscovery should work.
+ // bluez::FakeBluetoothAdapterClient's count should be only 1 and a single
+ // call to
+ // bluez::FakeBluetoothAdapterClient::StopDiscovery should work.
fake_bluetooth_adapter_client_->StopDiscovery(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), GetCallback(),
- base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(2, observer.discovering_changed_count());
EXPECT_EQ(4, callback_count_);
@@ -993,7 +999,7 @@ TEST_F(BluetoothChromeOSTest,
EXPECT_TRUE(discovery_sessions_[i]->IsActive());
fake_bluetooth_device_client_->EndDiscoverySimulation(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
// Make the adapter disappear and appear. This will make it come back as
// discovering. When this happens, the reference count should become and
@@ -1018,7 +1024,8 @@ TEST_F(BluetoothChromeOSTest,
EXPECT_TRUE(observer.last_discovering());
EXPECT_TRUE(adapter_->IsDiscovering());
- // Start and stop discovery. At this point, FakeBluetoothAdapterClient has
+ // Start and stop discovery. At this point, bluez::FakeBluetoothAdapterClient
+ // has
// a reference count that is equal to 1. Pretend that this was done by an
// application other than us. Starting and stopping discovery will succeed
// but it won't cause the discovery state to change.
@@ -1063,9 +1070,9 @@ TEST_F(BluetoothChromeOSTest,
// the discovery state won't change since our BluetoothAdapter also just
// requested it via D-Bus.
fake_bluetooth_adapter_client_->StopDiscovery(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), GetCallback(),
- base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(5, observer.discovering_changed_count());
EXPECT_EQ(10, callback_count_);
@@ -1124,7 +1131,7 @@ TEST_F(BluetoothChromeOSTest, InvalidatedDiscoverySessions) {
// Stop the timers that the simulation uses
fake_bluetooth_device_client_->EndDiscoverySimulation(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
ASSERT_TRUE(adapter_->IsPowered());
ASSERT_TRUE(adapter_->IsDiscovering());
@@ -1141,9 +1148,9 @@ TEST_F(BluetoothChromeOSTest, InvalidatedDiscoverySessions) {
// memory errors as the sessions that we explicitly deleted should get
// cleaned up.
fake_bluetooth_adapter_client_->StopDiscovery(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), GetCallback(),
- base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
EXPECT_EQ(2, observer.discovering_changed_count());
EXPECT_EQ(4, callback_count_);
@@ -1176,7 +1183,7 @@ TEST_F(BluetoothChromeOSTest, QueuedDiscoveryRequests) {
EXPECT_EQ(0, callback_count_);
fake_bluetooth_device_client_->EndDiscoverySimulation(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
// The underlying adapter has started discovery, but our call hasn't returned
// yet.
@@ -2092,12 +2099,13 @@ TEST_F(BluetoothChromeOSTest, DeviceProperties) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
// Verify the other device properties.
- EXPECT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName),
- devices[0]->GetName());
+ EXPECT_EQ(
+ base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
+ devices[0]->GetName());
EXPECT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[0]->GetDeviceType());
EXPECT_TRUE(devices[0]->IsPaired());
EXPECT_FALSE(devices[0]->IsConnected());
@@ -2124,7 +2132,7 @@ TEST_F(BluetoothChromeOSTest, DeviceClassChanged) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
ASSERT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[0]->GetDeviceType());
@@ -2132,9 +2140,9 @@ TEST_F(BluetoothChromeOSTest, DeviceClassChanged) {
// we change the class of the device.
TestBluetoothAdapterObserver observer(adapter_);
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
properties->bluetooth_class.ReplaceValue(0x002580);
@@ -2150,18 +2158,19 @@ TEST_F(BluetoothChromeOSTest, DeviceNameChanged) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
- ASSERT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName),
- devices[0]->GetName());
+ ASSERT_EQ(
+ base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
+ devices[0]->GetName());
// Install an observer; expect the DeviceChanged method to be called when
// we change the alias of the device.
TestBluetoothAdapterObserver observer(adapter_);
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
static const std::string new_name("New Device Name");
properties->alias.ReplaceValue(new_name);
@@ -2178,18 +2187,19 @@ TEST_F(BluetoothChromeOSTest, DeviceAddressChanged) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
- ASSERT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName),
- devices[0]->GetName());
+ ASSERT_EQ(
+ base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
+ devices[0]->GetName());
// Install an observer; expect the DeviceAddressChanged method to be called
// when we change the alias of the device.
TestBluetoothAdapterObserver observer(adapter_);
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
static const char* kNewAddress = "D9:1F:FC:11:22:33";
properties->address.ReplaceValue(kNewAddress);
@@ -2207,7 +2217,7 @@ TEST_F(BluetoothChromeOSTest, DeviceUuidsChanged) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
BluetoothDevice::UUIDList uuids = devices[0]->GetUUIDs();
@@ -2219,9 +2229,9 @@ TEST_F(BluetoothChromeOSTest, DeviceUuidsChanged) {
// we change the class of the device.
TestBluetoothAdapterObserver observer(adapter_);
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
std::vector<std::string> new_uuids;
new_uuids.push_back(uuids[0].canonical_value());
@@ -2252,12 +2262,12 @@ TEST_F(BluetoothChromeOSTest, DeviceInquiryRSSIInvalidated) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
// During discovery, rssi is a valid value (-75)
properties->rssi.ReplaceValue(-75);
@@ -2287,12 +2297,12 @@ TEST_F(BluetoothChromeOSTest, DeviceInquiryTxPowerInvalidated) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
// During discovery, tx_power is a valid value (0)
properties->tx_power.ReplaceValue(0);
@@ -2320,7 +2330,7 @@ TEST_F(BluetoothChromeOSTest, ForgetDevice) {
BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
ASSERT_EQ(2U, devices.size());
- ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
+ ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
devices[0]->GetAddress());
std::string address = devices[0]->GetAddress();
@@ -2345,7 +2355,7 @@ TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) {
DiscoverDevices();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConnectUnpairableAddress);
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2362,9 +2372,9 @@ TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) {
ASSERT_FALSE(device->IsConnecting());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConnectUnpairablePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairablePath));
ASSERT_TRUE(properties->trusted.value());
// Install an observer; expect the DeviceRemoved method to be called
@@ -2375,12 +2385,12 @@ TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) {
EXPECT_EQ(0, error_callback_count_);
EXPECT_EQ(1, observer.device_removed_count());
- EXPECT_EQ(FakeBluetoothDeviceClient::kConnectUnpairableAddress,
+ EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress,
observer.last_device_address());
// GetDevices shouldn't return the device either.
device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConnectUnpairableAddress);
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress);
EXPECT_FALSE(device != nullptr);
}
@@ -2388,7 +2398,7 @@ TEST_F(BluetoothChromeOSTest, ConnectPairedDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_TRUE(device->IsPaired());
@@ -2417,7 +2427,7 @@ TEST_F(BluetoothChromeOSTest, ConnectUnpairableDevice) {
DiscoverDevices();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConnectUnpairableAddress);
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2441,9 +2451,9 @@ TEST_F(BluetoothChromeOSTest, ConnectUnpairableDevice) {
EXPECT_FALSE(device->IsConnecting());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConnectUnpairablePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairablePath));
EXPECT_TRUE(properties->trusted.value());
// Verify is a HID device and is not connectable.
@@ -2457,7 +2467,7 @@ TEST_F(BluetoothChromeOSTest, ConnectConnectedDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_TRUE(device->IsPaired());
@@ -2495,7 +2505,7 @@ TEST_F(BluetoothChromeOSTest, ConnectDeviceFails) {
DiscoverDevices();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLegacyAutopairAddress);
+ bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2521,7 +2531,7 @@ TEST_F(BluetoothChromeOSTest, DisconnectDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_TRUE(device->IsPaired());
@@ -2555,7 +2565,7 @@ TEST_F(BluetoothChromeOSTest, DisconnectUnconnectedDevice) {
GetAdapter();
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_TRUE(device->IsPaired());
ASSERT_FALSE(device->IsConnected());
@@ -2583,7 +2593,7 @@ TEST_F(BluetoothChromeOSTest, PairLegacyAutopair) {
// The Legacy Autopair device requires no PIN or Passkey to pair because
// the daemon provides 0000 to the device for us.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLegacyAutopairAddress);
+ bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2620,9 +2630,9 @@ TEST_F(BluetoothChromeOSTest, PairLegacyAutopair) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kLegacyAutopairPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2634,7 +2644,7 @@ TEST_F(BluetoothChromeOSTest, PairDisplayPinCode) {
// Requires that we display a randomly generated PIN on the screen.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kDisplayPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kDisplayPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2673,9 +2683,9 @@ TEST_F(BluetoothChromeOSTest, PairDisplayPinCode) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPinCodePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2688,7 +2698,7 @@ TEST_F(BluetoothChromeOSTest, PairDisplayPasskey) {
// Requires that we display a randomly generated Passkey on the screen,
// and notifies us as it's typed in.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kDisplayPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kDisplayPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2748,9 +2758,9 @@ TEST_F(BluetoothChromeOSTest, PairDisplayPasskey) {
EXPECT_FALSE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPasskeyPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kDisplayPasskeyPath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2762,7 +2772,7 @@ TEST_F(BluetoothChromeOSTest, PairRequestPinCode) {
// Requires that the user enters a PIN for them.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2802,9 +2812,9 @@ TEST_F(BluetoothChromeOSTest, PairRequestPinCode) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2816,7 +2826,7 @@ TEST_F(BluetoothChromeOSTest, PairConfirmPasskey) {
// Requests that we confirm a displayed passkey.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2853,9 +2863,9 @@ TEST_F(BluetoothChromeOSTest, PairConfirmPasskey) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2868,7 +2878,7 @@ TEST_F(BluetoothChromeOSTest, PairRequestPasskey) {
// Requires that the user enters a Passkey, this would be some kind of
// device that has a display, but doesn't use "just works" - maybe a car?
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2904,9 +2914,9 @@ TEST_F(BluetoothChromeOSTest, PairRequestPasskey) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2918,8 +2928,8 @@ TEST_F(BluetoothChromeOSTest, PairJustWorks) {
// Uses just-works pairing, since this is an outgoing pairing, no delegate
// interaction is required.
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kJustWorksAddress);
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2951,9 +2961,9 @@ TEST_F(BluetoothChromeOSTest, PairJustWorks) {
EXPECT_TRUE(device->IsConnectable());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -2961,10 +2971,10 @@ TEST_F(BluetoothChromeOSTest, PairUnpairableDeviceFails) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
- DiscoverDevice(FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
+ DiscoverDevice(bluez::FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kUnpairableDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kUnpairableDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -2995,11 +3005,11 @@ TEST_F(BluetoothChromeOSTest, PairingFails) {
fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
GetAdapter();
- DiscoverDevice(FakeBluetoothDeviceClient::kVanishingDeviceAddress);
+ DiscoverDevice(bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress);
// The vanishing device times out during pairing
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kVanishingDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3035,7 +3045,7 @@ TEST_F(BluetoothChromeOSTest, PairingFailsAtConnection) {
// Everything seems to go according to plan with the unconnectable device;
// it pairs, but then you can't make connections to it after.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3067,10 +3077,9 @@ TEST_F(BluetoothChromeOSTest, PairingFailsAtConnection) {
// Make sure the trusted property has been set to true still (since pairing
// worked).
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(
- FakeBluetoothDeviceClient::kUnconnectableDevicePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kUnconnectableDevicePath));
EXPECT_TRUE(properties->trusted.value());
}
@@ -3082,7 +3091,7 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtPinCode) {
// Reject the pairing after we receive a request for the PIN code.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3120,7 +3129,7 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtPinCode) {
// Cancel the pairing after we receive a request for the PIN code.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3158,7 +3167,7 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtPasskey) {
// Reject the pairing after we receive a request for the passkey.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3196,7 +3205,7 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtPasskey) {
// Cancel the pairing after we receive a request for the passkey.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3234,7 +3243,7 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtConfirmation) {
// Reject the pairing after we receive a request for passkey confirmation.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3272,7 +3281,7 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtConfirmation) {
// Cancel the pairing after we receive a request for the passkey.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3310,7 +3319,7 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledInFlight) {
// Cancel the pairing while we're waiting for the remote host.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kLegacyAutopairAddress);
+ bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
@@ -3351,19 +3360,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPinCode) {
// Requires that we provide a PIN code.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
EXPECT_EQ(1, pairing_delegate.request_pincode_count_);
@@ -3382,9 +3391,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPinCode) {
EXPECT_TRUE(device->IsPaired());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
@@ -3405,19 +3414,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairConfirmPasskey) {
// Requests that we confirm a displayed passkey.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
EXPECT_EQ(1, pairing_delegate.confirm_passkey_count_);
@@ -3437,9 +3446,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairConfirmPasskey) {
EXPECT_TRUE(device->IsPaired());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
@@ -3460,19 +3469,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPasskey) {
// Requests that we provide a Passkey.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
EXPECT_EQ(1, pairing_delegate.request_passkey_count_);
@@ -3491,9 +3500,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPasskey) {
EXPECT_TRUE(device->IsPaired());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
@@ -3515,17 +3524,17 @@ TEST_F(BluetoothChromeOSTest, IncomingPairJustWorks) {
// Uses just-works pairing so, sinec this an incoming pairing, require
// authorization from the user.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kJustWorksAddress);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath), true,
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath), true,
GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
@@ -3546,9 +3555,9 @@ TEST_F(BluetoothChromeOSTest, IncomingPairJustWorks) {
EXPECT_TRUE(device->IsPaired());
// Make sure the trusted property has been set to true.
- FakeBluetoothDeviceClient::Properties* properties =
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
ASSERT_TRUE(properties->trusted.value());
// No pairing context should remain on the device.
@@ -3565,19 +3574,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPinCodeWithoutDelegate) {
// Requires that we provide a PIN Code, without a pairing delegate,
// that will be rejected.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -3604,19 +3613,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairConfirmPasskeyWithoutDelegate) {
// Requests that we confirm a displayed passkey, without a pairing delegate,
// that will be rejected.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -3643,19 +3652,19 @@ TEST_F(BluetoothChromeOSTest, IncomingPairRequestPasskeyWithoutDelegate) {
// Requests that we provide a displayed passkey, without a pairing delegate,
// that will be rejected.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
message_loop_.Run();
@@ -3682,17 +3691,17 @@ TEST_F(BluetoothChromeOSTest, IncomingPairJustWorksWithoutDelegate) {
// Uses just-works pairing and thus requires authorization for incoming
// pairings, without a pairing delegate, that will be rejected.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
- BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kJustWorksAddress);
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
+ BluetoothDevice* device =
+ adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath), true,
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath), true,
GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
base::Unretained(this)));
@@ -3725,19 +3734,19 @@ TEST_F(BluetoothChromeOSTest, RemovePairingDelegateDuringPairing) {
// Requests that we provide a Passkey.
fake_bluetooth_device_client_->CreateDevice(
- dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+ dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+ bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
ASSERT_TRUE(device != nullptr);
ASSERT_FALSE(device->IsPaired());
TestBluetoothAdapterObserver observer(adapter_);
fake_bluetooth_device_client_->SimulatePairing(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath), true,
- GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
- base::Unretained(this)));
+ dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
+ true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+ base::Unretained(this)));
EXPECT_EQ(1, pairing_delegate.call_count_);
EXPECT_EQ(1, pairing_delegate.request_passkey_count_);
@@ -3769,10 +3778,10 @@ TEST_F(BluetoothChromeOSTest, DeviceId) {
// Use the built-in paired device for this test, grab its Properties
// structure so we can adjust the underlying modalias property.
BluetoothDevice* device = adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress);
- FakeBluetoothDeviceClient::Properties* properties =
- fake_bluetooth_device_client_->GetProperties(
- dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ bluez::FakeBluetoothDeviceClient::Properties* properties =
+ fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+ bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
ASSERT_TRUE(device != nullptr);
ASSERT_TRUE(properties != nullptr);
@@ -3820,8 +3829,8 @@ TEST_F(BluetoothChromeOSTest, DeviceId) {
TEST_F(BluetoothChromeOSTest, GetConnectionInfoForDisconnectedDevice) {
GetAdapter();
- BluetoothDevice* device =
- adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ BluetoothDevice* device = adapter_->GetDevice(
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
// Calling GetConnectionInfo for an unconnected device should return a result
// in which all fields are filled with BluetoothDevice::kUnknownPower.
@@ -3836,8 +3845,8 @@ TEST_F(BluetoothChromeOSTest, GetConnectionInfoForDisconnectedDevice) {
TEST_F(BluetoothChromeOSTest, GetConnectionInfoForConnectedDevice) {
GetAdapter();
- BluetoothDevice* device =
- adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
+ BluetoothDevice* device = adapter_->GetDevice(
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
device->Connect(nullptr, GetCallback(),
base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
@@ -3882,8 +3891,9 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
EXPECT_TRUE(adapter_->IsDiscoverable());
EXPECT_TRUE(adapter_->IsDiscovering());
EXPECT_EQ(2U, adapter_->GetDevices().size());
- EXPECT_NE(nullptr, adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress));
+ EXPECT_NE(nullptr,
+ adapter_->GetDevice(
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress));
EXPECT_NE(dbus::ObjectPath(""), static_cast<BluetoothAdapterChromeOS*>(
adapter_.get())->object_path());
@@ -3960,7 +3970,7 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
FakeBluetoothProfileServiceProviderDelegate profile_delegate;
adapter_chrome_os->UseProfile(
BluetoothUUID(), dbus::ObjectPath(""),
- BluetoothProfileManagerClient::Options(), &profile_delegate,
+ bluez::BluetoothProfileManagerClient::Options(), &profile_delegate,
base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback,
base::Unretained(this)),
base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
@@ -3980,7 +3990,8 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
adapter_chrome_os->DeviceRemoved(dbus::ObjectPath(""));
adapter_chrome_os->DevicePropertyChanged(dbus::ObjectPath(""), "");
adapter_chrome_os->InputPropertyChanged(dbus::ObjectPath(""), "");
- // BluetoothAgentServiceProvider::Delegate omitted, dbus will be shutdown,
+ // bluez::BluetoothAgentServiceProvider::Delegate omitted, dbus will be
+ // shutdown,
// with the exception of Released.
adapter_chrome_os->Released();
@@ -4037,7 +4048,7 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
// UseProfile to be set first, do so again here just before calling them.
adapter_chrome_os->UseProfile(
BluetoothUUID(), dbus::ObjectPath(""),
- BluetoothProfileManagerClient::Options(), &profile_delegate,
+ bluez::BluetoothProfileManagerClient::Options(), &profile_delegate,
base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback,
base::Unretained(this)),
base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
@@ -4072,8 +4083,9 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
EXPECT_EQ(1, error_callback_count_--) << "StartDiscoverySession error";
EXPECT_EQ(0U, adapter_->GetDevices().size());
- EXPECT_EQ(nullptr, adapter_->GetDevice(
- FakeBluetoothDeviceClient::kPairedDeviceAddress));
+ EXPECT_EQ(nullptr,
+ adapter_->GetDevice(
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress));
TestPairingDelegate pairing_delegate2;
adapter_->AddPairingDelegate(
&pairing_delegate2, BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
« no previous file with comments | « device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc ('k') | device/bluetooth/bluetooth_device_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698