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

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

Issue 11367048: This is the first pass at making GetIPConfigs asynchronous. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // static 228 // static
229 void ShillClientUnittestBase::ExpectObjectPathResultWithoutStatus( 229 void ShillClientUnittestBase::ExpectObjectPathResultWithoutStatus(
230 const dbus::ObjectPath& expected_result, 230 const dbus::ObjectPath& expected_result,
231 const dbus::ObjectPath& result) { 231 const dbus::ObjectPath& result) {
232 EXPECT_EQ(expected_result, result); 232 EXPECT_EQ(expected_result, result);
233 } 233 }
234 234
235 // static 235 // static
236 void ShillClientUnittestBase::ExpectDictionaryValueResultWithoutStatus( 236 void ShillClientUnittestBase::ExpectDictionaryValueResultWithoutStatus(
237 const base::DictionaryValue* expected_result, 237 const base::DictionaryValue* expected_result,
238 const base::DictionaryValue& result) { 238 scoped_ptr<base::DictionaryValue> result) {
239 std::string expected_result_string; 239 std::string expected_result_string;
240 base::JSONWriter::Write(expected_result, &expected_result_string); 240 base::JSONWriter::Write(expected_result, &expected_result_string);
241 std::string result_string; 241 std::string result_string;
242 base::JSONWriter::Write(&result, &result_string); 242 base::JSONWriter::Write(result.get(), &result_string);
243 EXPECT_EQ(expected_result_string, result_string); 243 EXPECT_EQ(expected_result_string, result_string);
244 } 244 }
245 245
246 // static 246 // static
247 void ShillClientUnittestBase::ExpectDictionaryValueResult( 247 void ShillClientUnittestBase::ExpectDictionaryValueResult(
248 const base::DictionaryValue* expected_result, 248 const base::DictionaryValue* expected_result,
249 DBusMethodCallStatus call_status, 249 DBusMethodCallStatus call_status,
250 const base::DictionaryValue& result) { 250 scoped_ptr<base::DictionaryValue> result) {
251 EXPECT_EQ(DBUS_METHOD_CALL_SUCCESS, call_status); 251 EXPECT_EQ(DBUS_METHOD_CALL_SUCCESS, call_status);
252 ExpectDictionaryValueResultWithoutStatus(expected_result, result); 252 ExpectDictionaryValueResultWithoutStatus(expected_result, result.Pass());
253 } 253 }
254 254
255 void ShillClientUnittestBase::OnConnectToSignal( 255 void ShillClientUnittestBase::OnConnectToSignal(
256 const std::string& interface_name, 256 const std::string& interface_name,
257 const std::string& signal_name, 257 const std::string& signal_name,
258 const dbus::ObjectProxy::SignalCallback& signal_callback, 258 const dbus::ObjectProxy::SignalCallback& signal_callback,
259 const dbus::ObjectProxy::OnConnectedCallback& on_connected_callback) { 259 const dbus::ObjectProxy::OnConnectedCallback& on_connected_callback) {
260 property_changed_handler_ = signal_callback; 260 property_changed_handler_ = signal_callback;
261 const bool success = true; 261 const bool success = true;
262 message_loop_.PostTask(FROM_HERE, 262 message_loop_.PostTask(FROM_HERE,
(...skipping 28 matching lines...) Expand all
291 int timeout_ms) { 291 int timeout_ms) {
292 EXPECT_EQ(interface_name_, method_call->GetInterface()); 292 EXPECT_EQ(interface_name_, method_call->GetInterface());
293 EXPECT_EQ(expected_method_name_, method_call->GetMember()); 293 EXPECT_EQ(expected_method_name_, method_call->GetMember());
294 dbus::MessageReader reader(method_call); 294 dbus::MessageReader reader(method_call);
295 argument_checker_.Run(&reader); 295 argument_checker_.Run(&reader);
296 return dbus::Response::FromRawMessage( 296 return dbus::Response::FromRawMessage(
297 dbus_message_copy(response_->raw_message())); 297 dbus_message_copy(response_->raw_message()));
298 } 298 }
299 299
300 } // namespace chromeos 300 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698