Index: mojo/examples/apptest/example_apptest.cc |
diff --git a/mojo/examples/apptest/example_apptest.cc b/mojo/examples/apptest/example_apptest.cc |
index cd1c7d8db665ecbc5425f66c2d86dec826b55b28..a6cf67d4242ac28fd5f4e15011255c3d5cba180b 100644 |
--- a/mojo/examples/apptest/example_apptest.cc |
+++ b/mojo/examples/apptest/example_apptest.cc |
@@ -18,6 +18,8 @@ namespace { |
// TODO(msw): Remove this once we can get ApplicationImpl from TLS. |
mojo::ApplicationImpl* g_application_impl_hack = NULL; |
+static const char kMojoExampleService[] = "mojo:mojo_example_service"; |
+ |
} // namespace |
namespace mojo { |
@@ -27,7 +29,7 @@ namespace { |
class ExampleApptest : public testing::Test { |
public: |
ExampleApptest() { |
- g_application_impl_hack->ConnectToService("mojo:mojo_example_service", |
+ g_application_impl_hack->ConnectToService(kMojoExampleService, |
&example_service_); |
example_service_.set_client(&example_client_); |
} |
@@ -89,10 +91,13 @@ MojoResult MojoMain(MojoHandle shell_handle) { |
g_application_impl_hack = &app; |
MOJO_CHECK(app.WaitForInitialize()); |
- // TODO(msw): Plumb commandline arguments through app->args(). |
- int argc = 0; |
- char** argv = NULL; |
- testing::InitGoogleTest(&argc, argv); |
+ std::vector<std::string> args = app.args().To<std::vector<std::string> >(); |
+ int argc = args.size(); |
+ std::vector<char *> argv(argc); |
+ for (int i = 0; i < argc; ++i) |
hansmuller
2014/10/06 21:08:52
You might want to use size_t instead of int for th
msw
2014/10/06 21:32:33
InitGoogleTest eventually requires an int* :-/
|
+ argv[i] = &args[i][0]; |
+ testing::InitGoogleTest(&argc, argv.data()); |
+ |
mojo_ignore_result(RUN_ALL_TESTS()); |
delete delegate; |