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

Unified Diff: chrome/test/base/in_process_browser_test.cc

Issue 190663012: Run ContentMain in a browser_test's browser process. This removes duplication of code in the browse… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: cleanup Created 6 years, 9 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
Index: chrome/test/base/in_process_browser_test.cc
===================================================================
--- chrome/test/base/in_process_browser_test.cc (revision 257128)
+++ chrome/test/base/in_process_browser_test.cc (working copy)
@@ -75,10 +75,6 @@
// Passed as value of kTestType.
const char kBrowserTestType[] = "browser";
-// Used when running in single-process mode.
-base::LazyInstance<ChromeContentRendererClient>::Leaky
- g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER;
-
// A BrowserListObserver that makes sure that all browsers created are on the
// |allowed_desktop_|.
class SingleDesktopTestObserver : public chrome::BrowserListObserver,
@@ -133,11 +129,17 @@
chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath);
CHECK(PathService::Override(base::FILE_EXE, chrome_path));
#endif // defined(OS_MACOSX)
+
CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
base::FilePath src_dir;
CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir));
- embedded_test_server()->ServeFilesFromDirectory(
- src_dir.AppendASCII("chrome/test/data"));
+ base::FilePath test_data_dir = src_dir.AppendASCII("chrome/test/data");
+ embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
+
+ // chrome::DIR_TEST_DATA isn't going to be setup until after we call
+ // ContentMain. However that is after tests' constructors or SetUp methods,
+ // which sometimes need it. So just override it.
+ CHECK(PathService::Override(chrome::DIR_TEST_DATA, test_data_dir));
}
InProcessBrowserTest::~InProcessBrowserTest() {
@@ -162,13 +164,6 @@
ASSERT_TRUE(SetUpUserDataDirectory())
<< "Could not set up user data directory.";
- // Single-process mode is not set in BrowserMain, so process it explicitly,
- // and set up renderer.
- if (command_line->HasSwitch(switches::kSingleProcess)) {
- content::SetRendererClientForTesting(
- g_chrome_content_renderer_client.Pointer());
- }
-
#if defined(OS_CHROMEOS)
// Make sure that the log directory exists.
base::FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName();

Powered by Google App Engine
This is Rietveld 408576698