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

Side by Side Diff: tools/json_schema_compiler/test/test_util.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "tools/json_schema_compiler/test/test_util.h" 5 #include "tools/json_schema_compiler/test/test_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 12
13 namespace json_schema_compiler { 13 namespace json_schema_compiler {
14 namespace test_util { 14 namespace test_util {
15 15
16 std::unique_ptr<base::Value> ReadJson(const base::StringPiece& json) { 16 std::unique_ptr<base::Value> ReadJson(const base::StringPiece& json) {
17 int error_code; 17 int error_code;
18 std::string error_msg; 18 std::string error_msg;
19 std::unique_ptr<base::Value> result(base::JSONReader::ReadAndReturnError( 19 std::unique_ptr<base::Value> result(base::JSONReader::ReadAndReturnError(
20 json, base::JSON_ALLOW_TRAILING_COMMAS, &error_code, &error_msg)); 20 json, base::JSON_ALLOW_TRAILING_COMMAS, &error_code, &error_msg));
21 // CHECK not ASSERT since passing invalid |json| is a test error. 21 // Crash on failure since passing invalid |json| is a test error.
22 CHECK(result) << error_msg; 22 LOG_IF(FATAL, !result) << error_msg;
23 return result; 23 return result;
24 } 24 }
25 25
26 std::unique_ptr<base::ListValue> List(base::Value* a) { 26 std::unique_ptr<base::ListValue> List(base::Value* a) {
27 std::unique_ptr<base::ListValue> list(new base::ListValue()); 27 std::unique_ptr<base::ListValue> list(new base::ListValue());
28 list->Append(base::WrapUnique(a)); 28 list->Append(base::WrapUnique(a));
29 return list; 29 return list;
30 } 30 }
31 std::unique_ptr<base::ListValue> List(base::Value* a, base::Value* b) { 31 std::unique_ptr<base::ListValue> List(base::Value* a, base::Value* b) {
32 std::unique_ptr<base::ListValue> list = List(a); 32 std::unique_ptr<base::ListValue> list = List(a);
(...skipping 28 matching lines...) Expand all
61 base::Value* bv, 61 base::Value* bv,
62 const std::string& ck, 62 const std::string& ck,
63 base::Value* cv) { 63 base::Value* cv) {
64 std::unique_ptr<base::DictionaryValue> dict = Dictionary(ak, av, bk, bv); 64 std::unique_ptr<base::DictionaryValue> dict = Dictionary(ak, av, bk, bv);
65 dict->SetWithoutPathExpansion(ck, cv); 65 dict->SetWithoutPathExpansion(ck, cv);
66 return dict; 66 return dict;
67 } 67 }
68 68
69 } // namespace test_util 69 } // namespace test_util
70 } // namespace json_schema_compiler 70 } // namespace json_schema_compiler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698