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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 writer.OpenArray("{sv}", &array_writer); | 132 writer.OpenArray("{sv}", &array_writer); |
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.SetBooleanWithoutPathExpansion(shill::kOfflineModeProperty, true); |
143 new base::Value(true)); | |
144 // Set expectations. | 143 // Set expectations. |
145 PrepareForMethodCall(shill::kGetPropertiesFunction, | 144 PrepareForMethodCall(shill::kGetPropertiesFunction, |
146 base::Bind(&ExpectNoArgument), | 145 base::Bind(&ExpectNoArgument), |
147 response.get()); | 146 response.get()); |
148 // Call method. | 147 // Call method. |
149 client_->GetProperties(base::Bind(&ExpectDictionaryValueResult, &value)); | 148 client_->GetProperties(base::Bind(&ExpectDictionaryValueResult, &value)); |
150 // Run the message loop. | 149 // Run the message loop. |
151 base::RunLoop().RunUntilIdle(); | 150 base::RunLoop().RunUntilIdle(); |
152 } | 151 } |
153 | 152 |
(...skipping 20 matching lines...) Expand all Loading... |
174 property_dict_writer.CloseContainer(&property_entry_writer); | 173 property_dict_writer.CloseContainer(&property_entry_writer); |
175 wap_list_writer.CloseContainer(&property_dict_writer); | 174 wap_list_writer.CloseContainer(&property_dict_writer); |
176 variant_writer.CloseContainer(&wap_list_writer); | 175 variant_writer.CloseContainer(&wap_list_writer); |
177 type_entry_writer.CloseContainer(&wap_list_writer); | 176 type_entry_writer.CloseContainer(&wap_list_writer); |
178 type_dict_writer.CloseContainer(&type_entry_writer); | 177 type_dict_writer.CloseContainer(&type_entry_writer); |
179 writer.CloseContainer(&type_dict_writer); | 178 writer.CloseContainer(&type_dict_writer); |
180 | 179 |
181 | 180 |
182 // Create the expected value. | 181 // Create the expected value. |
183 base::DictionaryValue type_dict_value; | 182 base::DictionaryValue type_dict_value; |
184 base::ListValue* type_entry_value = new base::ListValue; | 183 auto type_entry_value = base::MakeUnique<base::ListValue>(); |
185 auto property_dict_value = base::MakeUnique<base::DictionaryValue>(); | 184 auto property_dict_value = base::MakeUnique<base::DictionaryValue>(); |
186 property_dict_value->SetWithoutPathExpansion( | 185 property_dict_value->SetStringWithoutPathExpansion( |
187 shill::kGeoMacAddressProperty, new base::Value("01:23:45:67:89:AB")); | 186 shill::kGeoMacAddressProperty, "01:23:45:67:89:AB"); |
188 type_entry_value->Append(std::move(property_dict_value)); | 187 type_entry_value->Append(std::move(property_dict_value)); |
189 type_dict_value.SetWithoutPathExpansion("wifi", type_entry_value); | 188 type_dict_value.SetWithoutPathExpansion("wifi", std::move(type_entry_value)); |
190 | 189 |
191 // Set expectations. | 190 // Set expectations. |
192 PrepareForMethodCall(shill::kGetNetworksForGeolocation, | 191 PrepareForMethodCall(shill::kGetNetworksForGeolocation, |
193 base::Bind(&ExpectNoArgument), | 192 base::Bind(&ExpectNoArgument), |
194 response.get()); | 193 response.get()); |
195 // Call method. | 194 // Call method. |
196 client_->GetNetworksForGeolocation(base::Bind(&ExpectDictionaryValueResult, | 195 client_->GetNetworksForGeolocation(base::Bind(&ExpectDictionaryValueResult, |
197 &type_dict_value)); | 196 &type_dict_value)); |
198 | 197 |
199 // Run the message loop. | 198 // Run the message loop. |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 properties, arguments[7], | 469 properties, arguments[7], |
471 base::Bind(&ExpectStringResultWithoutStatus, expected), | 470 base::Bind(&ExpectStringResultWithoutStatus, expected), |
472 mock_error_callback.Get()); | 471 mock_error_callback.Get()); |
473 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); | 472 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
474 | 473 |
475 // Run the message loop. | 474 // Run the message loop. |
476 base::RunLoop().RunUntilIdle(); | 475 base::RunLoop().RunUntilIdle(); |
477 } | 476 } |
478 | 477 |
479 } // namespace chromeos | 478 } // namespace chromeos |
OLD | NEW |