Chromium Code Reviews| Index: chromeos/dbus/shill_manager_client_unittest.cc |
| diff --git a/chromeos/dbus/shill_manager_client_unittest.cc b/chromeos/dbus/shill_manager_client_unittest.cc |
| index 9d37aecf76125618cf02f66edef3fbba2c9b65a7..c07313e319b8ce5d6b1e2e5aced0c477d9e6b539 100644 |
| --- a/chromeos/dbus/shill_manager_client_unittest.cc |
| +++ b/chromeos/dbus/shill_manager_client_unittest.cc |
| @@ -12,6 +12,8 @@ |
| #include "testing/gtest/include/gtest/gtest.h" |
| #include "third_party/cros_system_api/dbus/service_constants.h" |
| +using testing::_; |
| + |
| namespace chromeos { |
| namespace { |
| @@ -207,9 +209,15 @@ TEST_F(ShillManagerClientTest, SetProperty) { |
| &value), |
| response.get()); |
| // Call method. |
| + MockClosure mock_closure; |
| + MockErrorCallback mock_error_callback; |
| client_->SetProperty(flimflam::kCheckPortalListProperty, |
| value, |
| - base::Bind(&ExpectNoResultValue)); |
| + mock_closure.GetCallback(), |
| + mock_error_callback.GetCallback()); |
| + EXPECT_CALL(mock_closure, Run()).Times(1); |
| + EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
| + |
| // Run the message loop. |
| message_loop_.RunAllPending(); |
| } |
| @@ -222,7 +230,14 @@ TEST_F(ShillManagerClientTest, RequestScan) { |
| base::Bind(&ExpectStringArgument, flimflam::kTypeWifi), |
| response.get()); |
| // Call method. |
| - client_->RequestScan(flimflam::kTypeWifi, base::Bind(&ExpectNoResultValue)); |
| + MockClosure mock_closure; |
| + MockErrorCallback mock_error_callback; |
| + client_->RequestScan(flimflam::kTypeWifi, |
| + mock_closure.GetCallback(), |
| + mock_error_callback.GetCallback()); |
| + EXPECT_CALL(mock_closure, Run()).Times(1); |
| + EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
| + |
| // Run the message loop. |
| message_loop_.RunAllPending(); |
| } |
| @@ -235,8 +250,14 @@ TEST_F(ShillManagerClientTest, EnableTechnology) { |
| base::Bind(&ExpectStringArgument, flimflam::kTypeWifi), |
| response.get()); |
| // Call method. |
| + MockClosure mock_closure; |
| + MockErrorCallback mock_error_callback; |
| client_->EnableTechnology(flimflam::kTypeWifi, |
| - base::Bind(&ExpectNoResultValue)); |
| + mock_closure.GetCallback(), |
| + mock_error_callback.GetCallback()); |
| + EXPECT_CALL(mock_closure, Run()).Times(1); |
| + EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
| + |
| // Run the message loop. |
| message_loop_.RunAllPending(); |
| } |
| @@ -249,8 +270,14 @@ TEST_F(ShillManagerClientTest, DisableTechnology) { |
| base::Bind(&ExpectStringArgument, flimflam::kTypeWifi), |
| response.get()); |
| // Call method. |
| + MockClosure mock_closure; |
| + MockErrorCallback mock_error_callback; |
| client_->DisableTechnology(flimflam::kTypeWifi, |
| - base::Bind(&ExpectNoResultValue)); |
| + mock_closure.GetCallback(), |
| + mock_error_callback.GetCallback()); |
| + EXPECT_CALL(mock_closure, Run()).Times(1); |
| + EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
| + |
| // Run the message loop. |
| message_loop_.RunAllPending(); |
| } |
| @@ -265,12 +292,20 @@ TEST_F(ShillManagerClientTest, ConfigureService) { |
| base::Bind(&ExpectDictionaryValueArgument, arg.get()), |
| response.get()); |
| // Call method. |
| - client_->ConfigureService(*arg, base::Bind(&ExpectNoResultValue)); |
| + MockClosure mock_closure; |
| + MockErrorCallback mock_error_callback; |
| + client_->ConfigureService(*arg, |
| + mock_closure.GetCallback(), |
| + mock_error_callback.GetCallback()); |
| + EXPECT_CALL(mock_closure, Run()).Times(1); |
| + EXPECT_CALL(mock_error_callback, Run(_, _)).Times(0); |
| + |
| // Run the message loop. |
| message_loop_.RunAllPending(); |
| } |
| TEST_F(ShillManagerClientTest, GetService) { |
| + MockErrorCallback error_callback; |
|
hashimoto
2012/09/24 02:28:56
Move this to the line before the actual method cal
Greg Spencer (Chromium)
2012/09/24 21:50:54
Done.
|
| // Create response. |
| const dbus::ObjectPath object_path("/"); |
| scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); |
| @@ -283,7 +318,10 @@ TEST_F(ShillManagerClientTest, GetService) { |
| base::Bind(&ExpectDictionaryValueArgument, arg.get()), |
| response.get()); |
| // Call method. |
| - client_->GetService(*arg, base::Bind(&ExpectObjectPathResult, object_path)); |
| + client_->GetService(*arg, |
| + base::Bind(&ExpectObjectPathResultWithoutStatus, |
| + object_path), |
| + error_callback.GetCallback()); |
| // Run the message loop. |
| message_loop_.RunAllPending(); |
| } |