Index: chromeos/dbus/shill_ipconfig_client_unittest.cc |
diff --git a/chromeos/dbus/shill_ipconfig_client_unittest.cc b/chromeos/dbus/shill_ipconfig_client_unittest.cc |
index 60bca254b9b9af44b3c44be5f07a4abdc77e7819..a89a450694abcf9688b8d0d5c3340868979e351c 100644 |
--- a/chromeos/dbus/shill_ipconfig_client_unittest.cc |
+++ b/chromeos/dbus/shill_ipconfig_client_unittest.cc |
@@ -11,6 +11,9 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "third_party/cros_system_api/dbus/service_constants.h" |
+using testing::_; |
+using testing::ByRef; |
+ |
namespace chromeos { |
namespace { |
@@ -54,15 +57,27 @@ TEST_F(ShillIPConfigClientTest, PropertyChanged) { |
dbus::AppendBasicTypeValueDataAsVariant(&writer, kConnected); |
// Set expectations. |
- client_->SetPropertyChangedHandler(dbus::ObjectPath(kExampleIPConfigPath), |
- base::Bind(&ExpectPropertyChanged, |
- flimflam::kConnectedProperty, |
- &kConnected)); |
+ MockPropertyChangeObserver observer; |
+ EXPECT_CALL(observer, OnPropertyChanged(flimflam::kConnectedProperty, |
+ ValueEq(ByRef(kConnected)))).Times(1); |
+ |
+ // Add the observer |
+ client_->AddPropertyChangedObserver( |
+ dbus::ObjectPath(kExampleIPConfigPath), |
+ &observer); |
+ |
// Run the signal callback. |
SendPropertyChangedSignal(&signal); |
- // Reset the handler. |
- client_->ResetPropertyChangedHandler(dbus::ObjectPath(kExampleIPConfigPath)); |
+ // Remove the observer. |
+ client_->RemovePropertyChangedObserver( |
+ dbus::ObjectPath(kExampleIPConfigPath), |
+ &observer); |
+ |
+ EXPECT_CALL(observer, OnPropertyChanged(_, _)).Times(0); |
+ |
+ // Run the signal callback again and make sure the observer isn't called. |
+ SendPropertyChangedSignal(&signal); |
} |
TEST_F(ShillIPConfigClientTest, GetProperties) { |