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

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

Issue 2606153003: Report failed expect/assert to test launcher summary output. (Closed)
Patch Set: Fix review issues. Created 3 years, 11 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_result.cc ('k') | no next file » | 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 test_result_value->SetBoolean("losless_snippet", lossless_snippet); 365 test_result_value->SetBoolean("losless_snippet", lossless_snippet);
366 366
367 // Also include the raw version (base64-encoded so that it can be safely 367 // Also include the raw version (base64-encoded so that it can be safely
368 // JSON-serialized - there are no guarantees about character encoding 368 // JSON-serialized - there are no guarantees about character encoding
369 // of the snippet). This can be very useful piece of information when 369 // of the snippet). This can be very useful piece of information when
370 // debugging a test failure related to character encoding. 370 // debugging a test failure related to character encoding.
371 std::string base64_output_snippet; 371 std::string base64_output_snippet;
372 Base64Encode(test_result.output_snippet, &base64_output_snippet); 372 Base64Encode(test_result.output_snippet, &base64_output_snippet);
373 test_result_value->SetString("output_snippet_base64", 373 test_result_value->SetString("output_snippet_base64",
374 base64_output_snippet); 374 base64_output_snippet);
375
376 std::unique_ptr<ListValue> test_result_parts(new ListValue);
377 for (const TestResultPart& result_part :
378 test_result.test_result_parts) {
379 std::unique_ptr<DictionaryValue> result_part_value(
380 new DictionaryValue);
381 result_part_value->SetString("type", result_part.TypeAsString());
382 result_part_value->SetString("file", result_part.file_name);
383 result_part_value->SetInteger("line", result_part.line_number);
384 if (IsStringUTF8(result_part.summary)) {
385 result_part_value->SetString("summary", result_part.summary);
386 }
387
388 std::string encoded_summary;
389 Base64Encode(result_part.summary, &encoded_summary);
390 result_part_value->SetString("summary_base64", encoded_summary);
391
392 if (IsStringUTF8(result_part.message)) {
393 result_part_value->SetString("message", result_part.message);
Paweł Hajdan Jr. 2017/01/02 09:21:37 Same here.
alex-ac 2017/01/03 08:28:59 Done.
394 }
395
396 std::string encoded_message;
397 Base64Encode(result_part.message, &encoded_message);
398 result_part_value->SetString("message_base64", encoded_message);
399
400 test_result_parts->Append(std::move(result_part_value));
401 }
402 test_result_value->Set("result_parts", std::move(test_result_parts));
403
375 test_results->Append(std::move(test_result_value)); 404 test_results->Append(std::move(test_result_value));
376 } 405 }
377 406
378 current_iteration_data->SetWithoutPathExpansion(j->first, 407 current_iteration_data->SetWithoutPathExpansion(j->first,
379 std::move(test_results)); 408 std::move(test_results));
380 } 409 }
381 per_iteration_data->Append(std::move(current_iteration_data)); 410 per_iteration_data->Append(std::move(current_iteration_data));
382 } 411 }
383 summary_root->Set("per_iteration_data", std::move(per_iteration_data)); 412 summary_root->Set("per_iteration_data", std::move(per_iteration_data));
384 413
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 TestResultsTracker::PerIterationData::PerIterationData() { 492 TestResultsTracker::PerIterationData::PerIterationData() {
464 } 493 }
465 494
466 TestResultsTracker::PerIterationData::PerIterationData( 495 TestResultsTracker::PerIterationData::PerIterationData(
467 const PerIterationData& other) = default; 496 const PerIterationData& other) = default;
468 497
469 TestResultsTracker::PerIterationData::~PerIterationData() { 498 TestResultsTracker::PerIterationData::~PerIterationData() {
470 } 499 }
471 500
472 } // namespace base 501 } // namespace base
OLDNEW
« no previous file with comments | « base/test/launcher/test_result.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698