Index: mojo/public/cpp/application/lib/application_test_base.cc |
diff --git a/mojo/public/cpp/application/lib/application_test_base.cc b/mojo/public/cpp/application/lib/application_test_base.cc |
index 42dbda550f70dd04e97bf2680a718a05de23995d..ab100ccfc86dd2b55c3d95e6cdfb0b98ee791c26 100644 |
--- a/mojo/public/cpp/application/lib/application_test_base.cc |
+++ b/mojo/public/cpp/application/lib/application_test_base.cc |
@@ -17,6 +17,9 @@ namespace { |
// This shell handle is shared by multiple test application instances. |
MessagePipeHandle g_shell_handle; |
+// Command-line args passed to the harness are available to any test |
msw
2014/11/20 21:59:12
The args are actually passed to the test applicati
|
+// application instance. |
+Array<String> g_args; |
} // namespace |
@@ -33,6 +36,18 @@ void SetShellHandle(ScopedMessagePipeHandle handle) { |
g_shell_handle = handle.release(); |
} |
+const Array<String>& Args() { |
msw
2014/11/20 21:59:12
nit: can this be inlined in the header as args()?
Chris Masone
2014/11/20 23:35:19
I actually don't think so, as g_args is defined on
msw
2014/11/22 18:23:38
Acknowledged.
|
+ return g_args; |
+} |
+ |
+void InitializeArgs(int argc, std::vector<const char*> argv) { |
+ MOJO_CHECK(g_args.is_null()); |
+ for (const char* arg : argv) { |
+ if (arg) |
msw
2014/11/20 21:59:12
When are these ever null?
Chris Masone
2014/11/20 23:35:19
After processing by the gtest library, the last ar
msw
2014/11/22 18:23:38
Ah, OK. This is fine as-is.
|
+ g_args.push_back(arg); |
+ } |
+} |
+ |
ApplicationTestBase::ApplicationTestBase(Array<String> args) |
: args_(args.Pass()), application_impl_(nullptr) { |
} |