diff options
author | rkc <rkc@chromium.org> | 2016-03-09 13:38:56 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-09 21:40:08 +0000 |
commit | a69b2e6ecb2e136c8eca57176233460a334e20da (patch) | |
tree | 6945f16ecffbe27cbb85777a9dda95837c7e4c84 /device | |
parent | e27ff645c0bfb460855b825f08beda583d71a8e5 (diff) | |
download | chromium_src-a69b2e6ecb2e136c8eca57176233460a334e20da.zip chromium_src-a69b2e6ecb2e136c8eca57176233460a334e20da.tar.gz chromium_src-a69b2e6ecb2e136c8eca57176233460a334e20da.tar.bz2 |
Review comments from https://codereview.chromium.org/1415573014/
R=ortuno@chromium.org
BUG=None
Review URL: https://codereview.chromium.org/1472223002
Cr-Commit-Position: refs/heads/master@{#380229}
Diffstat (limited to 'device')
9 files changed, 74 insertions, 78 deletions
diff --git a/device/bluetooth/bluetooth_adapter_bluez.h b/device/bluetooth/bluetooth_adapter_bluez.h index 4f847a5..3d402d4 100644 --- a/device/bluetooth/bluetooth_adapter_bluez.h +++ b/device/bluetooth/bluetooth_adapter_bluez.h @@ -46,8 +46,8 @@ class BluetoothRemoteGattCharacteristicBlueZ; class BluetoothRemoteGattDescriptorBlueZ; class BluetoothRemoteGattServiceBlueZ; -// The BluetoothAdapterBlueZ class implements BluetoothAdapter for the -// Chrome OS platform. +// The BluetoothAdapterBlueZ class implements BluetoothAdapter for platforms +// that use BlueZ. // // All methods are called from the dbus origin / UI thread and are generally // not assumed to be thread-safe. diff --git a/device/bluetooth/bluetooth_advertisement_bluez.h b/device/bluetooth/bluetooth_advertisement_bluez.h index bde8cc8..f72b245 100644 --- a/device/bluetooth/bluetooth_advertisement_bluez.h +++ b/device/bluetooth/bluetooth_advertisement_bluez.h @@ -20,7 +20,7 @@ namespace bluez { class BluetoothAdapterBlueZ; // The BluetoothAdvertisementBlueZ class implements BluetoothAdvertisement -// for the Chrome OS platform. +// for platforms that use BlueZ. class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementBlueZ : public device::BluetoothAdvertisement, public bluez::BluetoothLEAdvertisementServiceProvider::Delegate { diff --git a/device/bluetooth/bluetooth_bluez_unittest.cc b/device/bluetooth/bluetooth_bluez_unittest.cc index f2823dd..5186bdc 100644 --- a/device/bluetooth/bluetooth_bluez_unittest.cc +++ b/device/bluetooth/bluetooth_bluez_unittest.cc @@ -4164,10 +4164,9 @@ TEST_F(BluetoothBlueZTest, Shutdown) { EXPECT_EQ(0, callback_count_); EXPECT_EQ(1, error_callback_count_--) << "RegisterAudioSink error"; - BluetoothAdapterBlueZ* adapter_chrome_os = + BluetoothAdapterBlueZ* adapter_bluez = static_cast<BluetoothAdapterBlueZ*>(adapter_.get()); - EXPECT_EQ(nullptr, - adapter_chrome_os->GetDeviceWithPath(dbus::ObjectPath(""))); + EXPECT_EQ(nullptr, adapter_bluez->GetDeviceWithPath(dbus::ObjectPath(""))); // Notify methods presume objects exist that are owned by the adapter and // destroyed in Shutdown(). Mocks are not attempted here that won't exist, @@ -4184,12 +4183,12 @@ TEST_F(BluetoothBlueZTest, Shutdown) { // NotifyGattCharacteristicValueChanged // NotifyGattDescriptorValueChanged - EXPECT_EQ(dbus::ObjectPath(""), adapter_chrome_os->object_path()); + EXPECT_EQ(dbus::ObjectPath(""), adapter_bluez->object_path()); adapter_profile_ = nullptr; FakeBluetoothProfileServiceProviderDelegate profile_delegate; - adapter_chrome_os->UseProfile( + adapter_bluez->UseProfile( BluetoothUUID(), dbus::ObjectPath(""), bluez::BluetoothProfileManagerClient::Options(), &profile_delegate, base::Bind(&BluetoothBlueZTest::ProfileRegisteredCallback, @@ -4203,25 +4202,25 @@ TEST_F(BluetoothBlueZTest, Shutdown) { // Protected and private methods: - adapter_chrome_os->RemovePairingDelegateInternal(&pairing_delegate); + adapter_bluez->RemovePairingDelegateInternal(&pairing_delegate); // AdapterAdded() invalid post Shutdown because it calls SetAdapter. - adapter_chrome_os->AdapterRemoved(dbus::ObjectPath("x")); - adapter_chrome_os->AdapterPropertyChanged(dbus::ObjectPath("x"), ""); - adapter_chrome_os->DeviceAdded(dbus::ObjectPath("")); - adapter_chrome_os->DeviceRemoved(dbus::ObjectPath("")); - adapter_chrome_os->DevicePropertyChanged(dbus::ObjectPath(""), ""); - adapter_chrome_os->InputPropertyChanged(dbus::ObjectPath(""), ""); + adapter_bluez->AdapterRemoved(dbus::ObjectPath("x")); + adapter_bluez->AdapterPropertyChanged(dbus::ObjectPath("x"), ""); + adapter_bluez->DeviceAdded(dbus::ObjectPath("")); + adapter_bluez->DeviceRemoved(dbus::ObjectPath("")); + adapter_bluez->DevicePropertyChanged(dbus::ObjectPath(""), ""); + adapter_bluez->InputPropertyChanged(dbus::ObjectPath(""), ""); // bluez::BluetoothAgentServiceProvider::Delegate omitted, dbus will be // shutdown, // with the exception of Released. - adapter_chrome_os->Released(); + adapter_bluez->Released(); - adapter_chrome_os->OnRegisterAgent(); - adapter_chrome_os->OnRegisterAgentError("", ""); - adapter_chrome_os->OnRequestDefaultAgent(); - adapter_chrome_os->OnRequestDefaultAgentError("", ""); + adapter_bluez->OnRegisterAgent(); + adapter_bluez->OnRegisterAgentError("", ""); + adapter_bluez->OnRequestDefaultAgent(); + adapter_bluez->OnRequestDefaultAgentError("", ""); - adapter_chrome_os->OnRegisterAudioSink( + adapter_bluez->OnRegisterAudioSink( base::Bind(&BluetoothBlueZTest::AudioSinkAcquiredCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::AudioSinkErrorCallback, @@ -4234,27 +4233,27 @@ TEST_F(BluetoothBlueZTest, Shutdown) { // SetAdapter will DCHECK after Shutdown(). // SetDefaultAdapterName will DCHECK after Shutdown(). // RemoveAdapter will DCHECK after Shutdown(). - adapter_chrome_os->PoweredChanged(false); - adapter_chrome_os->DiscoverableChanged(false); - adapter_chrome_os->DiscoveringChanged(false); - adapter_chrome_os->PresentChanged(false); + adapter_bluez->PoweredChanged(false); + adapter_bluez->DiscoverableChanged(false); + adapter_bluez->DiscoveringChanged(false); + adapter_bluez->PresentChanged(false); - adapter_chrome_os->OnSetDiscoverable(GetCallback(), GetErrorCallback(), true); + adapter_bluez->OnSetDiscoverable(GetCallback(), GetErrorCallback(), true); EXPECT_EQ(0, callback_count_) << "OnSetDiscoverable error"; EXPECT_EQ(1, error_callback_count_--) << "OnSetDiscoverable error"; - adapter_chrome_os->OnPropertyChangeCompleted(GetCallback(), - GetErrorCallback(), true); + adapter_bluez->OnPropertyChangeCompleted(GetCallback(), GetErrorCallback(), + true); EXPECT_EQ(0, callback_count_) << "OnPropertyChangeCompleted error"; EXPECT_EQ(1, error_callback_count_--) << "OnPropertyChangeCompleted error"; - adapter_chrome_os->AddDiscoverySession(nullptr, GetCallback(), - GetDiscoveryErrorCallback()); + adapter_bluez->AddDiscoverySession(nullptr, GetCallback(), + GetDiscoveryErrorCallback()); EXPECT_EQ(0, callback_count_) << "AddDiscoverySession error"; EXPECT_EQ(1, error_callback_count_--) << "AddDiscoverySession error"; - adapter_chrome_os->RemoveDiscoverySession(nullptr, GetCallback(), - GetDiscoveryErrorCallback()); + adapter_bluez->RemoveDiscoverySession(nullptr, GetCallback(), + GetDiscoveryErrorCallback()); EXPECT_EQ(0, callback_count_) << "RemoveDiscoverySession error"; EXPECT_EQ(1, error_callback_count_--) << "RemoveDiscoverySession error"; @@ -4267,7 +4266,7 @@ TEST_F(BluetoothBlueZTest, Shutdown) { // OnRegisterProfile SetProfileDelegate, OnRegisterProfileError, require // UseProfile to be set first, do so again here just before calling them. - adapter_chrome_os->UseProfile( + adapter_bluez->UseProfile( BluetoothUUID(), dbus::ObjectPath(""), bluez::BluetoothProfileManagerClient::Options(), &profile_delegate, base::Bind(&BluetoothBlueZTest::ProfileRegisteredCallback, @@ -4279,7 +4278,7 @@ TEST_F(BluetoothBlueZTest, Shutdown) { EXPECT_EQ(0, callback_count_) << "UseProfile error"; EXPECT_EQ(1, error_callback_count_--) << "UseProfile error"; - adapter_chrome_os->SetProfileDelegate( + adapter_bluez->SetProfileDelegate( BluetoothUUID(), dbus::ObjectPath(""), &profile_delegate, base::Bind(&BluetoothBlueZTest::ProfileRegisteredCallback, base::Unretained(this)), @@ -4288,11 +4287,11 @@ TEST_F(BluetoothBlueZTest, Shutdown) { EXPECT_EQ(0, callback_count_) << "SetProfileDelegate error"; EXPECT_EQ(1, error_callback_count_--) << "SetProfileDelegate error"; - adapter_chrome_os->OnRegisterProfileError(BluetoothUUID(), "", ""); + adapter_bluez->OnRegisterProfileError(BluetoothUUID(), "", ""); EXPECT_EQ(0, callback_count_) << "OnRegisterProfileError error"; EXPECT_EQ(0, error_callback_count_) << "OnRegisterProfileError error"; - adapter_chrome_os->ProcessQueuedDiscoveryRequests(); + adapter_bluez->ProcessQueuedDiscoveryRequests(); // From BluetoothAdapater: @@ -4317,16 +4316,15 @@ TEST_F(BluetoothBlueZTest, Shutdown) { TEST_F(BluetoothBlueZTest, Shutdown_OnStartDiscovery) { const int kNumberOfDiscoverySessions = 10; GetAdapter(); - BluetoothAdapterBlueZ* adapter_chrome_os = + BluetoothAdapterBlueZ* adapter_bluez = static_cast<BluetoothAdapterBlueZ*>(adapter_.get()); for (int i = 0; i < kNumberOfDiscoverySessions; i++) { - adapter_chrome_os->AddDiscoverySession(nullptr, GetCallback(), - GetDiscoveryErrorCallback()); + adapter_bluez->AddDiscoverySession(nullptr, GetCallback(), + GetDiscoveryErrorCallback()); } adapter_->Shutdown(); - adapter_chrome_os->OnStartDiscovery(GetCallback(), - GetDiscoveryErrorCallback()); + adapter_bluez->OnStartDiscovery(GetCallback(), GetDiscoveryErrorCallback()); EXPECT_EQ(0, callback_count_); EXPECT_EQ(kNumberOfDiscoverySessions, error_callback_count_); @@ -4336,16 +4334,16 @@ TEST_F(BluetoothBlueZTest, Shutdown_OnStartDiscovery) { TEST_F(BluetoothBlueZTest, Shutdown_OnStartDiscoveryError) { const int kNumberOfDiscoverySessions = 10; GetAdapter(); - BluetoothAdapterBlueZ* adapter_chrome_os = + BluetoothAdapterBlueZ* adapter_bluez = static_cast<BluetoothAdapterBlueZ*>(adapter_.get()); for (int i = 0; i < kNumberOfDiscoverySessions; i++) { - adapter_chrome_os->AddDiscoverySession(nullptr, GetCallback(), - GetDiscoveryErrorCallback()); + adapter_bluez->AddDiscoverySession(nullptr, GetCallback(), + GetDiscoveryErrorCallback()); } adapter_->Shutdown(); - adapter_chrome_os->OnStartDiscoveryError(GetCallback(), - GetDiscoveryErrorCallback(), "", ""); + adapter_bluez->OnStartDiscoveryError(GetCallback(), + GetDiscoveryErrorCallback(), "", ""); EXPECT_EQ(0, callback_count_); EXPECT_EQ(kNumberOfDiscoverySessions, error_callback_count_); @@ -4355,26 +4353,25 @@ TEST_F(BluetoothBlueZTest, Shutdown_OnStartDiscoveryError) { TEST_F(BluetoothBlueZTest, Shutdown_OnStopDiscovery) { const int kNumberOfDiscoverySessions = 10; GetAdapter(); - BluetoothAdapterBlueZ* adapter_chrome_os = + BluetoothAdapterBlueZ* adapter_bluez = static_cast<BluetoothAdapterBlueZ*>(adapter_.get()); // In order to queue up discovery sessions before an OnStopDiscovery call // RemoveDiscoverySession must be called, so Add, Start, and Remove: - adapter_chrome_os->AddDiscoverySession(nullptr, GetCallback(), - GetDiscoveryErrorCallback()); - adapter_chrome_os->OnStartDiscovery(GetCallback(), - GetDiscoveryErrorCallback()); - adapter_chrome_os->RemoveDiscoverySession(nullptr, GetCallback(), - GetDiscoveryErrorCallback()); + adapter_bluez->AddDiscoverySession(nullptr, GetCallback(), + GetDiscoveryErrorCallback()); + adapter_bluez->OnStartDiscovery(GetCallback(), GetDiscoveryErrorCallback()); + adapter_bluez->RemoveDiscoverySession(nullptr, GetCallback(), + GetDiscoveryErrorCallback()); callback_count_ = 0; error_callback_count_ = 0; // Can now queue discovery sessions while waiting for OnStopDiscovery. for (int i = 0; i < kNumberOfDiscoverySessions; i++) { - adapter_chrome_os->AddDiscoverySession(nullptr, GetCallback(), - GetDiscoveryErrorCallback()); + adapter_bluez->AddDiscoverySession(nullptr, GetCallback(), + GetDiscoveryErrorCallback()); } adapter_->Shutdown(); - adapter_chrome_os->OnStopDiscovery(GetCallback()); + adapter_bluez->OnStopDiscovery(GetCallback()); // 1 successful stopped discovery from RemoveDiscoverySession, and // kNumberOfDiscoverySessions errors from AddDiscoverySession/OnStopDiscovery. @@ -4386,26 +4383,25 @@ TEST_F(BluetoothBlueZTest, Shutdown_OnStopDiscovery) { TEST_F(BluetoothBlueZTest, Shutdown_OnStopDiscoveryError) { const int kNumberOfDiscoverySessions = 10; GetAdapter(); - BluetoothAdapterBlueZ* adapter_chrome_os = + BluetoothAdapterBlueZ* adapter_bluez = static_cast<BluetoothAdapterBlueZ*>(adapter_.get()); // In order to queue up discovery sessions before an OnStopDiscoveryError call // RemoveDiscoverySession must be called, so Add, Start, and Remove: - adapter_chrome_os->AddDiscoverySession(nullptr, GetCallback(), - GetDiscoveryErrorCallback()); - adapter_chrome_os->OnStartDiscovery(GetCallback(), - GetDiscoveryErrorCallback()); - adapter_chrome_os->RemoveDiscoverySession(nullptr, GetCallback(), - GetDiscoveryErrorCallback()); + adapter_bluez->AddDiscoverySession(nullptr, GetCallback(), + GetDiscoveryErrorCallback()); + adapter_bluez->OnStartDiscovery(GetCallback(), GetDiscoveryErrorCallback()); + adapter_bluez->RemoveDiscoverySession(nullptr, GetCallback(), + GetDiscoveryErrorCallback()); callback_count_ = 0; error_callback_count_ = 0; // Can now queue discovery sessions while waiting for OnStopDiscoveryError. for (int i = 0; i < kNumberOfDiscoverySessions; i++) { - adapter_chrome_os->AddDiscoverySession(nullptr, GetCallback(), - GetDiscoveryErrorCallback()); + adapter_bluez->AddDiscoverySession(nullptr, GetCallback(), + GetDiscoveryErrorCallback()); } adapter_->Shutdown(); - adapter_chrome_os->OnStopDiscoveryError(GetDiscoveryErrorCallback(), "", ""); + adapter_bluez->OnStopDiscoveryError(GetDiscoveryErrorCallback(), "", ""); // 1 error reported to RemoveDiscoverySession because of OnStopDiscoveryError, // and kNumberOfDiscoverySessions errors queued with AddDiscoverySession. diff --git a/device/bluetooth/bluetooth_gatt_connection_bluez.h b/device/bluetooth/bluetooth_gatt_connection_bluez.h index e9bee29..1ea0a32 100644 --- a/device/bluetooth/bluetooth_gatt_connection_bluez.h +++ b/device/bluetooth/bluetooth_gatt_connection_bluez.h @@ -22,8 +22,8 @@ class BluetoothAdapter; namespace bluez { -// BluetoothGattConnectionBlueZ implements BluetoothGattConnection for the -// Chrome OS platform. +// BluetoothGattConnectionBlueZ implements BluetoothGattConnection for +// platforms that use BlueZ. class BluetoothGattConnectionBlueZ : public device::BluetoothGattConnection, public bluez::BluetoothDeviceClient::Observer { diff --git a/device/bluetooth/bluetooth_gatt_notify_session_bluez.h b/device/bluetooth/bluetooth_gatt_notify_session_bluez.h index 4c99d47..88336d8 100644 --- a/device/bluetooth/bluetooth_gatt_notify_session_bluez.h +++ b/device/bluetooth/bluetooth_gatt_notify_session_bluez.h @@ -23,7 +23,7 @@ namespace bluez { class BluetoothRemoteGattCharacteristicBlueZ; // BluetoothGattNotifySessionBlueZ implements -// BluetoothGattNotifySession for the Chrome OS platform. +// BluetoothGattNotifySession for platforms that use BlueZ. class BluetoothGattNotifySessionBlueZ : public device::BluetoothGattNotifySession, public bluez::BluetoothGattCharacteristicClient::Observer { diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h index 9976975..e46ddf9 100644 --- a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h +++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h @@ -34,8 +34,8 @@ class BluetoothRemoteGattDescriptorBlueZ; class BluetoothRemoteGattServiceBlueZ; // The BluetoothRemoteGattCharacteristicBlueZ class implements -// BluetoothGattCharacteristic for remote GATT characteristics on the Chrome OS -// platform. +// BluetoothGattCharacteristic for remote GATT characteristics for platforms +// that use BlueZ. class BluetoothRemoteGattCharacteristicBlueZ : public device::BluetoothGattCharacteristic, public bluez::BluetoothGattDescriptorClient::Observer { @@ -134,7 +134,7 @@ class BluetoothRemoteGattCharacteristicBlueZ bool notify_call_pending_; // Mapping from GATT descriptor object paths to descriptor objects owned by - // this characteristic. Since the Chrome OS implementation uses object paths + // this characteristic. Since the BlueZ implementation uses object paths // as unique identifiers, we also use this mapping to return descriptors by // identifier. typedef std::map<dbus::ObjectPath, BluetoothRemoteGattDescriptorBlueZ*> diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h b/device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h index 9af0913..fab4f7c 100644 --- a/device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h +++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h @@ -27,8 +27,8 @@ namespace bluez { class BluetoothRemoteGattCharacteristicBlueZ; // The BluetoothRemoteGattDescriptorBlueZ class implements -// BluetoothGattDescriptor for remote GATT characteristic descriptors on the -// Chrome OS platform. +// BluetoothGattDescriptor for remote GATT characteristic descriptors for +// platforms that use BlueZ. class BluetoothRemoteGattDescriptorBlueZ : public device::BluetoothGattDescriptor { public: diff --git a/device/bluetooth/bluetooth_remote_gatt_service_bluez.h b/device/bluetooth/bluetooth_remote_gatt_service_bluez.h index 483db24..20aaffa 100644 --- a/device/bluetooth/bluetooth_remote_gatt_service_bluez.h +++ b/device/bluetooth/bluetooth_remote_gatt_service_bluez.h @@ -36,7 +36,7 @@ class BluetoothRemoteGattCharacteristicBlueZ; class BluetoothRemoteGattDescriptorBlueZ; // The BluetoothRemoteGattServiceBlueZ class implements BluetootGattService -// for remote GATT services on the Chrome OS platform. +// for remote GATT services for platforms that use BlueZ. class BluetoothRemoteGattServiceBlueZ : public device::BluetoothGattService, public bluez::BluetoothGattServiceClient::Observer, @@ -130,7 +130,7 @@ class BluetoothRemoteGattServiceBlueZ BluetoothDeviceBlueZ* device_; // Mapping from GATT characteristic object paths to characteristic objects. - // owned by this service. Since the Chrome OS implementation uses object + // owned by this service. Since the BlueZ implementation uses object // paths as unique identifiers, we also use this mapping to return // characteristics by identifier. CharacteristicMap characteristics_; diff --git a/device/bluetooth/bluetooth_socket_bluez.h b/device/bluetooth/bluetooth_socket_bluez.h index b1870ab..a1b2a51 100644 --- a/device/bluetooth/bluetooth_socket_bluez.h +++ b/device/bluetooth/bluetooth_socket_bluez.h @@ -30,8 +30,8 @@ class BluetoothDeviceBlueZ; class BluetoothAdapterBlueZ; class BluetoothAdapterProfileBlueZ; -// The BluetoothSocketBlueZ class implements BluetoothSocket for the -// Chrome OS platform. +// The BluetoothSocketBlueZ class implements BluetoothSocket for platforms that +// use BlueZ. // // This class is not thread-safe, but is only called from the UI thread. class DEVICE_BLUETOOTH_EXPORT BluetoothSocketBlueZ |