| 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 |
| 385 bool lossless_summary = IsStringUTF8(result_part.summary); |
| 386 if (lossless_summary) { |
| 387 result_part_value->SetString("summary", result_part.summary); |
| 388 } else { |
| 389 result_part_value->SetString( |
| 390 "summary", "<non-UTF-8 snippet, see summary_base64>"); |
| 391 } |
| 392 result_part_value->SetBoolean("lossless_summary", lossless_summary); |
| 393 |
| 394 std::string encoded_summary; |
| 395 Base64Encode(result_part.summary, &encoded_summary); |
| 396 result_part_value->SetString("summary_base64", encoded_summary); |
| 397 |
| 398 bool lossless_message = IsStringUTF8(result_part.message); |
| 399 if (lossless_message) { |
| 400 result_part_value->SetString("message", result_part.message); |
| 401 } else { |
| 402 result_part_value->SetString( |
| 403 "message", "<non-UTF-8 snippet, see message_base64>"); |
| 404 } |
| 405 result_part_value->SetBoolean("lossless_message", lossless_message); |
| 406 |
| 407 std::string encoded_message; |
| 408 Base64Encode(result_part.message, &encoded_message); |
| 409 result_part_value->SetString("message_base64", encoded_message); |
| 410 |
| 411 test_result_parts->Append(std::move(result_part_value)); |
| 412 } |
| 413 test_result_value->Set("result_parts", std::move(test_result_parts)); |
| 414 |
| 375 test_results->Append(std::move(test_result_value)); | 415 test_results->Append(std::move(test_result_value)); |
| 376 } | 416 } |
| 377 | 417 |
| 378 current_iteration_data->SetWithoutPathExpansion(j->first, | 418 current_iteration_data->SetWithoutPathExpansion(j->first, |
| 379 std::move(test_results)); | 419 std::move(test_results)); |
| 380 } | 420 } |
| 381 per_iteration_data->Append(std::move(current_iteration_data)); | 421 per_iteration_data->Append(std::move(current_iteration_data)); |
| 382 } | 422 } |
| 383 summary_root->Set("per_iteration_data", std::move(per_iteration_data)); | 423 summary_root->Set("per_iteration_data", std::move(per_iteration_data)); |
| 384 | 424 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 TestResultsTracker::PerIterationData::PerIterationData() { | 503 TestResultsTracker::PerIterationData::PerIterationData() { |
| 464 } | 504 } |
| 465 | 505 |
| 466 TestResultsTracker::PerIterationData::PerIterationData( | 506 TestResultsTracker::PerIterationData::PerIterationData( |
| 467 const PerIterationData& other) = default; | 507 const PerIterationData& other) = default; |
| 468 | 508 |
| 469 TestResultsTracker::PerIterationData::~PerIterationData() { | 509 TestResultsTracker::PerIterationData::~PerIterationData() { |
| 470 } | 510 } |
| 471 | 511 |
| 472 } // namespace base | 512 } // namespace base |
| OLD | NEW |