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

Unified Diff: mojo/application/application_test_main_chromium.cc

Issue 1070463003: Initialize command line arguments for Mojo apptests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restoring url-mappings and specifying test apps on the commandline. Created 5 years, 8 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 | « mojo/application/application_runner_chromium.cc ('k') | mojo/services/html_viewer/ax_provider_apptest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/application/application_test_main_chromium.cc
diff --git a/mojo/application/application_test_main_chromium.cc b/mojo/application/application_test_main_chromium.cc
index 4ce761a8a36ffa7a741c862cc82623a30a6f2c7e..75685edcc999c8d8a0568e676a536bb7b59b2152 100644
--- a/mojo/application/application_test_main_chromium.cc
+++ b/mojo/application/application_test_main_chromium.cc
@@ -5,6 +5,7 @@
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/test/test_timeouts.h"
+#include "mojo/application/application_runner_chromium.h"
#include "mojo/public/c/system/main.h"
#include "mojo/public/cpp/application/application_test_base.h"
@@ -12,10 +13,17 @@ MojoResult MojoMain(MojoHandle handle) {
// An AtExitManager instance is needed to construct message loops.
base::AtExitManager at_exit;
- // Initialize test timeouts, which requires CommandLine::ForCurrentProcess().
- // TODO(msw): Plumb relevant command line args before initializing timeouts.
- base::CommandLine::Init(0, nullptr);
+ // Initialize test timeouts, which requires an initialized CommandLine.
+ mojo::ApplicationRunnerChromium::InitBaseCommandLine();
TestTimeouts::Initialize();
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ int argc = 0;
+ const char** argv = new const char* [command_line->argv().size()];
+ for (auto& arg : command_line->argv())
+ argv[argc++] = arg.c_str();
+ // TODO(msw): Avoid calling InitGoogleTest again in mojo::test::RunAllTests.
+ testing::InitGoogleTest(&argc, const_cast<char**>(&(argv[0])));
+
return mojo::test::RunAllTests(handle);
}
« no previous file with comments | « mojo/application/application_runner_chromium.cc ('k') | mojo/services/html_viewer/ax_provider_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698