diff --git a/test/test_main.cc b/test/test_main.cc index c6c00c599d..5023ae6558 100644 --- a/test/test_main.cc +++ b/test/test_main.cc @@ -8,8 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include - +#include "rtc_base/file.h" #include "rtc_base/flags.h" #include "rtc_base/logging.h" #include "system_wrappers/include/metrics_default.h" @@ -36,7 +35,7 @@ DEFINE_string(force_fieldtrials, "", " will assign the group Enable to field trial WebRTC-FooFeature."); DEFINE_string( - chartjson_result_file, + perf_results_json_path, "", "Path where the perf results should be stored it the JSON format described " "by " @@ -74,12 +73,13 @@ int main(int argc, char* argv[]) { int exit_code = RUN_ALL_TESTS(); - std::string chartjson_result_file = FLAG_chartjson_result_file; - if (chartjson_result_file != "") { + std::string perf_results_json_path = FLAG_perf_results_json_path; + if (perf_results_json_path != "") { std::string json_results = webrtc::test::GetPerfResultsJSON(); - std::fstream json_file(chartjson_result_file, std::fstream::out); - json_file << json_results; - json_file.close(); + rtc::File json_file = rtc::File::Open(perf_results_json_path); + json_file.Write(reinterpret_cast(json_results.c_str()), + json_results.size()); + json_file.Close(); } return exit_code;