Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 } else { | |
| 387 std::string encoded_summary; | |
| 388 Base64Encode(result_part.summary, &encoded_summary); | |
| 389 result_part_value->SetString("summary_base64", encoded_summary); | |
|
Paweł Hajdan Jr.
2016/12/30 19:02:39
Could you follow pattern for "output_snippet"? Mak
alex-ac
2016/12/30 22:10:20
Done.
Paweł Hajdan Jr.
2017/01/02 09:21:37
Please address the "make the non-encoded key alwa
alex-ac
2017/01/03 08:28:59
Done.
| |
| 390 } | |
| 391 if (IsStringUTF8(result_part.message)) { | |
| 392 result_part_value->SetString("message", result_part.message); | |
| 393 } else { | |
| 394 std::string encoded_message; | |
| 395 Base64Encode(result_part.message, &encoded_message); | |
| 396 result_part_value->SetString("message_base64", encoded_message); | |
| 397 } | |
| 398 test_result_parts->Append(std::move(result_part_value)); | |
| 399 } | |
| 400 test_result_value->Set("result_parts", std::move(test_result_parts)); | |
| 401 | |
| 375 test_results->Append(std::move(test_result_value)); | 402 test_results->Append(std::move(test_result_value)); |
| 376 } | 403 } |
| 377 | 404 |
| 378 current_iteration_data->SetWithoutPathExpansion(j->first, | 405 current_iteration_data->SetWithoutPathExpansion(j->first, |
| 379 std::move(test_results)); | 406 std::move(test_results)); |
| 380 } | 407 } |
| 381 per_iteration_data->Append(std::move(current_iteration_data)); | 408 per_iteration_data->Append(std::move(current_iteration_data)); |
| 382 } | 409 } |
| 383 summary_root->Set("per_iteration_data", std::move(per_iteration_data)); | 410 summary_root->Set("per_iteration_data", std::move(per_iteration_data)); |
| 384 | 411 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 463 TestResultsTracker::PerIterationData::PerIterationData() { | 490 TestResultsTracker::PerIterationData::PerIterationData() { |
| 464 } | 491 } |
| 465 | 492 |
| 466 TestResultsTracker::PerIterationData::PerIterationData( | 493 TestResultsTracker::PerIterationData::PerIterationData( |
| 467 const PerIterationData& other) = default; | 494 const PerIterationData& other) = default; |
| 468 | 495 |
| 469 TestResultsTracker::PerIterationData::~PerIterationData() { | 496 TestResultsTracker::PerIterationData::~PerIterationData() { |
| 470 } | 497 } |
| 471 | 498 |
| 472 } // namespace base | 499 } // namespace base |
| OLD | NEW |