Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chromeos/dbus/shill_client_unittest_base.cc

Issue 16998003: Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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_, MockCallMethodAndBlock(_, _)) 118 EXPECT_CALL(*mock_proxy_.get(), MockCallMethodAndBlock(_, _)).WillRepeatedly(
119 .WillRepeatedly(Invoke( 119 Invoke(this, &ShillClientUnittestBase::OnCallMethodAndBlock));
120 this, &ShillClientUnittestBase::OnCallMethodAndBlock));
121 120
122 // Set an expectation so mock_proxy's CallMethod() will use OnCallMethod() 121 // Set an expectation so mock_proxy's CallMethod() will use OnCallMethod()
123 // to return responses. 122 // to return responses.
124 EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) 123 EXPECT_CALL(*mock_proxy_.get(), CallMethod(_, _, _))
125 .WillRepeatedly(Invoke(this, &ShillClientUnittestBase::OnCallMethod)); 124 .WillRepeatedly(Invoke(this, &ShillClientUnittestBase::OnCallMethod));
126 125
127 // Set an expectation so mock_proxy's CallMethodWithErrorCallback() will use 126 // Set an expectation so mock_proxy's CallMethodWithErrorCallback() will use
128 // OnCallMethodWithErrorCallback() to return responses. 127 // OnCallMethodWithErrorCallback() to return responses.
129 EXPECT_CALL(*mock_proxy_, CallMethodWithErrorCallback(_, _, _, _)) 128 EXPECT_CALL(*mock_proxy_.get(), CallMethodWithErrorCallback(_, _, _, _))
130 .WillRepeatedly(Invoke( 129 .WillRepeatedly(Invoke(
131 this, &ShillClientUnittestBase::OnCallMethodWithErrorCallback)); 130 this, &ShillClientUnittestBase::OnCallMethodWithErrorCallback));
132 131
133 // Set an expectation so mock_proxy's ConnectToSignal() will use 132 // Set an expectation so mock_proxy's ConnectToSignal() will use
134 // OnConnectToSignal() to run the callback. 133 // OnConnectToSignal() to run the callback.
135 EXPECT_CALL(*mock_proxy_, ConnectToSignal( 134 EXPECT_CALL(
136 interface_name_, 135 *mock_proxy_.get(),
137 flimflam::kMonitorPropertyChanged, _, _)) 136 ConnectToSignal(interface_name_, flimflam::kMonitorPropertyChanged, _, _))
138 .WillRepeatedly(Invoke(this, 137 .WillRepeatedly(
139 &ShillClientUnittestBase::OnConnectToSignal)); 138 Invoke(this, &ShillClientUnittestBase::OnConnectToSignal));
140 139
141 // Set an expectation so mock_bus's GetObjectProxy() for the given 140 // Set an expectation so mock_bus's GetObjectProxy() for the given
142 // service name and the object path will return mock_proxy_. 141 // service name and the object path will return mock_proxy_.
143 EXPECT_CALL(*mock_bus_, GetObjectProxy(flimflam::kFlimflamServiceName, 142 EXPECT_CALL(*mock_bus_.get(),
144 object_path_)) 143 GetObjectProxy(flimflam::kFlimflamServiceName, object_path_))
145 .WillOnce(Return(mock_proxy_.get())); 144 .WillOnce(Return(mock_proxy_.get()));
146 145
147 // Set an expectation so mock_bus's PostTaskToDBusThread() will run the 146 // Set an expectation so mock_bus's PostTaskToDBusThread() will run the
148 // given task. 147 // given task.
149 EXPECT_CALL(*mock_bus_, PostTaskToDBusThread(_, _)) 148 EXPECT_CALL(*mock_bus_.get(), PostTaskToDBusThread(_, _))
150 .WillRepeatedly(Invoke(&RunTask)); 149 .WillRepeatedly(Invoke(&RunTask));
151 150
152 // ShutdownAndBlock() will be called in TearDown(). 151 // ShutdownAndBlock() will be called in TearDown().
153 EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); 152 EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return());
154 } 153 }
155 154
156 void ShillClientUnittestBase::TearDown() { 155 void ShillClientUnittestBase::TearDown() {
157 mock_bus_->ShutdownAndBlock(); 156 mock_bus_->ShutdownAndBlock();
158 } 157 }
159 158
160 void ShillClientUnittestBase::PrepareForMethodCall( 159 void ShillClientUnittestBase::PrepareForMethodCall(
161 const std::string& method_name, 160 const std::string& method_name,
162 const ArgumentCheckCallback& argument_checker, 161 const ArgumentCheckCallback& argument_checker,
163 dbus::Response* response) { 162 dbus::Response* response) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 int timeout_ms) { 325 int timeout_ms) {
327 EXPECT_EQ(interface_name_, method_call->GetInterface()); 326 EXPECT_EQ(interface_name_, method_call->GetInterface());
328 EXPECT_EQ(expected_method_name_, method_call->GetMember()); 327 EXPECT_EQ(expected_method_name_, method_call->GetMember());
329 dbus::MessageReader reader(method_call); 328 dbus::MessageReader reader(method_call);
330 argument_checker_.Run(&reader); 329 argument_checker_.Run(&reader);
331 return dbus::Response::FromRawMessage( 330 return dbus::Response::FromRawMessage(
332 dbus_message_copy(response_->raw_message())).release(); 331 dbus_message_copy(response_->raw_message())).release();
333 } 332 }
334 333
335 } // namespace chromeos 334 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/modem_messaging_client_unittest.cc ('k') | chromeos/dbus/shill_device_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698