Index: device/bluetooth/bluetooth_chromeos_unittest.cc |
diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc |
index fbdfbb1e0fbfbaf5b1a2101b0ce3757ae79ec6a5..4143b1abee87bb6375cdddebc55b5196f0a4fb05 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,7 +2187,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(); |
@@ -2190,9 +2199,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()); |
@@ -2223,12 +2232,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); |
@@ -2258,12 +2267,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); |
@@ -2291,7 +2300,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(); |
@@ -2316,7 +2325,7 @@ TEST_F(BluetoothChromeOSTest, ForgetUnpairedDevice) { |
DiscoverDevices(); |
BluetoothDevice* device = adapter_->GetDevice( |
- FakeBluetoothDeviceClient::kConnectUnpairableAddress); |
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress); |
ASSERT_TRUE(device != nullptr); |
ASSERT_FALSE(device->IsPaired()); |
@@ -2333,9 +2342,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 |
@@ -2346,12 +2355,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); |
} |
@@ -2359,7 +2368,7 @@ TEST_F(BluetoothChromeOSTest, ConnectPairedDevice) { |
GetAdapter(); |
BluetoothDevice* device = adapter_->GetDevice( |
- FakeBluetoothDeviceClient::kPairedDeviceAddress); |
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); |
ASSERT_TRUE(device != nullptr); |
ASSERT_TRUE(device->IsPaired()); |
@@ -2388,7 +2397,7 @@ TEST_F(BluetoothChromeOSTest, ConnectUnpairableDevice) { |
DiscoverDevices(); |
BluetoothDevice* device = adapter_->GetDevice( |
- FakeBluetoothDeviceClient::kConnectUnpairableAddress); |
+ bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress); |
ASSERT_TRUE(device != nullptr); |
ASSERT_FALSE(device->IsPaired()); |
@@ -2412,9 +2421,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. |
@@ -2428,7 +2437,7 @@ TEST_F(BluetoothChromeOSTest, ConnectConnectedDevice) { |
GetAdapter(); |
BluetoothDevice* device = adapter_->GetDevice( |
- FakeBluetoothDeviceClient::kPairedDeviceAddress); |
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); |
ASSERT_TRUE(device != nullptr); |
ASSERT_TRUE(device->IsPaired()); |
@@ -2466,7 +2475,7 @@ TEST_F(BluetoothChromeOSTest, ConnectDeviceFails) { |
DiscoverDevices(); |
BluetoothDevice* device = adapter_->GetDevice( |
- FakeBluetoothDeviceClient::kLegacyAutopairAddress); |
+ bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress); |
ASSERT_TRUE(device != nullptr); |
ASSERT_FALSE(device->IsPaired()); |
@@ -2492,7 +2501,7 @@ TEST_F(BluetoothChromeOSTest, DisconnectDevice) { |
GetAdapter(); |
BluetoothDevice* device = adapter_->GetDevice( |
- FakeBluetoothDeviceClient::kPairedDeviceAddress); |
+ bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress); |
ASSERT_TRUE(device != nullptr); |
ASSERT_TRUE(device->IsPaired()); |
@@ -2526,7 +2535,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()); |
@@ -2554,7 +2563,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()); |
@@ -2591,9 +2600,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()); |
} |
@@ -2605,7 +2614,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()); |
@@ -2644,9 +2653,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()); |
} |
@@ -2659,7 +2668,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()); |
@@ -2719,9 +2728,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()); |
} |
@@ -2733,7 +2742,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()); |
@@ -2773,9 +2782,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()); |
} |
@@ -2787,7 +2796,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()); |
@@ -2824,9 +2833,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()); |
} |
@@ -2839,7 +2848,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()); |
@@ -2875,9 +2884,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()); |
} |
@@ -2889,8 +2898,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()); |
@@ -2922,9 +2931,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()); |
} |
@@ -2932,10 +2941,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()); |
@@ -2966,11 +2975,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()); |
@@ -3006,7 +3015,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()); |
@@ -3038,10 +3047,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()); |
} |
@@ -3053,7 +3061,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()); |
@@ -3091,7 +3099,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()); |
@@ -3129,7 +3137,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()); |
@@ -3167,7 +3175,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()); |
@@ -3205,7 +3213,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()); |
@@ -3243,7 +3251,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()); |
@@ -3281,7 +3289,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()); |
@@ -3322,19 +3330,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_); |
@@ -3353,9 +3361,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. |
@@ -3376,19 +3384,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_); |
@@ -3408,9 +3416,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. |
@@ -3431,19 +3439,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_); |
@@ -3462,9 +3470,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. |
@@ -3486,17 +3494,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))); |
@@ -3517,9 +3525,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. |
@@ -3536,19 +3544,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(); |
@@ -3575,19 +3583,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(); |
@@ -3614,19 +3622,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(); |
@@ -3653,17 +3661,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))); |
@@ -3696,19 +3704,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_); |
@@ -3740,10 +3748,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); |
@@ -3791,8 +3799,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. |
@@ -3807,8 +3815,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, |
@@ -3853,8 +3861,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()); |
@@ -3931,7 +3940,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, |
@@ -3951,7 +3960,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(); |
@@ -4008,7 +4018,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, |
@@ -4043,8 +4053,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); |