Index: base/test/launcher/test_results_tracker.cc |
diff --git a/base/test/launcher/test_results_tracker.cc b/base/test/launcher/test_results_tracker.cc |
index 92ee04a4ee3c10de9542611517610c6f699c0aa9..3c7faa32193cb5112f3f95d53eb7e54489ef988f 100644 |
--- a/base/test/launcher/test_results_tracker.cc |
+++ b/base/test/launcher/test_results_tracker.cc |
@@ -262,16 +262,20 @@ bool TestResultsTracker::SaveSummaryAsJSON(const FilePath& path) const { |
"elapsed_time_ms", |
static_cast<int>(test_result.elapsed_time.InMilliseconds())); |
- // There are no guarantees about character encoding of the output |
- // snippet. Escape it and record whether it was losless. |
- // It's useful to have the output snippet as string in the summary |
- // for easy viewing. |
- std::string escaped_output_snippet; |
- bool losless_snippet = EscapeJSONString( |
- test_result.output_snippet, false, &escaped_output_snippet); |
- test_result_value->SetString("output_snippet", |
- escaped_output_snippet); |
- test_result_value->SetBoolean("losless_snippet", losless_snippet); |
+ bool lossless_snippet = false; |
+ if (IsStringUTF8(test_result.output_snippet)) { |
+ test_result_value->SetString( |
+ "output_snippet", test_result.output_snippet); |
+ lossless_snippet = true; |
+ } else { |
+ test_result_value->SetString( |
+ "output_snippet", |
+ "<non-UTF-8 snippet, see output_snippet_base64>"); |
sky
2015/08/27 16:51:56
Actually, one question here, can we escape the str
Paweł Hajdan Jr.
2015/08/28 08:04:24
That's what the previous code was trying to do. Ap
|
+ } |
+ |
+ // TODO(phajdan.jr): Fix typo in JSON key (losless -> lossless) |
+ // making sure not to break any consumers of this data. |
+ test_result_value->SetBoolean("losless_snippet", lossless_snippet); |
// Also include the raw version (base64-encoded so that it can be safely |
// JSON-serialized - there are no guarantees about character encoding |