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

Side by Side Diff: chrome/test/base/mash_browser_tests_main.cc

Issue 2903533003: One BackgroundServerManager per MojoTestState (Closed)
Patch Set: new failure Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/base/mojo_test_connector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/debugger.h" 9 #include "base/debug/debugger.h"
10 #include "base/debug/stack_trace.h" 10 #include "base/debug/stack_trace.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 std::unique_ptr<content::TestState> PreRunTest( 104 std::unique_ptr<content::TestState> PreRunTest(
105 base::CommandLine* command_line, 105 base::CommandLine* command_line,
106 base::TestLauncher::LaunchOptions* test_launch_options) override { 106 base::TestLauncher::LaunchOptions* test_launch_options) override {
107 if (!mojo_test_connector_) { 107 if (!mojo_test_connector_) {
108 mojo_test_connector_ = 108 mojo_test_connector_ =
109 base::MakeUnique<MojoTestConnector>(ReadCatalogManifest(), config_); 109 base::MakeUnique<MojoTestConnector>(ReadCatalogManifest(), config_);
110 mojo_test_connector_->Init(); 110 mojo_test_connector_->Init();
111 } 111 }
112 return mojo_test_connector_->PrepareForTest( 112 return mojo_test_connector_->PrepareForTest(command_line,
113 command_line, test_launch_options, 113 test_launch_options);
114 base::BindOnce(&MashTestLauncherDelegate::OnTestProcessLaunched,
115 base::Unretained(this)));
116 }
117
118 void OnTestProcessLaunched() {
119 // Start default apps after chrome, as they may try to connect to chrome on
120 // startup. Attempt to connect once per test in case a previous test crashed
121 // mash_session.
122 mojo_test_connector_->StartService(mash::session::mojom::kServiceName);
123 } 114 }
124 115
125 void OnDoneRunningTests() override { 116 void OnDoneRunningTests() override {
126 // We have to shutdown this state here, while an AtExitManager is still 117 // We have to shutdown this state here, while an AtExitManager is still
127 // valid. 118 // valid.
128 mojo_test_connector_.reset(); 119 mojo_test_connector_.reset();
129 } 120 }
130 121
131 std::unique_ptr<base::Value> ReadCatalogManifest() { 122 std::unique_ptr<base::Value> ReadCatalogManifest() {
132 std::string catalog_contents; 123 std::string catalog_contents;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 if (command_line->HasSwitch(content::kSingleProcessTestsFlag) && 204 if (command_line->HasSwitch(content::kSingleProcessTestsFlag) &&
214 !command_line->HasSwitch(service_manager::switches::kServicePipeToken)) { 205 !command_line->HasSwitch(service_manager::switches::kServicePipeToken)) {
215 service_manager_connection_factory = 206 service_manager_connection_factory =
216 base::Bind(&CreateServiceManagerConnection, &delegate); 207 base::Bind(&CreateServiceManagerConnection, &delegate);
217 content::ServiceManagerConnection::SetFactoryForTest( 208 content::ServiceManagerConnection::SetFactoryForTest(
218 &service_manager_connection_factory); 209 &service_manager_connection_factory);
219 } 210 }
220 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); 211 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv);
221 return true; 212 return true;
222 } 213 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/base/mojo_test_connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698