diff options
-rw-r--r-- | media/cast/cast_testing.gypi | 22 | ||||
-rw-r--r-- | media/cast/test/simulator.cc | 41 |
2 files changed, 63 insertions, 0 deletions
diff --git a/media/cast/cast_testing.gypi b/media/cast/cast_testing.gypi index aef0fbd..31ed3f0 100644 --- a/media/cast/cast_testing.gypi +++ b/media/cast/cast_testing.gypi @@ -226,6 +226,28 @@ ], }, { + 'target_name': 'cast_simulator', + 'type': 'executable', + 'include_dirs': [ + '<(DEPTH)/', + ], + 'dependencies': [ + 'cast_base', + 'cast_sender', + 'cast_test_utility', + 'cast_transport', + '<(DEPTH)/net/net.gyp:net_test_support', + '<(DEPTH)/media/media.gyp:media', + '<(DEPTH)/testing/gtest.gyp:gtest', + '<(DEPTH)/third_party/ffmpeg/ffmpeg.gyp:ffmpeg', + '<(DEPTH)/third_party/opus/opus.gyp:opus', + '<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry', + ], + 'sources': [ + '<(DEPTH)/media/cast/test/simulator.cc', + ], + }, + { 'target_name': 'generate_barcode_video', 'type': 'executable', 'include_dirs': [ diff --git a/media/cast/test/simulator.cc b/media/cast/test/simulator.cc new file mode 100644 index 0000000..f43ec0a --- /dev/null +++ b/media/cast/test/simulator.cc @@ -0,0 +1,41 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Simulation program. +// Input: +// - File path to writing out the raw event log of the simulation session. +// - Simulation parameters. +// - Unique simulation run ID for tagging the log. +// Output: +// - Raw event log of the simulation session tagged with the unique test ID, +// written out to the specified file path. + +#include "base/at_exit.h" +#include "base/command_line.h" +#include "base/file_util.h" +#include "base/files/file_path.h" +#include "base/files/memory_mapped_file.h" +#include "base/files/scoped_file.h" +#include "base/logging.h" + +const char kSimulationRunId[] = "simulation-run-id"; +const char kOutputPath[] = "output-path"; + +int main(int argc, char** argv) { + base::AtExitManager at_exit; + CommandLine::Init(argc, argv); + InitLogging(logging::LoggingSettings()); + + const CommandLine* cmd = CommandLine::ForCurrentProcess(); + base::FilePath output_path = cmd->GetSwitchValuePath(kOutputPath); + CHECK(!output_path.empty()); + std::string sim_run_id = cmd->GetSwitchValueASCII(kSimulationRunId); + + std::string msg = "Log from simulation run " + sim_run_id; + int ret = base::WriteFile(output_path, &msg[0], msg.size()); + if (ret != static_cast<int>(msg.size())) + VLOG(0) << "Failed to write logs to file."; + + return 0; +} |