Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: mojo/examples/apptest/example_apptest.cc

Issue 626033003: Plumb commandline arguments for mojo_example_apptests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@example_apptests_init
Patch Set: Cleanup. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698