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

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

Issue 2045303002: Update to Chromium //base at Chromium commit 3e81715e6d3a4324362635aea46ce1f1a163cca1. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/domokit/base@master
Patch Set: Created 4 years, 6 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 | « test/launcher/test_launcher.cc ('k') | test/launcher/unit_test_launcher.cc » ('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 "base/base64.h" 7 #include "base/base64.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 for (size_t k = 0; k < j->second.test_results.size(); k++) { 256 for (size_t k = 0; k < j->second.test_results.size(); k++) {
257 const TestResult& test_result = j->second.test_results[k]; 257 const TestResult& test_result = j->second.test_results[k];
258 258
259 scoped_ptr<DictionaryValue> test_result_value(new DictionaryValue); 259 scoped_ptr<DictionaryValue> test_result_value(new DictionaryValue);
260 260
261 test_result_value->SetString("status", test_result.StatusAsString()); 261 test_result_value->SetString("status", test_result.StatusAsString());
262 test_result_value->SetInteger( 262 test_result_value->SetInteger(
263 "elapsed_time_ms", 263 "elapsed_time_ms",
264 static_cast<int>(test_result.elapsed_time.InMilliseconds())); 264 static_cast<int>(test_result.elapsed_time.InMilliseconds()));
265 265
266 // There are no guarantees about character encoding of the output 266 bool lossless_snippet = false;
267 // snippet. Escape it and record whether it was losless. 267 if (IsStringUTF8(test_result.output_snippet)) {
268 // It's useful to have the output snippet as string in the summary 268 test_result_value->SetString("output_snippet",
269 // for easy viewing. 269 test_result.output_snippet);
270 std::string escaped_output_snippet; 270 lossless_snippet = true;
271 bool losless_snippet = EscapeJSONString( 271 } else {
272 test_result.output_snippet, false, &escaped_output_snippet); 272 test_result_value->SetString(
273 test_result_value->SetString("output_snippet", 273 "output_snippet",
274 escaped_output_snippet); 274 "<non-UTF-8 snippet, see output_snippet_base64>");
275 test_result_value->SetBoolean("losless_snippet", losless_snippet); 275 }
276
277 // TODO(phajdan.jr): Fix typo in JSON key (losless -> lossless)
278 // making sure not to break any consumers of this data.
279 test_result_value->SetBoolean("losless_snippet", lossless_snippet);
276 280
277 // Also include the raw version (base64-encoded so that it can be safely 281 // Also include the raw version (base64-encoded so that it can be safely
278 // JSON-serialized - there are no guarantees about character encoding 282 // JSON-serialized - there are no guarantees about character encoding
279 // of the snippet). This can be very useful piece of information when 283 // of the snippet). This can be very useful piece of information when
280 // debugging a test failure related to character encoding. 284 // debugging a test failure related to character encoding.
281 std::string base64_output_snippet; 285 std::string base64_output_snippet;
282 Base64Encode(test_result.output_snippet, &base64_output_snippet); 286 Base64Encode(test_result.output_snippet, &base64_output_snippet);
283 test_result_value->SetString("output_snippet_base64", 287 test_result_value->SetString("output_snippet_base64",
284 base64_output_snippet); 288 base64_output_snippet);
285 test_results->Append(test_result_value.Pass()); 289 test_results->Append(test_result_value.Pass());
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 TestResultsTracker::AggregateTestResult::~AggregateTestResult() { 352 TestResultsTracker::AggregateTestResult::~AggregateTestResult() {
349 } 353 }
350 354
351 TestResultsTracker::PerIterationData::PerIterationData() { 355 TestResultsTracker::PerIterationData::PerIterationData() {
352 } 356 }
353 357
354 TestResultsTracker::PerIterationData::~PerIterationData() { 358 TestResultsTracker::PerIterationData::~PerIterationData() {
355 } 359 }
356 360
357 } // namespace base 361 } // namespace base
OLDNEW
« no previous file with comments | « test/launcher/test_launcher.cc ('k') | test/launcher/unit_test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698