OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "chromeos/dbus/shill_client_unittest_base.h" | 7 #include "chromeos/dbus/shill_client_unittest_base.h" |
8 #include "chromeos/dbus/shill_service_client.h" | 8 #include "chromeos/dbus/shill_service_client.h" |
9 #include "dbus/message.h" | 9 #include "dbus/message.h" |
10 #include "dbus/object_path.h" | 10 #include "dbus/object_path.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 writer.AppendVariantOfByte(kValue); | 57 writer.AppendVariantOfByte(kValue); |
58 | 58 |
59 // Set expectations. | 59 // Set expectations. |
60 const base::FundamentalValue value(kValue); | 60 const base::FundamentalValue value(kValue); |
61 MockPropertyChangeObserver observer; | 61 MockPropertyChangeObserver observer; |
62 EXPECT_CALL(observer, | 62 EXPECT_CALL(observer, |
63 OnPropertyChanged( | 63 OnPropertyChanged( |
64 flimflam::kSignalStrengthProperty, | 64 flimflam::kSignalStrengthProperty, |
65 ValueEq(ByRef(value)))).Times(1); | 65 ValueEq(ByRef(value)))).Times(1); |
66 | 66 |
| 67 // The ShillClientHelper should be created here because of this call. |
| 68 EXPECT_CALL(*mock_bus_, RemoveObjectProxy(_, |
| 69 dbus::ObjectPath(kExampleServicePath), _)).Times(0); |
| 70 |
67 // Add the observer | 71 // Add the observer |
68 client_->AddPropertyChangedObserver( | 72 client_->AddPropertyChangedObserver( |
69 dbus::ObjectPath(kExampleServicePath), | 73 dbus::ObjectPath(kExampleServicePath), |
70 &observer); | 74 &observer); |
71 | 75 |
72 // Run the signal callback. | 76 // Run the signal callback. |
73 SendPropertyChangedSignal(&signal); | 77 SendPropertyChangedSignal(&signal); |
74 | 78 |
| 79 EXPECT_CALL(*mock_bus_, RemoveObjectProxy(_, |
| 80 dbus::ObjectPath(kExampleServicePath), _)).Times(1); |
| 81 |
75 // Remove the observer. | 82 // Remove the observer. |
76 client_->RemovePropertyChangedObserver( | 83 client_->RemovePropertyChangedObserver( |
77 dbus::ObjectPath(kExampleServicePath), | 84 dbus::ObjectPath(kExampleServicePath), |
78 &observer); | 85 &observer); |
79 | 86 |
80 EXPECT_CALL(observer, OnPropertyChanged(_, _)).Times(0); | 87 EXPECT_CALL(observer, OnPropertyChanged(_, _)).Times(0); |
81 | 88 |
82 // Run the signal callback again and make sure the observer isn't called. | 89 // Run the signal callback again and make sure the observer isn't called. |
83 SendPropertyChangedSignal(&signal); | 90 SendPropertyChangedSignal(&signal); |
84 } | 91 } |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 PrepareForMethodCall(flimflam::kActivateCellularModemFunction, | 293 PrepareForMethodCall(flimflam::kActivateCellularModemFunction, |
287 base::Bind(&ExpectStringArgument, kCarrier), | 294 base::Bind(&ExpectStringArgument, kCarrier), |
288 response.get()); | 295 response.get()); |
289 // Call method. | 296 // Call method. |
290 const bool result = client_->CallActivateCellularModemAndBlock( | 297 const bool result = client_->CallActivateCellularModemAndBlock( |
291 dbus::ObjectPath(kExampleServicePath), kCarrier); | 298 dbus::ObjectPath(kExampleServicePath), kCarrier); |
292 EXPECT_TRUE(result); | 299 EXPECT_TRUE(result); |
293 } | 300 } |
294 | 301 |
295 } // namespace chromeos | 302 } // namespace chromeos |
OLD | NEW |