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" |
| 6 |
| 7 #include <memory> |
| 8 #include <utility> |
| 9 |
5 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/memory/ptr_util.h" |
6 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
7 #include "base/values.h" | 13 #include "base/values.h" |
8 #include "chromeos/dbus/shill_client_unittest_base.h" | 14 #include "chromeos/dbus/shill_client_unittest_base.h" |
9 #include "chromeos/dbus/shill_manager_client.h" | |
10 #include "dbus/message.h" | 15 #include "dbus/message.h" |
11 #include "dbus/object_path.h" | 16 #include "dbus/object_path.h" |
12 #include "dbus/values_util.h" | 17 #include "dbus/values_util.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/cros_system_api/dbus/service_constants.h" | 19 #include "third_party/cros_system_api/dbus/service_constants.h" |
15 | 20 |
16 using testing::_; | 21 using testing::_; |
17 using testing::ByRef; | 22 using testing::ByRef; |
18 | 23 |
19 namespace chromeos { | 24 namespace chromeos { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 wap_list_writer.CloseContainer(&property_dict_writer); | 159 wap_list_writer.CloseContainer(&property_dict_writer); |
155 variant_writer.CloseContainer(&wap_list_writer); | 160 variant_writer.CloseContainer(&wap_list_writer); |
156 type_entry_writer.CloseContainer(&wap_list_writer); | 161 type_entry_writer.CloseContainer(&wap_list_writer); |
157 type_dict_writer.CloseContainer(&type_entry_writer); | 162 type_dict_writer.CloseContainer(&type_entry_writer); |
158 writer.CloseContainer(&type_dict_writer); | 163 writer.CloseContainer(&type_dict_writer); |
159 | 164 |
160 | 165 |
161 // Create the expected value. | 166 // Create the expected value. |
162 base::DictionaryValue type_dict_value; | 167 base::DictionaryValue type_dict_value; |
163 base::ListValue* type_entry_value = new base::ListValue; | 168 base::ListValue* type_entry_value = new base::ListValue; |
164 base::DictionaryValue* property_dict_value = new base::DictionaryValue; | 169 auto property_dict_value = base::MakeUnique<base::DictionaryValue>(); |
165 property_dict_value->SetWithoutPathExpansion( | 170 property_dict_value->SetWithoutPathExpansion( |
166 shill::kGeoMacAddressProperty, | 171 shill::kGeoMacAddressProperty, |
167 new base::StringValue("01:23:45:67:89:AB")); | 172 new base::StringValue("01:23:45:67:89:AB")); |
168 type_entry_value->Append(property_dict_value); | 173 type_entry_value->Append(std::move(property_dict_value)); |
169 type_dict_value.SetWithoutPathExpansion("wifi", type_entry_value); | 174 type_dict_value.SetWithoutPathExpansion("wifi", type_entry_value); |
170 | 175 |
171 // Set expectations. | 176 // Set expectations. |
172 PrepareForMethodCall(shill::kGetNetworksForGeolocation, | 177 PrepareForMethodCall(shill::kGetNetworksForGeolocation, |
173 base::Bind(&ExpectNoArgument), | 178 base::Bind(&ExpectNoArgument), |
174 response.get()); | 179 response.get()); |
175 // Call method. | 180 // Call method. |
176 client_->GetNetworksForGeolocation(base::Bind(&ExpectDictionaryValueResult, | 181 client_->GetNetworksForGeolocation(base::Bind(&ExpectDictionaryValueResult, |
177 &type_dict_value)); | 182 &type_dict_value)); |
178 | 183 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 arguments[7], | 441 arguments[7], |
437 base::Bind(&ExpectStringResultWithoutStatus, expected), | 442 base::Bind(&ExpectStringResultWithoutStatus, expected), |
438 mock_error_callback.GetCallback()); | 443 mock_error_callback.GetCallback()); |
439 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); | 444 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
440 | 445 |
441 // Run the message loop. | 446 // Run the message loop. |
442 base::RunLoop().RunUntilIdle(); | 447 base::RunLoop().RunUntilIdle(); |
443 } | 448 } |
444 | 449 |
445 } // namespace chromeos | 450 } // namespace chromeos |
OLD | NEW |