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/flimflam_client_unittest_base.h" | 7 #include "chromeos/dbus/flimflam_client_unittest_base.h" |
8 #include "chromeos/dbus/flimflam_service_client.h" | 8 #include "chromeos/dbus/flimflam_service_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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 base::Bind(&ExpectNoResultValue)); | 131 base::Bind(&ExpectNoResultValue)); |
132 // Run the message loop. | 132 // Run the message loop. |
133 message_loop_.RunAllPending(); | 133 message_loop_.RunAllPending(); |
134 } | 134 } |
135 | 135 |
136 TEST_F(FlimflamServiceClientTest, Connect) { | 136 TEST_F(FlimflamServiceClientTest, Connect) { |
137 // Create response. | 137 // Create response. |
138 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | 138 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); |
139 | 139 |
140 // Set expectations. | 140 // Set expectations. |
| 141 MockClosure mock_closure; |
| 142 MockErrorCallback mock_error_callback; |
141 PrepareForMethodCall(flimflam::kConnectFunction, | 143 PrepareForMethodCall(flimflam::kConnectFunction, |
142 base::Bind(&ExpectNoArgument), | 144 base::Bind(&ExpectNoArgument), |
143 response.get()); | 145 response.get()); |
| 146 EXPECT_CALL(mock_closure, Run()).Times(1); |
144 // Call method. | 147 // Call method. |
145 client_->Connect(dbus::ObjectPath(kExampleServicePath), | 148 client_->Connect(dbus::ObjectPath(kExampleServicePath), |
146 base::Bind(&ExpectNoResultValue)); | 149 mock_closure.GetCallback(), |
| 150 mock_error_callback.GetCallback()); |
| 151 |
147 // Run the message loop. | 152 // Run the message loop. |
148 message_loop_.RunAllPending(); | 153 message_loop_.RunAllPending(); |
149 } | 154 } |
150 | 155 |
151 TEST_F(FlimflamServiceClientTest, Disconnect) { | 156 TEST_F(FlimflamServiceClientTest, Disconnect) { |
152 // Create response. | 157 // Create response. |
153 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | 158 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); |
154 | 159 |
155 // Set expectations. | 160 // Set expectations. |
156 PrepareForMethodCall(flimflam::kDisconnectFunction, | 161 PrepareForMethodCall(flimflam::kDisconnectFunction, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 response.get()); | 194 response.get()); |
190 // Call method. | 195 // Call method. |
191 client_->ActivateCellularModem(dbus::ObjectPath(kExampleServicePath), | 196 client_->ActivateCellularModem(dbus::ObjectPath(kExampleServicePath), |
192 kCarrier, | 197 kCarrier, |
193 base::Bind(&ExpectNoResultValue)); | 198 base::Bind(&ExpectNoResultValue)); |
194 // Run the message loop. | 199 // Run the message loop. |
195 message_loop_.RunAllPending(); | 200 message_loop_.RunAllPending(); |
196 } | 201 } |
197 | 202 |
198 } // namespace chromeos | 203 } // namespace chromeos |
OLD | NEW |