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

Side by Side Diff: components/display_compositor/yuv_readback_unittest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/json/json_reader.h" 5 #include "base/json/json_reader.h"
6 #include "base/memory/ref_counted_memory.h" 6 #include "base/memory/ref_counted_memory.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/test/launcher/unit_test_launcher.h" 9 #include "base/test/launcher/unit_test_launcher.h"
10 #include "base/test/test_suite.h" 10 #include "base/test/test_suite.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 base::RunLoop run_loop; 91 base::RunLoop run_loop;
92 base::trace_event::TraceLog::GetInstance()->Flush( 92 base::trace_event::TraceLog::GetInstance()->Flush(
93 base::Bind(&YUVReadbackTest::TraceDataCB, run_loop.QuitClosure(), 93 base::Bind(&YUVReadbackTest::TraceDataCB, run_loop.QuitClosure(),
94 base::Unretained(&json_data))); 94 base::Unretained(&json_data)));
95 run_loop.Run(); 95 run_loop.Run();
96 json_data.append("]"); 96 json_data.append("]");
97 97
98 std::string error_msg; 98 std::string error_msg;
99 std::unique_ptr<base::Value> trace_data = 99 std::unique_ptr<base::Value> trace_data =
100 base::JSONReader::ReadAndReturnError(json_data, 0, NULL, &error_msg); 100 base::JSONReader::ReadAndReturnError(json_data, 0, NULL, &error_msg);
101 CHECK(trace_data) << "JSON parsing failed (" << error_msg 101 ASSERT_TRUE(trace_data) << "JSON parsing failed (" << error_msg
102 << ") JSON data:" << std::endl 102 << ") JSON data:" << std::endl
103 << json_data; 103 << json_data;
104 104
105 base::ListValue* list; 105 base::ListValue* list;
106 CHECK(trace_data->GetAsList(&list)); 106 ASSERT_TRUE(trace_data->GetAsList(&list));
107 for (size_t i = 0; i < list->GetSize(); i++) { 107 for (size_t i = 0; i < list->GetSize(); i++) {
108 base::Value* item = NULL; 108 base::Value* item = NULL;
109 if (list->Get(i, &item)) { 109 if (list->Get(i, &item)) {
110 base::DictionaryValue* dict; 110 base::DictionaryValue* dict;
111 CHECK(item->GetAsDictionary(&dict)); 111 ASSERT_TRUE(item->GetAsDictionary(&dict));
112 std::string name; 112 std::string name;
113 CHECK(dict->GetString("name", &name)); 113 ASSERT_TRUE(dict->GetString("name", &name));
114 std::string trace_type; 114 std::string trace_type;
115 CHECK(dict->GetString("ph", &trace_type)); 115 ASSERT_TRUE(dict->GetString("ph", &trace_type));
116 // Count all except END traces, as they come in BEGIN/END pairs. 116 // Count all except END traces, as they come in BEGIN/END pairs.
117 if (trace_type != "E" && trace_type != "e") 117 if (trace_type != "E" && trace_type != "e")
118 (*event_counts)[name]++; 118 (*event_counts)[name]++;
119 VLOG(1) << "trace name: " << name; 119 VLOG(1) << "trace name: " << name;
120 } 120 }
121 } 121 }
122 } 122 }
123 123
124 // Look up a single channel value. Works for 4-channel and single channel 124 // Look up a single channel value. Works for 4-channel and single channel
125 // bitmaps. Clamp x/y. 125 // bitmaps. Clamp x/y.
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 INSTANTIATE_TEST_CASE_P( 549 INSTANTIATE_TEST_CASE_P(
550 , 550 ,
551 YUVReadbackPixelTest, 551 YUVReadbackPixelTest,
552 ::testing::Combine( 552 ::testing::Combine(
553 ::testing::Bool(), 553 ::testing::Bool(),
554 ::testing::Bool(), 554 ::testing::Bool(),
555 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes)), 555 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes)),
556 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes)))); 556 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes))));
557 557
558 } // namespace display_compositor 558 } // namespace display_compositor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698