summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimcheng@chromium.org <imcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 04:45:44 +0000
committerimcheng@chromium.org <imcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 04:45:44 +0000
commit26d44597b18c64475c2834bb8083adf042afee75 (patch)
tree85683e7291db232839da4366411776472f2ef6d8
parent4efad8f7cee3691157a3396cfeb8831a3272777d (diff)
downloadchromium_src-26d44597b18c64475c2834bb8083adf042afee75.zip
chromium_src-26d44597b18c64475c2834bb8083adf042afee75.tar.gz
chromium_src-26d44597b18c64475c2834bb8083adf042afee75.tar.bz2
[Cast] A really simple skeleton mirror session simulation executable.
The program takes arguments simulation run id (to be used as tags) and a file path and writes out a line to the given file path. The end goal is to also provide simulation parameters and then have the program simulate a session using the parameters, and at the end write out the raw event log to the given path with the given sim run id tag. Review URL: https://codereview.chromium.org/355523002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279587 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--media/cast/cast_testing.gypi22
-rw-r--r--media/cast/test/simulator.cc41
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;
+}