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

Side by Side Diff: chromeos/network/onc/onc_test_utils.cc

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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/network/onc/onc_test_utils.h" 5 #include "chromeos/network/onc/onc_test_utils.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 << kNetworkComponentDirectory << "/" << filename; 50 << kNetworkComponentDirectory << "/" << filename;
51 return dict; 51 return dict;
52 } 52 }
53 53
54 JSONFileValueDeserializer deserializer(path, 54 JSONFileValueDeserializer deserializer(path,
55 base::JSON_ALLOW_TRAILING_COMMAS); 55 base::JSON_ALLOW_TRAILING_COMMAS);
56 56
57 std::string error_message; 57 std::string error_message;
58 std::unique_ptr<base::Value> content = 58 std::unique_ptr<base::Value> content =
59 deserializer.Deserialize(NULL, &error_message); 59 deserializer.Deserialize(NULL, &error_message);
60 CHECK(content != NULL) << "Couldn't json-deserialize file '" 60 CHECK(content != NULL);
61 << filename << "': " << error_message;
62 61
63 dict = base::DictionaryValue::From(std::move(content)); 62 dict = base::DictionaryValue::From(std::move(content));
64 CHECK(dict) << "File '" << filename 63 // File '|filename|' does not contain a dictionary as expected, but type
65 << "' does not contain a dictionary as expected, but type " 64 // |content->GetType()|
66 << content->GetType(); 65 CHECK(dict);
67 return dict; 66 return dict;
68 } 67 }
69 68
70 ::testing::AssertionResult Equals(const base::Value* expected, 69 ::testing::AssertionResult Equals(const base::Value* expected,
71 const base::Value* actual) { 70 const base::Value* actual) {
72 CHECK(expected != NULL); 71 CHECK(expected != NULL);
73 if (actual == NULL) 72 if (actual == NULL)
74 return ::testing::AssertionFailure() << "Actual value pointer is NULL"; 73 return ::testing::AssertionFailure() << "Actual value pointer is NULL";
75 74
76 if (expected->Equals(actual)) 75 if (expected->Equals(actual))
77 return ::testing::AssertionSuccess() << "Values are equal"; 76 return ::testing::AssertionSuccess() << "Values are equal";
78 77
79 return ::testing::AssertionFailure() << "Values are unequal.\n" 78 return ::testing::AssertionFailure() << "Values are unequal.\n"
80 << "Expected value:\n" << *expected 79 << "Expected value:\n" << *expected
81 << "Actual value:\n" << *actual; 80 << "Actual value:\n" << *actual;
82 } 81 }
83 82
84 } // namespace test_utils 83 } // namespace test_utils
85 } // namespace onc 84 } // namespace onc
86 } // namespace chromeos 85 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698