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_client_unittest_base.h" | 5 #include "chromeos/dbus/shill_client_unittest_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "dbus/message.h" | 10 #include "dbus/message.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 mock_bus_ = new dbus::MockBus(options); | 108 mock_bus_ = new dbus::MockBus(options); |
109 | 109 |
110 // Create a mock proxy. | 110 // Create a mock proxy. |
111 mock_proxy_ = new dbus::MockObjectProxy( | 111 mock_proxy_ = new dbus::MockObjectProxy( |
112 mock_bus_.get(), | 112 mock_bus_.get(), |
113 flimflam::kFlimflamServiceName, | 113 flimflam::kFlimflamServiceName, |
114 object_path_); | 114 object_path_); |
115 | 115 |
116 // Set an expectation so mock_proxy's CallMethodAndBlock() will use | 116 // Set an expectation so mock_proxy's CallMethodAndBlock() will use |
117 // OnCallMethodAndBlock() to return responses. | 117 // OnCallMethodAndBlock() to return responses. |
118 EXPECT_CALL(*mock_proxy_, CallMethodAndBlock(_, _)) | 118 EXPECT_CALL(*mock_proxy_, MockCallMethodAndBlock(_, _)) |
119 .WillRepeatedly(Invoke( | 119 .WillRepeatedly(Invoke( |
120 this, &ShillClientUnittestBase::OnCallMethodAndBlock)); | 120 this, &ShillClientUnittestBase::OnCallMethodAndBlock)); |
121 | 121 |
122 // Set an expectation so mock_proxy's CallMethod() will use OnCallMethod() | 122 // Set an expectation so mock_proxy's CallMethod() will use OnCallMethod() |
123 // to return responses. | 123 // to return responses. |
124 EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) | 124 EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) |
125 .WillRepeatedly(Invoke(this, &ShillClientUnittestBase::OnCallMethod)); | 125 .WillRepeatedly(Invoke(this, &ShillClientUnittestBase::OnCallMethod)); |
126 | 126 |
127 // Set an expectation so mock_proxy's CallMethodWithErrorCallback() will use | 127 // Set an expectation so mock_proxy's CallMethodWithErrorCallback() will use |
128 // OnCallMethodWithErrorCallback() to return responses. | 128 // OnCallMethodWithErrorCallback() to return responses. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } | 308 } |
309 | 309 |
310 dbus::Response* ShillClientUnittestBase::OnCallMethodAndBlock( | 310 dbus::Response* ShillClientUnittestBase::OnCallMethodAndBlock( |
311 dbus::MethodCall* method_call, | 311 dbus::MethodCall* method_call, |
312 int timeout_ms) { | 312 int timeout_ms) { |
313 EXPECT_EQ(interface_name_, method_call->GetInterface()); | 313 EXPECT_EQ(interface_name_, method_call->GetInterface()); |
314 EXPECT_EQ(expected_method_name_, method_call->GetMember()); | 314 EXPECT_EQ(expected_method_name_, method_call->GetMember()); |
315 dbus::MessageReader reader(method_call); | 315 dbus::MessageReader reader(method_call); |
316 argument_checker_.Run(&reader); | 316 argument_checker_.Run(&reader); |
317 return dbus::Response::FromRawMessage( | 317 return dbus::Response::FromRawMessage( |
318 dbus_message_copy(response_->raw_message())); | 318 dbus_message_copy(response_->raw_message())).release(); |
319 } | 319 } |
320 | 320 |
321 } // namespace chromeos | 321 } // namespace chromeos |
OLD | NEW |