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 "chromeos/dbus/shill_manager_client.h" | 5 #include "chromeos/dbus/shill_manager_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
88 | 88 |
89 void TearDown() override { ShillClientUnittestBase::TearDown(); } | 89 void TearDown() override { ShillClientUnittestBase::TearDown(); } |
90 | 90 |
91 protected: | 91 protected: |
92 std::unique_ptr<ShillManagerClient> client_; | 92 std::unique_ptr<ShillManagerClient> client_; |
93 }; | 93 }; |
94 | 94 |
95 TEST_F(ShillManagerClientTest, PropertyChanged) { | 95 TEST_F(ShillManagerClientTest, PropertyChanged) { |
96 // Create a signal. | 96 // Create a signal. |
97 base::FundamentalValue kOfflineMode(true); | 97 base::Value kOfflineMode(true); |
98 dbus::Signal signal(shill::kFlimflamManagerInterface, | 98 dbus::Signal signal(shill::kFlimflamManagerInterface, |
99 shill::kMonitorPropertyChanged); | 99 shill::kMonitorPropertyChanged); |
100 dbus::MessageWriter writer(&signal); | 100 dbus::MessageWriter writer(&signal); |
101 writer.AppendString(shill::kOfflineModeProperty); | 101 writer.AppendString(shill::kOfflineModeProperty); |
102 dbus::AppendBasicTypeValueData(&writer, kOfflineMode); | 102 dbus::AppendBasicTypeValueData(&writer, kOfflineMode); |
103 | 103 |
104 // Set expectations. | 104 // Set expectations. |
105 MockPropertyChangeObserver observer; | 105 MockPropertyChangeObserver observer; |
106 EXPECT_CALL(observer, | 106 EXPECT_CALL(observer, |
107 OnPropertyChanged(shill::kOfflineModeProperty, | 107 OnPropertyChanged(shill::kOfflineModeProperty, |
(...skipping 24 matching lines...) Expand all Loading... |
132 dbus::MessageWriter entry_writer(NULL); | 132 dbus::MessageWriter entry_writer(NULL); |
133 array_writer.OpenDictEntry(&entry_writer); | 133 array_writer.OpenDictEntry(&entry_writer); |
134 entry_writer.AppendString(shill::kOfflineModeProperty); | 134 entry_writer.AppendString(shill::kOfflineModeProperty); |
135 entry_writer.AppendVariantOfBool(true); | 135 entry_writer.AppendVariantOfBool(true); |
136 array_writer.CloseContainer(&entry_writer); | 136 array_writer.CloseContainer(&entry_writer); |
137 writer.CloseContainer(&array_writer); | 137 writer.CloseContainer(&array_writer); |
138 | 138 |
139 // Create the expected value. | 139 // Create the expected value. |
140 base::DictionaryValue value; | 140 base::DictionaryValue value; |
141 value.SetWithoutPathExpansion(shill::kOfflineModeProperty, | 141 value.SetWithoutPathExpansion(shill::kOfflineModeProperty, |
142 new base::FundamentalValue(true)); | 142 new base::Value(true)); |
143 // Set expectations. | 143 // Set expectations. |
144 PrepareForMethodCall(shill::kGetPropertiesFunction, | 144 PrepareForMethodCall(shill::kGetPropertiesFunction, |
145 base::Bind(&ExpectNoArgument), | 145 base::Bind(&ExpectNoArgument), |
146 response.get()); | 146 response.get()); |
147 // Call method. | 147 // Call method. |
148 client_->GetProperties(base::Bind(&ExpectDictionaryValueResult, &value)); | 148 client_->GetProperties(base::Bind(&ExpectDictionaryValueResult, &value)); |
149 // Run the message loop. | 149 // Run the message loop. |
150 base::RunLoop().RunUntilIdle(); | 150 base::RunLoop().RunUntilIdle(); |
151 } | 151 } |
152 | 152 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 arguments[7], | 480 arguments[7], |
481 base::Bind(&ExpectStringResultWithoutStatus, expected), | 481 base::Bind(&ExpectStringResultWithoutStatus, expected), |
482 mock_error_callback.GetCallback()); | 482 mock_error_callback.GetCallback()); |
483 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); | 483 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
484 | 484 |
485 // Run the message loop. | 485 // Run the message loop. |
486 base::RunLoop().RunUntilIdle(); | 486 base::RunLoop().RunUntilIdle(); |
487 } | 487 } |
488 | 488 |
489 } // namespace chromeos | 489 } // namespace chromeos |
OLD | NEW |