summaryrefslogtreecommitdiffstats
path: root/chrome/test/ui
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 22:00:38 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 22:00:38 +0000
commit95edc39cdd3c55e2d62f818a830a86b209018137 (patch)
tree4b71be27dfa412a1b9aec01c61f91c09ab16f49a /chrome/test/ui
parent8b081042290a48ce3c6b0a41071643175d17ae40 (diff)
downloadchromium_src-95edc39cdd3c55e2d62f818a830a86b209018137.zip
chromium_src-95edc39cdd3c55e2d62f818a830a86b209018137.tar.gz
chromium_src-95edc39cdd3c55e2d62f818a830a86b209018137.tar.bz2
Remove some wstrings used in ui_test.cc.
This removes all switch-related wstring APIs from ui_test.cc, and fixes all the callers. Review URL: http://codereview.chromium.org/3066026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui')
-rw-r--r--chrome/test/ui/ui_test.cc23
-rw-r--r--chrome/test/ui/ui_test.h22
-rw-r--r--chrome/test/ui/ui_test_suite.cc14
3 files changed, 27 insertions, 32 deletions
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index e29c373..b37793f 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -33,6 +33,7 @@
#include "chrome/common/debug_flags.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/json_value_serializer.h"
+#include "chrome/common/url_constants.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/test/automation/automation_proxy.h"
#include "chrome/test/automation/browser_proxy.h"
@@ -83,8 +84,8 @@ bool UITestBase::enable_dcheck_ = false;
bool UITestBase::silent_dump_on_dcheck_ = false;
bool UITestBase::disable_breakpad_ = false;
int UITestBase::timeout_ms_ = 10 * 60 * 1000;
-std::wstring UITestBase::js_flags_ = L"";
-std::wstring UITestBase::log_level_ = L"";
+std::string UITestBase::js_flags_ = "";
+std::string UITestBase::log_level_ = "";
// Specify the time (in milliseconds) that the ui_tests should wait before
// timing out. This is used to specify longer timeouts when running under Purify
@@ -110,7 +111,7 @@ UITestBase::UITestBase()
: launch_arguments_(CommandLine::ARGUMENTS_ONLY),
expected_errors_(0),
expected_crashes_(0),
- homepage_(L"about:blank"),
+ homepage_(chrome::kAboutBlankURL),
wait_for_initial_loads_(true),
dom_automation_enabled_(false),
process_(base::kNullProcessHandle),
@@ -136,7 +137,7 @@ UITestBase::UITestBase(MessageLoop::Type msg_loop_type)
: launch_arguments_(CommandLine::ARGUMENTS_ONLY),
expected_errors_(0),
expected_crashes_(0),
- homepage_(L"about:blank"),
+ homepage_(chrome::kAboutBlankURL),
wait_for_initial_loads_(true),
dom_automation_enabled_(false),
process_(base::kNullProcessHandle),
@@ -1153,14 +1154,14 @@ bool UITestBase::LaunchBrowserHelper(const CommandLine& arguments,
if (disable_breakpad_)
command_line.AppendSwitch(switches::kDisableBreakpad);
if (!homepage_.empty())
- command_line.AppendSwitchWithValue(switches::kHomePage, homepage_);
+ command_line.AppendSwitchASCII(switches::kHomePage, homepage_);
// Don't try to fetch web resources during UI testing.
command_line.AppendSwitch(switches::kDisableWebResources);
if (!js_flags_.empty())
- command_line.AppendSwitchWithValue(switches::kJavaScriptFlags, js_flags_);
+ command_line.AppendSwitchASCII(switches::kJavaScriptFlags, js_flags_);
if (!log_level_.empty())
- command_line.AppendSwitchWithValue(switches::kLoggingLevel, log_level_);
+ command_line.AppendSwitchASCII(switches::kLoggingLevel, log_level_);
command_line.AppendSwitch(switches::kMetricsRecordingOnly);
@@ -1175,7 +1176,7 @@ bool UITestBase::LaunchBrowserHelper(const CommandLine& arguments,
#endif
if (!ui_test_name_.empty())
- command_line.AppendSwitchWithValue(switches::kTestName, ui_test_name_);
+ command_line.AppendSwitchASCII(switches::kTestName, ui_test_name_);
// The tests assume that file:// URIs can freely access other file:// URIs.
command_line.AppendSwitch(switches::kAllowFileAccessFromFiles);
@@ -1510,10 +1511,8 @@ void UITest::SetUp() {
const testing::TestInfo* const test_info =
testing::UnitTest::GetInstance()->current_test_info();
if (test_info) {
- std::string test_name = test_info->test_case_name();
- test_name += ".";
- test_name += test_info->name();
- set_ui_test_name(ASCIIToWide(test_name));
+ set_ui_test_name(test_info->test_case_name() + std::string(".") +
+ test_info->name());
}
UITestBase::SetUp();
PlatformTest::SetUp();
diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h
index 6a09a26..a31e1ac 100644
--- a/chrome/test/ui/ui_test.h
+++ b/chrome/test/ui/ui_test.h
@@ -362,13 +362,13 @@ class UITestBase {
timeout_ms_ = value;
}
- static std::wstring js_flags() { return js_flags_; }
- static void set_js_flags(const std::wstring& value) {
+ static const std::string& js_flags() { return js_flags_; }
+ static void set_js_flags(const std::string& value) {
js_flags_ = value;
}
- static std::wstring log_level() { return log_level_; }
- static void set_log_level(const std::wstring& value) {
+ static const std::string& log_level() { return log_level_; }
+ static void set_log_level(const std::string& value) {
log_level_ = value;
}
@@ -420,9 +420,7 @@ class UITestBase {
int sleep_timeout_ms() const { return sleep_timeout_ms_; }
- std::wstring ui_test_name() const { return ui_test_name_; }
-
- void set_ui_test_name(const std::wstring& name) {
+ void set_ui_test_name(const std::string& name) {
ui_test_name_ = name;
}
@@ -439,7 +437,7 @@ class UITestBase {
// Sets homepage_. Should be called before launching browser to have
// any effect.
- void set_homepage(const std::wstring& homepage) {
+ void set_homepage(const std::string& homepage) {
homepage_ = homepage;
}
@@ -557,7 +555,7 @@ class UITestBase {
// the run (generally 0).
int expected_crashes_; // The number of crashes expected during
// the run (generally 0).
- std::wstring homepage_; // Homepage used for testing.
+ std::string homepage_; // Homepage used for testing.
bool wait_for_initial_loads_; // Wait for initial loads to complete
// in SetUp() before running test body.
base::TimeTicks browser_launch_time_; // Time when the browser was run.
@@ -607,8 +605,8 @@ class UITestBase {
static bool disable_breakpad_; // Disable breakpad on the browser.
static int timeout_ms_; // Timeout in milliseconds to wait
// for an test to finish.
- static std::wstring js_flags_; // Flags passed to the JS engine.
- static std::wstring log_level_; // Logging level.
+ static std::string js_flags_; // Flags passed to the JS engine.
+ static std::string log_level_; // Logging level.
scoped_ptr<AutomationProxy> server_;
@@ -618,7 +616,7 @@ class UITestBase {
int sleep_timeout_ms_;
int terminate_timeout_ms_;
- std::wstring ui_test_name_;
+ std::string ui_test_name_;
// We use a temporary directory for profile to avoid issues with being
// unable to delete some files because they're in use, etc.
diff --git a/chrome/test/ui/ui_test_suite.cc b/chrome/test/ui/ui_test_suite.cc
index 657e0ef..7d19a2a 100644
--- a/chrome/test/ui/ui_test_suite.cc
+++ b/chrome/test/ui/ui_test_suite.cc
@@ -81,16 +81,14 @@ void UITestSuite::Initialize() {
}
#endif
- std::wstring js_flags =
- parsed_command_line.GetSwitchValue(switches::kJavaScriptFlags);
- if (!js_flags.empty()) {
+ std::string js_flags =
+ parsed_command_line.GetSwitchValueASCII(switches::kJavaScriptFlags);
+ if (!js_flags.empty())
UITest::set_js_flags(js_flags);
- }
- std::wstring log_level =
- parsed_command_line.GetSwitchValue(switches::kLoggingLevel);
- if (!log_level.empty()) {
+ std::string log_level =
+ parsed_command_line.GetSwitchValueASCII(switches::kLoggingLevel);
+ if (!log_level.empty())
UITest::set_log_level(log_level);
- }
#if defined(OS_WIN)
LoadCrashService();