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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 88 } |
89 | 89 |
90 void TearDown() override { ShillClientUnittestBase::TearDown(); } | 90 void TearDown() override { ShillClientUnittestBase::TearDown(); } |
91 | 91 |
92 protected: | 92 protected: |
93 std::unique_ptr<ShillManagerClient> client_; | 93 std::unique_ptr<ShillManagerClient> client_; |
94 }; | 94 }; |
95 | 95 |
96 TEST_F(ShillManagerClientTest, PropertyChanged) { | 96 TEST_F(ShillManagerClientTest, PropertyChanged) { |
97 // Create a signal. | 97 // Create a signal. |
98 base::FundamentalValue kOfflineMode(true); | 98 base::Value kOfflineMode(true); |
99 dbus::Signal signal(shill::kFlimflamManagerInterface, | 99 dbus::Signal signal(shill::kFlimflamManagerInterface, |
100 shill::kMonitorPropertyChanged); | 100 shill::kMonitorPropertyChanged); |
101 dbus::MessageWriter writer(&signal); | 101 dbus::MessageWriter writer(&signal); |
102 writer.AppendString(shill::kOfflineModeProperty); | 102 writer.AppendString(shill::kOfflineModeProperty); |
103 dbus::AppendBasicTypeValueData(&writer, kOfflineMode); | 103 dbus::AppendBasicTypeValueData(&writer, kOfflineMode); |
104 | 104 |
105 // Set expectations. | 105 // Set expectations. |
106 MockPropertyChangeObserver observer; | 106 MockPropertyChangeObserver observer; |
107 EXPECT_CALL(observer, | 107 EXPECT_CALL(observer, |
108 OnPropertyChanged(shill::kOfflineModeProperty, | 108 OnPropertyChanged(shill::kOfflineModeProperty, |
(...skipping 24 matching lines...) Expand all Loading... |
133 dbus::MessageWriter entry_writer(NULL); | 133 dbus::MessageWriter entry_writer(NULL); |
134 array_writer.OpenDictEntry(&entry_writer); | 134 array_writer.OpenDictEntry(&entry_writer); |
135 entry_writer.AppendString(shill::kOfflineModeProperty); | 135 entry_writer.AppendString(shill::kOfflineModeProperty); |
136 entry_writer.AppendVariantOfBool(true); | 136 entry_writer.AppendVariantOfBool(true); |
137 array_writer.CloseContainer(&entry_writer); | 137 array_writer.CloseContainer(&entry_writer); |
138 writer.CloseContainer(&array_writer); | 138 writer.CloseContainer(&array_writer); |
139 | 139 |
140 // Create the expected value. | 140 // Create the expected value. |
141 base::DictionaryValue value; | 141 base::DictionaryValue value; |
142 value.SetWithoutPathExpansion(shill::kOfflineModeProperty, | 142 value.SetWithoutPathExpansion(shill::kOfflineModeProperty, |
143 new base::FundamentalValue(true)); | 143 new base::Value(true)); |
144 // Set expectations. | 144 // Set expectations. |
145 PrepareForMethodCall(shill::kGetPropertiesFunction, | 145 PrepareForMethodCall(shill::kGetPropertiesFunction, |
146 base::Bind(&ExpectNoArgument), | 146 base::Bind(&ExpectNoArgument), |
147 response.get()); | 147 response.get()); |
148 // Call method. | 148 // Call method. |
149 client_->GetProperties(base::Bind(&ExpectDictionaryValueResult, &value)); | 149 client_->GetProperties(base::Bind(&ExpectDictionaryValueResult, &value)); |
150 // Run the message loop. | 150 // Run the message loop. |
151 base::RunLoop().RunUntilIdle(); | 151 base::RunLoop().RunUntilIdle(); |
152 } | 152 } |
153 | 153 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 properties, arguments[7], | 471 properties, arguments[7], |
472 base::Bind(&ExpectStringResultWithoutStatus, expected), | 472 base::Bind(&ExpectStringResultWithoutStatus, expected), |
473 mock_error_callback.Get()); | 473 mock_error_callback.Get()); |
474 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); | 474 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
475 | 475 |
476 // Run the message loop. | 476 // Run the message loop. |
477 base::RunLoop().RunUntilIdle(); | 477 base::RunLoop().RunUntilIdle(); |
478 } | 478 } |
479 | 479 |
480 } // namespace chromeos | 480 } // namespace chromeos |
OLD | NEW |