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

Unified Diff: mojo/public/cpp/application/lib/application_test_base.cc

Issue 1983263002: Replace ApplicationImpl::CreateApplicationConnector() with a standalone helper function. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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/public/cpp/application/lib/application_impl.cc ('k') | mojo/public/cpp/application/lib/connect.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 42519a2ce7675be8046597ec1a11e45efa9d60e0..f316daab0a446120fb26348a09a6b51a93d12ed7 100644
--- a/mojo/public/cpp/application/lib/application_test_base.cc
+++ b/mojo/public/cpp/application/lib/application_test_base.cc
@@ -16,6 +16,7 @@ namespace mojo {
namespace test {
namespace {
+
// Share the application command-line arguments with multiple application tests.
Array<String> g_args;
@@ -31,11 +32,11 @@ InterfaceRequest<Application> g_application_request;
// calls so we can (re-)initialize new ApplicationImpls.
ShellPtr g_shell;
-void InitializeArgs(int argc, std::vector<const char*> argv) {
+void InitializeArgs(int argc, const char** argv) {
MOJO_CHECK(g_args.is_null());
- for (const char* arg : argv) {
- if (arg)
- g_args.push_back(arg);
+ for (int i = 0; i < argc; i++) {
+ MOJO_CHECK(argv[i]);
+ g_args.push_back(argv[i]);
}
}
@@ -107,8 +108,9 @@ MojoResult RunAllTests(MojoHandle application_request_handle) {
argv[i] = args[i].get().c_str();
argv[argc] = nullptr;
- testing::InitGoogleTest(&argc, const_cast<char**>(&(argv[0])));
- InitializeArgs(argc, argv);
+ // Note: |InitGoogleTest()| will modify |argc| and |argv[...]|.
+ testing::InitGoogleTest(&argc, const_cast<char**>(&argv[0]));
+ InitializeArgs(argc, &argv[0]);
Environment::DestroyDefaultRunLoop();
}
« no previous file with comments | « mojo/public/cpp/application/lib/application_impl.cc ('k') | mojo/public/cpp/application/lib/connect.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698