| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "chromeos/dbus/shill_client_unittest_base.h" | 7 #include "chromeos/dbus/shill_client_unittest_base.h" |
| 8 #include "chromeos/dbus/shill_manager_client.h" | 8 #include "chromeos/dbus/shill_manager_client.h" |
| 9 #include "dbus/message.h" | 9 #include "dbus/message.h" |
| 10 #include "dbus/object_path.h" | 10 #include "dbus/object_path.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 | 267 |
| 268 TEST_F(ShillManagerClientTest, ConfigureService) { | 268 TEST_F(ShillManagerClientTest, ConfigureService) { |
| 269 // Create response. | 269 // Create response. |
| 270 const dbus::ObjectPath object_path("/"); | 270 const dbus::ObjectPath object_path("/"); |
| 271 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | 271 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); |
| 272 dbus::MessageWriter writer(response.get()); | 272 dbus::MessageWriter writer(response.get()); |
| 273 writer.AppendObjectPath(object_path); | 273 writer.AppendObjectPath(object_path); |
| 274 // Create the argument dictionary. | 274 // Create the argument dictionary. |
| 275 scoped_ptr<base::DictionaryValue> arg(CreateExampleServiceProperties()); | 275 scoped_ptr<base::DictionaryValue> arg(CreateExampleServiceProperties()); |
| 276 // Use a variant valued dictionary rather than a string valued one. |
| 277 const bool string_valued = false; |
| 276 // Set expectations. | 278 // Set expectations. |
| 277 PrepareForMethodCall(shill::kConfigureServiceFunction, | 279 PrepareForMethodCall( |
| 278 base::Bind(&ExpectDictionaryValueArgument, arg.get()), | 280 shill::kConfigureServiceFunction, |
| 279 response.get()); | 281 base::Bind(&ExpectDictionaryValueArgument, arg.get(), string_valued), |
| 282 response.get()); |
| 280 // Call method. | 283 // Call method. |
| 281 MockErrorCallback mock_error_callback; | 284 MockErrorCallback mock_error_callback; |
| 282 client_->ConfigureService(*arg, | 285 client_->ConfigureService(*arg, |
| 283 base::Bind(&ExpectObjectPathResultWithoutStatus, | 286 base::Bind(&ExpectObjectPathResultWithoutStatus, |
| 284 object_path), | 287 object_path), |
| 285 mock_error_callback.GetCallback()); | 288 mock_error_callback.GetCallback()); |
| 286 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); | 289 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
| 287 | 290 |
| 288 // Run the message loop. | 291 // Run the message loop. |
| 289 message_loop_.RunUntilIdle(); | 292 message_loop_.RunUntilIdle(); |
| 290 } | 293 } |
| 291 | 294 |
| 292 TEST_F(ShillManagerClientTest, GetService) { | 295 TEST_F(ShillManagerClientTest, GetService) { |
| 293 // Create response. | 296 // Create response. |
| 294 const dbus::ObjectPath object_path("/"); | 297 const dbus::ObjectPath object_path("/"); |
| 295 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | 298 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); |
| 296 dbus::MessageWriter writer(response.get()); | 299 dbus::MessageWriter writer(response.get()); |
| 297 writer.AppendObjectPath(object_path); | 300 writer.AppendObjectPath(object_path); |
| 298 // Create the argument dictionary. | 301 // Create the argument dictionary. |
| 299 scoped_ptr<base::DictionaryValue> arg(CreateExampleServiceProperties()); | 302 scoped_ptr<base::DictionaryValue> arg(CreateExampleServiceProperties()); |
| 303 // Use a variant valued dictionary rather than a string valued one. |
| 304 const bool string_valued = false; |
| 300 // Set expectations. | 305 // Set expectations. |
| 301 PrepareForMethodCall(shill::kGetServiceFunction, | 306 PrepareForMethodCall( |
| 302 base::Bind(&ExpectDictionaryValueArgument, arg.get()), | 307 shill::kGetServiceFunction, |
| 303 response.get()); | 308 base::Bind(&ExpectDictionaryValueArgument, arg.get(), string_valued), |
| 309 response.get()); |
| 304 // Call method. | 310 // Call method. |
| 305 MockErrorCallback mock_error_callback; | 311 MockErrorCallback mock_error_callback; |
| 306 client_->GetService(*arg, | 312 client_->GetService(*arg, |
| 307 base::Bind(&ExpectObjectPathResultWithoutStatus, | 313 base::Bind(&ExpectObjectPathResultWithoutStatus, |
| 308 object_path), | 314 object_path), |
| 309 mock_error_callback.GetCallback()); | 315 mock_error_callback.GetCallback()); |
| 310 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); | 316 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
| 311 | 317 |
| 312 // Run the message loop. | 318 // Run the message loop. |
| 313 message_loop_.RunUntilIdle(); | 319 message_loop_.RunUntilIdle(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 arguments[7], | 437 arguments[7], |
| 432 base::Bind(&ExpectStringResultWithoutStatus, expected), | 438 base::Bind(&ExpectStringResultWithoutStatus, expected), |
| 433 mock_error_callback.GetCallback()); | 439 mock_error_callback.GetCallback()); |
| 434 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); | 440 EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
| 435 | 441 |
| 436 // Run the message loop. | 442 // Run the message loop. |
| 437 message_loop_.RunUntilIdle(); | 443 message_loop_.RunUntilIdle(); |
| 438 } | 444 } |
| 439 | 445 |
| 440 } // namespace chromeos | 446 } // namespace chromeos |
| OLD | NEW |