summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-21 01:00:22 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-21 01:00:22 +0000
commitbb97536b768ac68fcbc4605c35461a798ef6e5ff (patch)
tree479bde96cd05a9e1f9d2746dd82313e2eb715e8e /chrome/test
parent8731a63268015f4e5d684833c11a1b44bd9ae468 (diff)
downloadchromium_src-bb97536b768ac68fcbc4605c35461a798ef6e5ff.zip
chromium_src-bb97536b768ac68fcbc4605c35461a798ef6e5ff.tar.gz
chromium_src-bb97536b768ac68fcbc4605c35461a798ef6e5ff.tar.bz2
Make CommandLine into a normal object, with some statics for getting at the current process's command line.
One explicit goal of this change is to *not* deal with the string/wstring issues at the API on POSIX; the functions are the same as before, which means they remain as broken as before. (I did try to fix the internals, though, so migrating the callers is now possible by adding platform-appropriate hooks.) Review URL: http://codereview.chromium.org/18248 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8347 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.cc12
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc12
-rw-r--r--chrome/test/memory_test/memory_test.cc15
-rw-r--r--chrome/test/page_cycler/page_cycler_test.cc5
-rw-r--r--chrome/test/plugin/plugin_test.cpp21
-rw-r--r--chrome/test/reliability/reliability_test_suite.h2
-rw-r--r--chrome/test/startup/startup_test.cc2
-rw-r--r--chrome/test/ui/inspector_controller_uitest.cc2
-rw-r--r--chrome/test/ui/omnibox_uitest.cc3
-rw-r--r--chrome/test/ui/sandbox_uitests.cc5
-rw-r--r--chrome/test/ui/ui_test.cc94
-rw-r--r--chrome/test/ui/ui_test.h7
-rw-r--r--chrome/test/ui/ui_test_suite.h2
-rw-r--r--chrome/test/unit/chrome_test_suite.h3
14 files changed, 89 insertions, 96 deletions
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc
index dcbac5b..81d0f0b 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc
@@ -79,7 +79,7 @@ AutomatedUITest::AutomatedUITest()
post_action_delay_(0) {
show_window_ = true;
GetSystemTimeAsFileTime(&test_start_time_);
- CommandLine parsed_command_line;
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
if (parsed_command_line.HasSwitch(kDebugModeSwitch))
debug_logging_enabled_ = true;
if (parsed_command_line.HasSwitch(kWaitSwitch)) {
@@ -95,7 +95,7 @@ AutomatedUITest::AutomatedUITest()
AutomatedUITest::~AutomatedUITest() {}
void AutomatedUITest::RunReproduction() {
- CommandLine parsed_command_line;
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
xml_writer_.StartWriting();
xml_writer_.StartElement("Report");
std::string action_string =
@@ -863,7 +863,7 @@ bool AutomatedUITest::SimulateKeyPressInActiveWindow(wchar_t key, int flags) {
bool AutomatedUITest::InitXMLReader() {
std::wstring input_path;
- CommandLine parsed_command_line;
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
if (parsed_command_line.HasSwitch(kInputFilePathSwitch))
input_path = parsed_command_line.GetSwitchValue(kInputFilePathSwitch);
else
@@ -877,7 +877,7 @@ bool AutomatedUITest::InitXMLReader() {
bool AutomatedUITest::WriteReportToFile() {
std::ofstream error_file;
std::wstring path;
- CommandLine parsed_command_line;
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
if (parsed_command_line.HasSwitch(kOutputFilePathSwitch))
path = parsed_command_line.GetSwitchValue(kOutputFilePathSwitch);
else
@@ -897,7 +897,7 @@ bool AutomatedUITest::WriteReportToFile() {
void AutomatedUITest::AppendToOutputFile(const std::string &append_string) {
std::ofstream error_file;
std::wstring path;
- CommandLine parsed_command_line;
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
if (parsed_command_line.HasSwitch(kOutputFilePathSwitch))
path = parsed_command_line.GetSwitchValue(kOutputFilePathSwitch);
else
@@ -1001,7 +1001,7 @@ bool AutomatedUITest::DidCrash(bool update_total_crashes) {
}
TEST_F(AutomatedUITest, TheOneAndOnlyTest) {
- CommandLine parsed_command_line;
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
if (parsed_command_line.HasSwitch(kReproSwitch))
RunReproduction();
else
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index 33c6a30..add33f4 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -25,9 +25,8 @@ class AutomationProxyTest : public UITest {
protected:
AutomationProxyTest() {
dom_automation_enabled_ = true;
- CommandLine::AppendSwitchWithValue(&launch_arguments_,
- switches::kLang,
- L"en-us");
+ launch_arguments_.AppendSwitchWithValue(switches::kLang,
+ L"en-us");
}
};
@@ -371,7 +370,9 @@ class AutomationProxyTest2 : public AutomationProxyVisibleTest {
document2_ = test_data_directory_;
file_util::AppendToPath(&document2_, L"title2.html");
- launch_arguments_ = document1_ + L" " + document2_;
+ launch_arguments_ = CommandLine(L"");
+ launch_arguments_.AppendLooseValue(document1_);
+ launch_arguments_.AppendLooseValue(document2_);
}
std::wstring document1_;
@@ -576,7 +577,8 @@ class AutomationProxyTest3 : public UITest {
file_util::AppendToPath(&document1_, L"frame_dom_access.html");
dom_automation_enabled_ = true;
- launch_arguments_ = document1_;
+ launch_arguments_ = CommandLine(L"");
+ launch_arguments_.AppendLooseValue(document1_);
}
std::wstring document1_;
diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc
index 23cb072..2ef79d1 100644
--- a/chrome/test/memory_test/memory_test.cc
+++ b/chrome/test/memory_test/memory_test.cc
@@ -32,17 +32,17 @@ class MemoryTest : public UITest {
// For now, turn off plugins because they crash like crazy.
// TODO(mbelshe): Fix Chrome to not crash with plugins.
- CommandLine::AppendSwitch(&launch_arguments_, switches::kDisablePlugins);
+ launch_arguments_.AppendSwitch(switches::kDisablePlugins);
- CommandLine::AppendSwitch(&launch_arguments_, switches::kEnableLogging);
+ launch_arguments_.AppendSwitch(switches::kEnableLogging);
// Use the playback cache, but don't use playback events.
- CommandLine::AppendSwitch(&launch_arguments_, switches::kPlaybackMode);
- CommandLine::AppendSwitch(&launch_arguments_, switches::kNoEvents);
+ launch_arguments_.AppendSwitch(switches::kPlaybackMode);
+ launch_arguments_.AppendSwitch(switches::kNoEvents);
// Get the specified user data dir (optional)
std::wstring profile_dir =
- CommandLine().GetSwitchValue(switches::kUserDataDir);
+ CommandLine::ForCurrentProcess()->GetSwitchValue(switches::kUserDataDir);
if (profile_dir.length() == 0) {
// Compute the user-data-dir which contains our test cache.
@@ -63,9 +63,8 @@ class MemoryTest : public UITest {
}
}
- CommandLine::AppendSwitchWithValue(&launch_arguments_,
- switches::kUserDataDir,
- user_data_dir_);
+ launch_arguments_.AppendSwitchWithValue(switches::kUserDataDir,
+ user_data_dir_);
}
~MemoryTest() {
diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc
index e42cf14..8f5fead 100644
--- a/chrome/test/page_cycler/page_cycler_test.cc
+++ b/chrome/test/page_cycler/page_cycler_test.cc
@@ -38,9 +38,8 @@ class PageCyclerTest : public UITest {
show_window_ = true;
// Expose garbage collection for the page cycler tests.
- CommandLine::AppendSwitchWithValue(&launch_arguments_,
- switches::kJavaScriptFlags,
- L"--expose_gc");
+ launch_arguments_.AppendSwitchWithValue(switches::kJavaScriptFlags,
+ L"--expose_gc");
}
// For HTTP tests, the name must be safe for use in a URL without escaping.
diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp
index d458662..0faaf8e 100644
--- a/chrome/test/plugin/plugin_test.cpp
+++ b/chrome/test/plugin/plugin_test.cpp
@@ -76,27 +76,16 @@ class PluginTest : public UITest {
KEY_WRITE)) {
regkey.CreateKey(L"CHROME.EXE", KEY_READ);
}
- if (!launch_arguments_.empty())
- launch_arguments_.append(L" ");
- launch_arguments_.append(L"--" kNoNativeActiveXShimSwitch);
+ launch_arguments_.AppendSwitch(kNoNativeActiveXShimSwitch);
} else if (strcmp(test_info->name(), "MediaPlayerOld") == 0) {
// When testing the old WMP plugin, we need to force Chrome to not load
// the new plugin.
- if (!launch_arguments_.empty())
- launch_arguments_.append(L" ");
-
- launch_arguments_.append(L"--" kUseOldWMPPluginSwitch);
- launch_arguments_.append(L" ");
- launch_arguments_.append(L"--" kNoNativeActiveXShimSwitch);
+ launch_arguments_.AppendSwitch(kUseOldWMPPluginSwitch);
+ launch_arguments_.AppendSwitch(kNoNativeActiveXShimSwitch);
} else if (strcmp(test_info->name(), "FlashSecurity") == 0) {
- if (!launch_arguments_.empty())
- launch_arguments_.append(L" ");
-
- launch_arguments_.append(L"--");
- launch_arguments_.append(switches::kTestSandbox);
- launch_arguments_.append(L"=");
- launch_arguments_.append(L"security_tests.dll");
+ launch_arguments_.AppendSwitchWithValue(switches::kTestSandbox,
+ L"security_tests.dll");
}
UITest::SetUp();
diff --git a/chrome/test/reliability/reliability_test_suite.h b/chrome/test/reliability/reliability_test_suite.h
index 6170d63..809ca52 100644
--- a/chrome/test/reliability/reliability_test_suite.h
+++ b/chrome/test/reliability/reliability_test_suite.h
@@ -18,7 +18,7 @@ protected:
virtual void Initialize() {
UITestSuite::Initialize();
- SetPageRange(CommandLine());
+ SetPageRange(CommandLine(L""));
}
};
diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc
index 34f91b9..70b54de 100644
--- a/chrome/test/startup/startup_test.cc
+++ b/chrome/test/startup/startup_test.cc
@@ -110,7 +110,7 @@ class StartupFileTest : public StartupTest {
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &file_url));
file_util::AppendToPath(&file_url, L"empty.html");
ASSERT_TRUE(file_util::PathExists(file_url));
- launch_arguments_ += file_url;
+ launch_arguments_.AppendLooseValue(file_url);
pages_ = WideToUTF8(file_url);
}
diff --git a/chrome/test/ui/inspector_controller_uitest.cc b/chrome/test/ui/inspector_controller_uitest.cc
index 29b1489..289cca0 100644
--- a/chrome/test/ui/inspector_controller_uitest.cc
+++ b/chrome/test/ui/inspector_controller_uitest.cc
@@ -34,7 +34,7 @@ TEST_F(InspectorControllerTest, DISABLED_InspectElement) {
if (IsTestCaseDisabled())
return;
- if (CommandLine().HasSwitch(switches::kSingleProcess))
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess))
return;
scoped_refptr<HTTPTestServer> server =
diff --git a/chrome/test/ui/omnibox_uitest.cc b/chrome/test/ui/omnibox_uitest.cc
index 83e14fd..7b317af 100644
--- a/chrome/test/ui/omnibox_uitest.cc
+++ b/chrome/test/ui/omnibox_uitest.cc
@@ -133,7 +133,8 @@ void OmniboxTest::RunQueryChain(const std::wstring& input_text) {
// </omnibox_tests>
TEST_F(OmniboxTest, Measure) {
- if (!CommandLine().HasSwitch(kRunOmniboxTest)) return;
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunOmniboxTest))
+ return;
std::wstring omnibox_tests_path;
PathService::Get(chrome::DIR_TEST_DATA, &omnibox_tests_path);
diff --git a/chrome/test/ui/sandbox_uitests.cc b/chrome/test/ui/sandbox_uitests.cc
index cbfaa65..d898cf5 100644
--- a/chrome/test/ui/sandbox_uitests.cc
+++ b/chrome/test/ui/sandbox_uitests.cc
@@ -14,9 +14,8 @@ class SandboxTest : public UITest {
protected:
// Launches chrome with the --test-sandbox=security_tests.dll flag.
SandboxTest() : UITest() {
- CommandLine::AppendSwitchWithValue(&launch_arguments_,
- switches::kTestSandbox,
- L"security_tests.dll");
+ launch_arguments_.AppendSwitchWithValue(switches::kTestSandbox,
+ L"security_tests.dll");
}
};
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 06591ec..597b0af 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/test/ui/ui_test.h"
+
#include <set>
#include <vector>
-#include "chrome/test/ui/ui_test.h"
-
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/file_util.h"
@@ -92,6 +92,7 @@ bool UITest::DieFileDie(const std::wstring& file, bool recurse) {
UITest::UITest()
: testing::Test(),
+ launch_arguments_(L""),
expected_errors_(0),
expected_crashes_(0),
homepage_(L"about:blank"),
@@ -177,28 +178,29 @@ void UITest::TearDown() {
// Pick up the various test time out values from the command line.
void UITest::InitializeTimeouts() {
- if (CommandLine().HasSwitch(kUiTestTimeout)) {
- std::wstring timeout_str = CommandLine().GetSwitchValue(kUiTestTimeout);
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(kUiTestTimeout)) {
+ std::wstring timeout_str = command_line.GetSwitchValue(kUiTestTimeout);
int timeout = StringToInt(timeout_str);
command_execution_timeout_ms_ = std::max(kMaxTestExecutionTime, timeout);
}
- if (CommandLine().HasSwitch(kUiTestActionTimeout)) {
- std::wstring act_str = CommandLine().GetSwitchValue(kUiTestActionTimeout);
+ if (command_line.HasSwitch(kUiTestActionTimeout)) {
+ std::wstring act_str = command_line.GetSwitchValue(kUiTestActionTimeout);
int act_timeout = StringToInt(act_str);
action_timeout_ms_ = std::max(kWaitForActionMsec, act_timeout);
}
- if (CommandLine().HasSwitch(kUiTestActionMaxTimeout)) {
+ if (command_line.HasSwitch(kUiTestActionMaxTimeout)) {
std::wstring action_max_str =
- CommandLine().GetSwitchValue(kUiTestActionMaxTimeout);
+ command_line.GetSwitchValue(kUiTestActionMaxTimeout);
int max_timeout = StringToInt(action_max_str);
action_max_timeout_ms_ = std::max(kWaitForActionMaxMsec, max_timeout);
}
- if (CommandLine().HasSwitch(kUiTestSleepTimeout)) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestSleepTimeout)) {
std::wstring sleep_timeout_str =
- CommandLine().GetSwitchValue(kUiTestSleepTimeout);
+ CommandLine::ForCurrentProcess()->GetSwitchValue(kUiTestSleepTimeout);
int sleep_timeout = StringToInt(sleep_timeout_str);
sleep_timeout_ms_ = std::max(kWaitForActionMsec, sleep_timeout);
}
@@ -235,23 +237,29 @@ void UITest::CloseBrowserAndServer() {
#endif
}
-void UITest::LaunchBrowser(const std::wstring& arguments, bool clear_profile) {
- std::wstring command_line(browser_directory_);
- file_util::AppendToPath(&command_line,
+void UITest::LaunchBrowser(const CommandLine& arguments, bool clear_profile) {
+ std::wstring command = browser_directory_;
+ file_util::AppendToPath(&command,
chrome::kBrowserProcessExecutableName);
+ CommandLine command_line(command);
// Add any explict command line flags passed to the process.
std::wstring extra_chrome_flags =
- CommandLine().GetSwitchValue(kExtraChromeFlagsSwitch);
- if (!extra_chrome_flags.empty())
- command_line.append(L" " + extra_chrome_flags);
+ CommandLine::ForCurrentProcess()->GetSwitchValue(kExtraChromeFlagsSwitch);
+ if (!extra_chrome_flags.empty()) {
+#if defined(OS_WIN)
+ command_line.AppendLooseValue(extra_chrome_flags);
+#else
+ // TODO(port): figure out how to pass through extra flags via a string.
+ NOTIMPLEMENTED();
+#endif
+ }
// We need cookies on file:// for things like the page cycler.
- CommandLine::AppendSwitch(&command_line, switches::kEnableFileCookies);
+ command_line.AppendSwitch(switches::kEnableFileCookies);
if (dom_automation_enabled_)
- CommandLine::AppendSwitch(&command_line,
- switches::kDomAutomationController);
+ command_line.AppendSwitch(switches::kDomAutomationController);
#if defined(OS_WIN)
if (include_testing_id_) {
@@ -261,12 +269,10 @@ void UITest::LaunchBrowser(const std::wstring& arguments, bool clear_profile) {
// this by passing an url (e.g. about:blank) on the command line, but
// I decided to keep using the old switch in the existing use case to
// minimize changes in behavior.
- CommandLine::AppendSwitchWithValue(&command_line,
- switches::kAutomationClientChannelID,
+ command_line.AppendSwitchWithValue(switches::kAutomationClientChannelID,
server_->channel_id());
} else {
- CommandLine::AppendSwitchWithValue(&command_line,
- switches::kTestingChannelID,
+ command_line.AppendSwitchWithValue(switches::kTestingChannelID,
server_->channel_id());
}
}
@@ -276,56 +282,52 @@ void UITest::LaunchBrowser(const std::wstring& arguments, bool clear_profile) {
#endif
if (!show_error_dialogs_)
- CommandLine::AppendSwitch(&command_line, switches::kNoErrorDialogs);
+ command_line.AppendSwitch(switches::kNoErrorDialogs);
if (in_process_renderer_)
- CommandLine::AppendSwitch(&command_line, switches::kSingleProcess);
+ command_line.AppendSwitch(switches::kSingleProcess);
if (in_process_plugins_)
- CommandLine::AppendSwitch(&command_line, switches::kInProcessPlugins);
+ command_line.AppendSwitch(switches::kInProcessPlugins);
if (no_sandbox_)
- CommandLine::AppendSwitch(&command_line, switches::kNoSandbox);
+ command_line.AppendSwitch(switches::kNoSandbox);
if (full_memory_dump_)
- CommandLine::AppendSwitch(&command_line, switches::kFullMemoryCrashReport);
+ command_line.AppendSwitch(switches::kFullMemoryCrashReport);
if (safe_plugins_)
- CommandLine::AppendSwitch(&command_line, switches::kSafePlugins);
+ command_line.AppendSwitch(switches::kSafePlugins);
if (enable_dcheck_)
- CommandLine::AppendSwitch(&command_line, switches::kEnableDCHECK);
+ command_line.AppendSwitch(switches::kEnableDCHECK);
if (silent_dump_on_dcheck_)
- CommandLine::AppendSwitch(&command_line, switches::kSilentDumpOnDCHECK);
+ command_line.AppendSwitch(switches::kSilentDumpOnDCHECK);
if (disable_breakpad_)
- CommandLine::AppendSwitch(&command_line, switches::kDisableBreakpad);
+ command_line.AppendSwitch(switches::kDisableBreakpad);
if (!homepage_.empty())
- CommandLine::AppendSwitchWithValue(&command_line,
- switches::kHomePage,
+ command_line.AppendSwitchWithValue(switches::kHomePage,
homepage_);
PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_);
if (!user_data_dir_.empty())
- CommandLine::AppendSwitchWithValue(&command_line,
- switches::kUserDataDir,
+ command_line.AppendSwitchWithValue(switches::kUserDataDir,
user_data_dir_);
if (!js_flags_.empty())
- CommandLine::AppendSwitchWithValue(&command_line,
- switches::kJavaScriptFlags,
+ command_line.AppendSwitchWithValue(switches::kJavaScriptFlags,
js_flags_);
- CommandLine::AppendSwitch(&command_line, switches::kMetricsRecordingOnly);
+ command_line.AppendSwitch(switches::kMetricsRecordingOnly);
// We always want to enable chrome logging
- CommandLine::AppendSwitch(&command_line, switches::kEnableLogging);
+ command_line.AppendSwitch(switches::kEnableLogging);
if (dump_histograms_on_exit_)
- CommandLine::AppendSwitch(&command_line, switches::kDumpHistogramsOnExit);
+ command_line.AppendSwitch(switches::kDumpHistogramsOnExit);
#ifdef WAIT_FOR_DEBUGGER_ON_OPEN
- CommandLine::AppendSwitch(&command_line, switches::kDebugOnStart);
+ command_line.AppendSwitch(switches::kDebugOnStart);
#endif
if (!ui_test_name_.empty())
- CommandLine::AppendSwitchWithValue(&command_line,
- switches::kTestName,
+ command_line.AppendSwitchWithValue(switches::kTestName,
ui_test_name_);
DebugFlags::ProcessDebugFlags(&command_line, DebugFlags::UNKNOWN, false);
- command_line.append(L" " + arguments);
+ command_line.AppendArguments(arguments, false);
// Clear user data directory to make sure test environment is consistent
// We balk on really short (absolute) user_data_dir directory names, because
@@ -356,7 +358,7 @@ void UITest::LaunchBrowser(const std::wstring& arguments, bool clear_profile) {
if (use_existing_browser_) {
DWORD pid = 0;
HWND hwnd = FindWindowEx(HWND_MESSAGE, NULL, chrome::kMessageWindowClass,
- user_data_dir_.c_str());
+ user_data_dir_.c_str());
GetWindowThreadProcessId(hwnd, &pid);
// This mode doesn't work if we wound up launching a new browser ourselves.
ASSERT_NE(pid, base::GetProcId(process_));
diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h
index 7f6c906..31ad827 100644
--- a/chrome/test/ui/ui_test.h
+++ b/chrome/test/ui/ui_test.h
@@ -24,6 +24,7 @@
#endif
#include <string>
+#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/process.h"
@@ -75,8 +76,8 @@ class UITest : public testing::Test {
// Closes the browser and IPC testing server.
void CloseBrowserAndServer();
- // Launches the browser with the given arguments.
- void LaunchBrowser(const std::wstring& arguments, bool clear_profile);
+ // Launches the browser with the given command line.
+ void LaunchBrowser(const CommandLine& cmdline, bool clear_profile);
// Exits out browser instance.
void QuitBrowser();
@@ -389,7 +390,7 @@ class UITest : public testing::Test {
// with no trailing slash
std::wstring test_data_directory_; // Path to the unit test data,
// with no trailing slash
- std::wstring launch_arguments_; // Arguments to the browser on launch.
+ CommandLine launch_arguments_; // Command to launch the browser
size_t expected_errors_; // The number of errors expected during
// the run (generally 0).
int expected_crashes_; // The number of crashes expected during
diff --git a/chrome/test/ui/ui_test_suite.h b/chrome/test/ui/ui_test_suite.h
index b3d609f..07f6c76 100644
--- a/chrome/test/ui/ui_test_suite.h
+++ b/chrome/test/ui/ui_test_suite.h
@@ -18,7 +18,7 @@ class UITestSuite : public ChromeTestSuite {
virtual void Initialize() {
ChromeTestSuite::Initialize();
- CommandLine parsed_command_line;
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
UITest::set_in_process_renderer(
parsed_command_line.HasSwitch(switches::kSingleProcess));
UITest::set_in_process_plugins(
diff --git a/chrome/test/unit/chrome_test_suite.h b/chrome/test/unit/chrome_test_suite.h
index 8847988..b2c196b 100644
--- a/chrome/test/unit/chrome_test_suite.h
+++ b/chrome/test/unit/chrome_test_suite.h
@@ -41,7 +41,8 @@ protected:
// NOTE: The user data directory will be erased before each UI test that
// uses it, in order to ensure consistency.
std::wstring user_data_dir =
- CommandLine().GetSwitchValue(switches::kUserDataDir);
+ CommandLine::ForCurrentProcess()->GetSwitchValue(
+ switches::kUserDataDir);
if (user_data_dir.empty() &&
PathService::Get(base::DIR_EXE, &user_data_dir))
file_util::AppendToPath(&user_data_dir, L"test_user_data");