| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 type_entry_writer.CloseContainer(&wap_list_writer); | 177 type_entry_writer.CloseContainer(&wap_list_writer); |
| 178 type_dict_writer.CloseContainer(&type_entry_writer); | 178 type_dict_writer.CloseContainer(&type_entry_writer); |
| 179 writer.CloseContainer(&type_dict_writer); | 179 writer.CloseContainer(&type_dict_writer); |
| 180 | 180 |
| 181 | 181 |
| 182 // Create the expected value. | 182 // Create the expected value. |
| 183 base::DictionaryValue type_dict_value; | 183 base::DictionaryValue type_dict_value; |
| 184 base::ListValue* type_entry_value = new base::ListValue; | 184 base::ListValue* type_entry_value = new base::ListValue; |
| 185 auto property_dict_value = base::MakeUnique<base::DictionaryValue>(); | 185 auto property_dict_value = base::MakeUnique<base::DictionaryValue>(); |
| 186 property_dict_value->SetWithoutPathExpansion( | 186 property_dict_value->SetWithoutPathExpansion( |
| 187 shill::kGeoMacAddressProperty, | 187 shill::kGeoMacAddressProperty, new base::Value("01:23:45:67:89:AB")); |
| 188 new base::StringValue("01:23:45:67:89:AB")); | |
| 189 type_entry_value->Append(std::move(property_dict_value)); | 188 type_entry_value->Append(std::move(property_dict_value)); |
| 190 type_dict_value.SetWithoutPathExpansion("wifi", type_entry_value); | 189 type_dict_value.SetWithoutPathExpansion("wifi", type_entry_value); |
| 191 | 190 |
| 192 // Set expectations. | 191 // Set expectations. |
| 193 PrepareForMethodCall(shill::kGetNetworksForGeolocation, | 192 PrepareForMethodCall(shill::kGetNetworksForGeolocation, |
| 194 base::Bind(&ExpectNoArgument), | 193 base::Bind(&ExpectNoArgument), |
| 195 response.get()); | 194 response.get()); |
| 196 // Call method. | 195 // Call method. |
| 197 client_->GetNetworksForGeolocation(base::Bind(&ExpectDictionaryValueResult, | 196 client_->GetNetworksForGeolocation(base::Bind(&ExpectDictionaryValueResult, |
| 198 &type_dict_value)); | 197 &type_dict_value)); |
| 199 | 198 |
| 200 // Run the message loop. | 199 // Run the message loop. |
| 201 base::RunLoop().RunUntilIdle(); | 200 base::RunLoop().RunUntilIdle(); |
| 202 } | 201 } |
| 203 | 202 |
| 204 TEST_F(ShillManagerClientTest, SetProperty) { | 203 TEST_F(ShillManagerClientTest, SetProperty) { |
| 205 // Create response. | 204 // Create response. |
| 206 std::unique_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | 205 std::unique_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); |
| 207 // Set expectations. | 206 // Set expectations. |
| 208 base::StringValue value("portal list"); | 207 base::Value value("portal list"); |
| 209 PrepareForMethodCall(shill::kSetPropertyFunction, | 208 PrepareForMethodCall(shill::kSetPropertyFunction, |
| 210 base::Bind(ExpectStringAndValueArguments, | 209 base::Bind(ExpectStringAndValueArguments, |
| 211 shill::kCheckPortalListProperty, | 210 shill::kCheckPortalListProperty, |
| 212 &value), | 211 &value), |
| 213 response.get()); | 212 response.get()); |
| 214 // Call method. | 213 // Call method. |
| 215 base::MockCallback<base::Closure> mock_closure; | 214 base::MockCallback<base::Closure> mock_closure; |
| 216 base::MockCallback<ShillManagerClient::ErrorCallback> mock_error_callback; | 215 base::MockCallback<ShillManagerClient::ErrorCallback> mock_error_callback; |
| 217 client_->SetProperty(shill::kCheckPortalListProperty, value, | 216 client_->SetProperty(shill::kCheckPortalListProperty, value, |
| 218 mock_closure.Get(), mock_error_callback.Get()); | 217 mock_closure.Get(), mock_error_callback.Get()); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 properties, arguments[7], | 470 properties, arguments[7], |
| 472 base::Bind(&ExpectStringResultWithoutStatus, expected), | 471 base::Bind(&ExpectStringResultWithoutStatus, expected), |
| 473 mock_error_callback.Get()); | 472 mock_error_callback.Get()); |
| 474 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); | 473 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
| 475 | 474 |
| 476 // Run the message loop. | 475 // Run the message loop. |
| 477 base::RunLoop().RunUntilIdle(); | 476 base::RunLoop().RunUntilIdle(); |
| 478 } | 477 } |
| 479 | 478 |
| 480 } // namespace chromeos | 479 } // namespace chromeos |
| OLD | NEW |