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

Unified Diff: chrome/test/in_process_browser_test.cc

Issue 6596020: Reorganize CommandLine code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 9 years, 10 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 | « chrome/test/in_process_browser_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/in_process_browser_test.cc
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index 45cb676e6b67ffae68714d2b3795c41f514f01c3..9fed5227ca310859046a1684dd531d3f2a168e09 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -74,8 +74,7 @@ InProcessBrowserTest::InProcessBrowserTest()
: browser_(NULL),
show_window_(false),
dom_automation_enabled_(false),
- tab_closeable_state_watcher_enabled_(false),
- original_single_process_(false) {
+ tab_closeable_state_watcher_enabled_(false) {
#if defined(OS_MACOSX)
base::mac::SetOverrideAmIBundled(true);
#endif
@@ -99,14 +98,6 @@ InProcessBrowserTest::~InProcessBrowserTest() {
}
void InProcessBrowserTest::SetUp() {
- // Remember the command line. Normally this doesn't matter, because the test
- // harness creates a new process for each test, but when the test harness is
- // running in single process mode, we can't let one test's command-line
- // changes (e.g. enabling DOM automation) affect other tests.
- // TODO(phajdan.jr): This save/restore logic is unnecessary. Remove it.
- CommandLine* command_line = CommandLine::ForCurrentProcessMutable();
- original_command_line_.reset(new CommandLine(*command_line));
-
// Create a temporary user data directory if required.
ASSERT_TRUE(CreateUserDataDirectory())
<< "Could not create user data directory.";
@@ -126,16 +117,13 @@ void InProcessBrowserTest::SetUp() {
// bundle we'll crash.
browser_shutdown::delete_resources_on_shutdown = false;
- // Allow subclasses the opportunity to make changes to the command line before
- // running any tests.
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ // Allow subclasses to change the command line before running any tests.
SetUpCommandLine(command_line);
// Add command line arguments that are used by all InProcessBrowserTests.
PrepareTestCommandLine(command_line);
- // Save the single process mode state before it was reset in this test. This
- // state will be recovered in TearDown(). Single-process mode is not set in
- // BrowserMain so it needs to be processed explicitly.
- original_single_process_ = RenderProcessHost::run_renderer_in_process();
+ // Single-process mode is not set in BrowserMain, so process it explicitly.
if (command_line->HasSwitch(switches::kSingleProcess))
RenderProcessHost::set_run_renderer_in_process(true);
@@ -170,8 +158,7 @@ void InProcessBrowserTest::SetUp() {
TearDownInProcessBrowserTestFixture();
}
-void InProcessBrowserTest::PrepareTestCommandLine(
- CommandLine* command_line) {
+void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) {
// Propagate commandline settings from test_launcher_utils.
test_launcher_utils::PrepareBrowserCommandLineForTests(command_line);
@@ -216,7 +203,7 @@ void InProcessBrowserTest::PrepareTestCommandLine(
}
bool InProcessBrowserTest::CreateUserDataDirectory() {
- CommandLine* command_line = CommandLine::ForCurrentProcessMutable();
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
FilePath user_data_dir =
command_line->GetSwitchValuePath(switches::kUserDataDir);
if (user_data_dir.empty()) {
@@ -242,9 +229,6 @@ void InProcessBrowserTest::TearDown() {
#if defined(OS_WIN)
BrowserView::SetShowState(-1);
#endif
-
- *CommandLine::ForCurrentProcessMutable() = *original_command_line_;
- RenderProcessHost::set_run_renderer_in_process(original_single_process_);
}
void InProcessBrowserTest::AddTabAtIndexToBrowser(
« no previous file with comments | « chrome/test/in_process_browser_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698