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

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

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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
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 "chromeos/network/shill_property_util.h" 10 #include "chromeos/network/shill_property_util.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ValueMatcher::ValueMatcher(const base::Value& value) 47 ValueMatcher::ValueMatcher(const base::Value& value)
48 : expected_value_(value.DeepCopy()) {} 48 : expected_value_(value.DeepCopy()) {}
49 49
50 bool ValueMatcher::MatchAndExplain(const base::Value& value, 50 bool ValueMatcher::MatchAndExplain(const base::Value& value,
51 MatchResultListener* listener) const { 51 MatchResultListener* listener) const {
52 return expected_value_->Equals(&value); 52 return expected_value_->Equals(&value);
53 } 53 }
54 54
55 void ValueMatcher::DescribeTo(::std::ostream* os) const { 55 void ValueMatcher::DescribeTo(::std::ostream* os) const {
56 std::string expected_value_str; 56 std::string expected_value_str;
57 base::JSONWriter::WriteWithOptions(expected_value_.get(), 57 base::JSONWriter::WriteWithOptions(*expected_value_,
58 base::JSONWriter::OPTIONS_PRETTY_PRINT, 58 base::JSONWriter::OPTIONS_PRETTY_PRINT,
59 &expected_value_str); 59 &expected_value_str);
60 *os << "value equals " << expected_value_str; 60 *os << "value equals " << expected_value_str;
61 } 61 }
62 62
63 void ValueMatcher::DescribeNegationTo(::std::ostream* os) const { 63 void ValueMatcher::DescribeNegationTo(::std::ostream* os) const {
64 std::string expected_value_str; 64 std::string expected_value_str;
65 base::JSONWriter::WriteWithOptions(expected_value_.get(), 65 base::JSONWriter::WriteWithOptions(*expected_value_,
66 base::JSONWriter::OPTIONS_PRETTY_PRINT, 66 base::JSONWriter::OPTIONS_PRETTY_PRINT,
67 &expected_value_str); 67 &expected_value_str);
68 *os << "value does not equal " << expected_value_str; 68 *os << "value does not equal " << expected_value_str;
69 } 69 }
70 70
71 71
72 ShillClientUnittestBase::MockClosure::MockClosure() {} 72 ShillClientUnittestBase::MockClosure::MockClosure() {}
73 73
74 ShillClientUnittestBase::MockClosure::~MockClosure() {} 74 ShillClientUnittestBase::MockClosure::~MockClosure() {}
75 75
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 const std::string& expected_result, 386 const std::string& expected_result,
387 const std::string& result) { 387 const std::string& result) {
388 EXPECT_EQ(expected_result, result); 388 EXPECT_EQ(expected_result, result);
389 } 389 }
390 390
391 // static 391 // static
392 void ShillClientUnittestBase::ExpectDictionaryValueResultWithoutStatus( 392 void ShillClientUnittestBase::ExpectDictionaryValueResultWithoutStatus(
393 const base::DictionaryValue* expected_result, 393 const base::DictionaryValue* expected_result,
394 const base::DictionaryValue& result) { 394 const base::DictionaryValue& result) {
395 std::string expected_result_string; 395 std::string expected_result_string;
396 base::JSONWriter::Write(expected_result, &expected_result_string); 396 base::JSONWriter::Write(*expected_result, &expected_result_string);
397 std::string result_string; 397 std::string result_string;
398 base::JSONWriter::Write(&result, &result_string); 398 base::JSONWriter::Write(result, &result_string);
399 EXPECT_EQ(expected_result_string, result_string); 399 EXPECT_EQ(expected_result_string, result_string);
400 } 400 }
401 401
402 // static 402 // static
403 void ShillClientUnittestBase::ExpectDictionaryValueResult( 403 void ShillClientUnittestBase::ExpectDictionaryValueResult(
404 const base::DictionaryValue* expected_result, 404 const base::DictionaryValue* expected_result,
405 DBusMethodCallStatus call_status, 405 DBusMethodCallStatus call_status,
406 const base::DictionaryValue& result) { 406 const base::DictionaryValue& result) {
407 EXPECT_EQ(DBUS_METHOD_CALL_SUCCESS, call_status); 407 EXPECT_EQ(DBUS_METHOD_CALL_SUCCESS, call_status);
408 ExpectDictionaryValueResultWithoutStatus(expected_result, result); 408 ExpectDictionaryValueResultWithoutStatus(expected_result, result);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 464
465 void ShillClientUnittestBase::OnCallMethodWithErrorCallback( 465 void ShillClientUnittestBase::OnCallMethodWithErrorCallback(
466 dbus::MethodCall* method_call, 466 dbus::MethodCall* method_call,
467 int timeout_ms, 467 int timeout_ms,
468 const dbus::ObjectProxy::ResponseCallback& response_callback, 468 const dbus::ObjectProxy::ResponseCallback& response_callback,
469 const dbus::ObjectProxy::ErrorCallback& error_callback) { 469 const dbus::ObjectProxy::ErrorCallback& error_callback) {
470 OnCallMethod(method_call, timeout_ms, response_callback); 470 OnCallMethod(method_call, timeout_ms, response_callback);
471 } 471 }
472 472
473 } // namespace chromeos 473 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/server/http_handler_unittest.cc ('k') | chromeos/network/network_configuration_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698