diff options
-rw-r--r-- | chromeos/dbus/bluetooth_adapter_client.cc | 1 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_adapter_client.cc | 4 | ||||
-rw-r--r-- | chromeos/dbus/fake_bluetooth_device_client.cc | 40 | ||||
-rw-r--r-- | dbus/property.h | 10 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_experimental_chromeos_unittest.cc | 3 |
5 files changed, 29 insertions, 29 deletions
diff --git a/chromeos/dbus/bluetooth_adapter_client.cc b/chromeos/dbus/bluetooth_adapter_client.cc index 354255d..56675e8 100644 --- a/chromeos/dbus/bluetooth_adapter_client.cc +++ b/chromeos/dbus/bluetooth_adapter_client.cc @@ -762,7 +762,6 @@ class BluetoothAdapterClientStubImpl : public BluetoothAdapterClient { VLOG(1) << "Set " << property->name(); if (property->name() == "Powered") { property->ReplaceValueWithSetValue(); - NotifyPropertyChanged(property->name()); callback.Run(true); } else { callback.Run(false); diff --git a/chromeos/dbus/fake_bluetooth_adapter_client.cc b/chromeos/dbus/fake_bluetooth_adapter_client.cc index 4d248c2..9209f9d 100644 --- a/chromeos/dbus/fake_bluetooth_adapter_client.cc +++ b/chromeos/dbus/fake_bluetooth_adapter_client.cc @@ -65,7 +65,6 @@ void FakeBluetoothAdapterClient::Properties::Set( if (property->name() == powered.name() || property->name() == alias.name()) { callback.Run(true); property->ReplaceValueWithSetValue(); - NotifyPropertyChanged(property->name()); } else { callback.Run(false); } @@ -141,7 +140,6 @@ void FakeBluetoothAdapterClient::StartDiscovery( if (discovering_count_ == 1) { properties_->discovering.ReplaceValue(true); - properties_->NotifyPropertyChanged(properties_->discovering.name()); FakeBluetoothDeviceClient* device_client = static_cast<FakeBluetoothDeviceClient*>( @@ -177,7 +175,6 @@ void FakeBluetoothAdapterClient::StopDiscovery( device_client->EndDiscoverySimulation(dbus::ObjectPath(kAdapterPath)); properties_->discovering.ReplaceValue(false); - properties_->NotifyPropertyChanged(properties_->discovering.name()); } } @@ -246,7 +243,6 @@ void FakeBluetoothAdapterClient::OnPropertyChanged( if (discovering_count_) { discovering_count_ = 0; properties_->discovering.ReplaceValue(false); - properties_->NotifyPropertyChanged(properties_->discovering.name()); } } diff --git a/chromeos/dbus/fake_bluetooth_device_client.cc b/chromeos/dbus/fake_bluetooth_device_client.cc index 54d39d5..f8e4702 100644 --- a/chromeos/dbus/fake_bluetooth_device_client.cc +++ b/chromeos/dbus/fake_bluetooth_device_client.cc @@ -133,7 +133,6 @@ void FakeBluetoothDeviceClient::Properties::Set( if (property->name() == trusted.name()) { callback.Run(true); property->ReplaceValueWithSetValue(); - NotifyPropertyChanged(property->name()); } else { callback.Run(false); } @@ -224,11 +223,9 @@ void FakeBluetoothDeviceClient::Connect( // The device can be connected. properties->connected.ReplaceValue(true); + callback.Run(); AddInputDeviceIfNeeded(object_path, properties); - - callback.Run(); - properties->NotifyPropertyChanged(properties->connected.name()); } void FakeBluetoothDeviceClient::Disconnect( @@ -239,10 +236,8 @@ void FakeBluetoothDeviceClient::Disconnect( Properties* properties = GetProperties(object_path); if (properties->connected.value() == true) { - properties->connected.ReplaceValue(false); - callback.Run(); - properties->NotifyPropertyChanged(properties->connected.name()); + properties->connected.ReplaceValue(false); } else { error_callback.Run("org.bluez.Error.NotConnected", "Not Connected"); } @@ -460,6 +455,10 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties->adapter.ReplaceValue( dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)); + std::vector<std::string> uuids; + uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); + properties->uuids.ReplaceValue(uuids); + properties_map_[dbus::ObjectPath(kAppleMousePath)] = properties; device_list_.push_back(dbus::ObjectPath(kAppleMousePath)); FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, @@ -480,6 +479,10 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties->adapter.ReplaceValue( dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)); + std::vector<std::string> uuids; + uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); + properties->uuids.ReplaceValue(uuids); + properties_map_[dbus::ObjectPath(kAppleKeyboardPath)] = properties; device_list_.push_back(dbus::ObjectPath(kAppleKeyboardPath)); FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, @@ -521,6 +524,10 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties->adapter.ReplaceValue( dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)); + std::vector<std::string> uuids; + uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); + properties->uuids.ReplaceValue(uuids); + properties_map_[dbus::ObjectPath(kMicrosoftMousePath)] = properties; device_list_.push_back(dbus::ObjectPath(kMicrosoftMousePath)); FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, @@ -542,6 +549,10 @@ void FakeBluetoothDeviceClient::DiscoverySimulationTimer() { properties->adapter.ReplaceValue( dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)); + std::vector<std::string> uuids; + uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); + properties->uuids.ReplaceValue(uuids); + properties_map_[dbus::ObjectPath(kMotorolaKeyboardPath)] = properties; device_list_.push_back(dbus::ObjectPath(kMotorolaKeyboardPath)); FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_, @@ -639,11 +650,9 @@ void FakeBluetoothDeviceClient::CompleteSimulatedPairing( Properties* properties = GetProperties(object_path); properties->paired.ReplaceValue(true); + callback.Run(); AddInputDeviceIfNeeded(object_path, properties); - - callback.Run(); - properties->NotifyPropertyChanged(properties->paired.name()); } } @@ -683,15 +692,8 @@ void FakeBluetoothDeviceClient::AddInputDeviceIfNeeded( static_cast<FakeBluetoothInputClient*>( DBusThreadManager::Get()->GetExperimentalBluetoothInputClient()); - if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500) { - std::vector<std::string> uuids = properties->uuids.value(); - if (std::find(uuids.begin(), uuids.end(), - "00001124-0000-1000-8000-00805f9b34fb") == uuids.end()) { - uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); - properties->uuids.ReplaceValue(uuids); - fake_bluetooth_input_client->AddInputDevice(object_path); - } - } + if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500) + fake_bluetooth_input_client->AddInputDevice(object_path); } void FakeBluetoothDeviceClient::PinCodeCallback( diff --git a/dbus/property.h b/dbus/property.h index f2feb05..9f5af48 100644 --- a/dbus/property.h +++ b/dbus/property.h @@ -386,11 +386,17 @@ class CHROME_DBUS_EXPORT Property : public PropertyBase { // Method used by test and stub implementations of dbus::PropertySet::Set // to replace the property value with the set value without using a // dbus::MessageReader. - virtual void ReplaceValueWithSetValue() { value_ = set_value_; } + virtual void ReplaceValueWithSetValue() { + value_ = set_value_; + property_set()->NotifyPropertyChanged(name()); + } // Method used by test and stub implementations to directly set the // value of a property. - void ReplaceValue(const T& value) { value_ = value; } + void ReplaceValue(const T& value) { + value_ = value; + property_set()->NotifyPropertyChanged(name()); + } private: // Current cached value of the property. diff --git a/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc b/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc index 2f14369..3dfc4b6 100644 --- a/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc @@ -787,7 +787,6 @@ TEST_F(BluetoothExperimentalChromeOSTest, DeviceClassChanged) { dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath)); properties->bluetooth_class.ReplaceValue(0x002580); - properties->NotifyPropertyChanged(properties->bluetooth_class.name()); EXPECT_EQ(1, observer.device_changed_count_); EXPECT_EQ(devices[0], observer.last_device_); @@ -817,7 +816,6 @@ TEST_F(BluetoothExperimentalChromeOSTest, DeviceNameChanged) { static const std::string new_name("New Device Name"); properties->alias.ReplaceValue(new_name); - properties->NotifyPropertyChanged(properties->alias.name()); EXPECT_EQ(1, observer.device_changed_count_); EXPECT_EQ(devices[0], observer.last_device_); @@ -853,7 +851,6 @@ TEST_F(BluetoothExperimentalChromeOSTest, DeviceUuidsChanged) { uuids.push_back("0000110a-0000-1000-8000-00805f9b34fb"); properties->uuids.ReplaceValue(uuids); - properties->NotifyPropertyChanged(properties->uuids.name()); EXPECT_EQ(1, observer.device_changed_count_); EXPECT_EQ(devices[0], observer.last_device_); |