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

Side by Side Diff: base/test/launcher/test_results_tracker.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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
« no previous file with comments | « base/test/launcher/test_launcher.cc ('k') | base/test/test_discardable_memory_allocator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/test/launcher/test_results_tracker.h" 5 #include "base/test/launcher/test_results_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 fprintf(stdout, "End of the summary.\n"); 218 fprintf(stdout, "End of the summary.\n");
219 fflush(stdout); 219 fflush(stdout);
220 } 220 }
221 221
222 void TestResultsTracker::AddGlobalTag(const std::string& tag) { 222 void TestResultsTracker::AddGlobalTag(const std::string& tag) {
223 global_tags_.insert(tag); 223 global_tags_.insert(tag);
224 } 224 }
225 225
226 bool TestResultsTracker::SaveSummaryAsJSON(const FilePath& path) const { 226 bool TestResultsTracker::SaveSummaryAsJSON(const FilePath& path) const {
227 scoped_ptr<DictionaryValue> summary_root(new DictionaryValue); 227 std::unique_ptr<DictionaryValue> summary_root(new DictionaryValue);
228 228
229 scoped_ptr<ListValue> global_tags(new ListValue); 229 std::unique_ptr<ListValue> global_tags(new ListValue);
230 for (const auto& global_tag : global_tags_) { 230 for (const auto& global_tag : global_tags_) {
231 global_tags->AppendString(global_tag); 231 global_tags->AppendString(global_tag);
232 } 232 }
233 summary_root->Set("global_tags", std::move(global_tags)); 233 summary_root->Set("global_tags", std::move(global_tags));
234 234
235 scoped_ptr<ListValue> all_tests(new ListValue); 235 std::unique_ptr<ListValue> all_tests(new ListValue);
236 for (const auto& test : all_tests_) { 236 for (const auto& test : all_tests_) {
237 all_tests->AppendString(test); 237 all_tests->AppendString(test);
238 } 238 }
239 summary_root->Set("all_tests", std::move(all_tests)); 239 summary_root->Set("all_tests", std::move(all_tests));
240 240
241 scoped_ptr<ListValue> disabled_tests(new ListValue); 241 std::unique_ptr<ListValue> disabled_tests(new ListValue);
242 for (const auto& disabled_test : disabled_tests_) { 242 for (const auto& disabled_test : disabled_tests_) {
243 disabled_tests->AppendString(disabled_test); 243 disabled_tests->AppendString(disabled_test);
244 } 244 }
245 summary_root->Set("disabled_tests", std::move(disabled_tests)); 245 summary_root->Set("disabled_tests", std::move(disabled_tests));
246 246
247 scoped_ptr<ListValue> per_iteration_data(new ListValue); 247 std::unique_ptr<ListValue> per_iteration_data(new ListValue);
248 248
249 for (int i = 0; i <= iteration_; i++) { 249 for (int i = 0; i <= iteration_; i++) {
250 scoped_ptr<DictionaryValue> current_iteration_data(new DictionaryValue); 250 std::unique_ptr<DictionaryValue> current_iteration_data(
251 new DictionaryValue);
251 252
252 for (PerIterationData::ResultsMap::const_iterator j = 253 for (PerIterationData::ResultsMap::const_iterator j =
253 per_iteration_data_[i].results.begin(); 254 per_iteration_data_[i].results.begin();
254 j != per_iteration_data_[i].results.end(); 255 j != per_iteration_data_[i].results.end();
255 ++j) { 256 ++j) {
256 scoped_ptr<ListValue> test_results(new ListValue); 257 std::unique_ptr<ListValue> test_results(new ListValue);
257 258
258 for (size_t k = 0; k < j->second.test_results.size(); k++) { 259 for (size_t k = 0; k < j->second.test_results.size(); k++) {
259 const TestResult& test_result = j->second.test_results[k]; 260 const TestResult& test_result = j->second.test_results[k];
260 261
261 scoped_ptr<DictionaryValue> test_result_value(new DictionaryValue); 262 std::unique_ptr<DictionaryValue> test_result_value(new DictionaryValue);
262 263
263 test_result_value->SetString("status", test_result.StatusAsString()); 264 test_result_value->SetString("status", test_result.StatusAsString());
264 test_result_value->SetInteger( 265 test_result_value->SetInteger(
265 "elapsed_time_ms", 266 "elapsed_time_ms",
266 static_cast<int>(test_result.elapsed_time.InMilliseconds())); 267 static_cast<int>(test_result.elapsed_time.InMilliseconds()));
267 268
268 bool lossless_snippet = false; 269 bool lossless_snippet = false;
269 if (IsStringUTF8(test_result.output_snippet)) { 270 if (IsStringUTF8(test_result.output_snippet)) {
270 test_result_value->SetString( 271 test_result_value->SetString(
271 "output_snippet", test_result.output_snippet); 272 "output_snippet", test_result.output_snippet);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 TestResultsTracker::PerIterationData::PerIterationData() { 368 TestResultsTracker::PerIterationData::PerIterationData() {
368 } 369 }
369 370
370 TestResultsTracker::PerIterationData::PerIterationData( 371 TestResultsTracker::PerIterationData::PerIterationData(
371 const PerIterationData& other) = default; 372 const PerIterationData& other) = default;
372 373
373 TestResultsTracker::PerIterationData::~PerIterationData() { 374 TestResultsTracker::PerIterationData::~PerIterationData() {
374 } 375 }
375 376
376 } // namespace base 377 } // namespace base
OLDNEW
« no previous file with comments | « base/test/launcher/test_launcher.cc ('k') | base/test/test_discardable_memory_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698