diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-30 22:00:38 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-30 22:00:38 +0000 |
commit | 95edc39cdd3c55e2d62f818a830a86b209018137 (patch) | |
tree | 4b71be27dfa412a1b9aec01c61f91c09ab16f49a | |
parent | 8b081042290a48ce3c6b0a41071643175d17ae40 (diff) | |
download | chromium_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
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sanity_uitest.cc | 13 | ||||
-rw-r--r-- | chrome/browser/session_history_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/render_process_impl.cc | 6 | ||||
-rw-r--r-- | chrome/renderer/safe_browsing/phishing_dom_feature_extractor_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/test/pyautolib/pyautolib.cc | 2 | ||||
-rw-r--r-- | chrome/test/render_view_test.cc | 2 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 23 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.h | 22 | ||||
-rw-r--r-- | chrome/test/ui/ui_test_suite.cc | 14 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.cc | 9 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 2 | ||||
-rw-r--r-- | webkit/support/test_webkit_client.cc | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/run_all_tests.cc | 6 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 6 |
15 files changed, 53 insertions, 60 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui_uitest.cc b/chrome/browser/dom_ui/new_tab_ui_uitest.cc index e82a1cda..5635811 100644 --- a/chrome/browser/dom_ui/new_tab_ui_uitest.cc +++ b/chrome/browser/dom_ui/new_tab_ui_uitest.cc @@ -22,7 +22,7 @@ class NewTabUITest : public UITest { dom_automation_enabled_ = true; // Set home page to the empty string so that we can set the home page using // preferences. - homepage_ = L""; + homepage_ = ""; // Setup the DEFAULT_THEME profile (has fake history entries). set_template_user_data(UITest::ComputeTypicalUserDataSource( diff --git a/chrome/browser/sanity_uitest.cc b/chrome/browser/sanity_uitest.cc index 29fde79..83f978a 100644 --- a/chrome/browser/sanity_uitest.cc +++ b/chrome/browser/sanity_uitest.cc @@ -11,14 +11,14 @@ #include "base/file_path.h" #include "base/platform_thread.h" #include "chrome/common/chrome_switches.h" +#include "net/base/net_util.h" class GoogleTest : public UITest { protected: GoogleTest() : UITest() { - FilePath test_file(test_data_directory_); - test_file = test_file.AppendASCII("google"); - test_file = test_file.AppendASCII("google.html"); - homepage_ = test_file.ToWStringHack(); + FilePath test_file = + test_data_directory_.AppendASCII("google").AppendASCII("google.html"); + homepage_ = GURL(net::FilePathToFileURL(test_file)).spec(); } }; @@ -34,9 +34,8 @@ TEST_F(GoogleTest, Crash) { class ColumnLayout : public UITest { protected: ColumnLayout() : UITest() { - FilePath test_file(test_data_directory_); - test_file = test_file.AppendASCII("columns.html"); - homepage_ = test_file.ToWStringHack(); + FilePath test_file = test_data_directory_.AppendASCII("columns.html"); + homepage_ = GURL(net::FilePathToFileURL(test_file)).spec(); } }; diff --git a/chrome/browser/session_history_uitest.cc b/chrome/browser/session_history_uitest.cc index 602e9c4..c2b38bf 100644 --- a/chrome/browser/session_history_uitest.cc +++ b/chrome/browser/session_history_uitest.cc @@ -152,7 +152,7 @@ TEST_F(SessionHistoryTest, MAYBE_FrameBackForward) { ASSERT_TRUE(NULL != server.get()); // about:blank should be loaded first. - GURL home(WideToUTF8(homepage_)); + GURL home(homepage_); ASSERT_FALSE(tab_->GoBack()); EXPECT_EQ(L"", GetTabTitle()); EXPECT_EQ(home, GetTabURL()); diff --git a/chrome/renderer/render_process_impl.cc b/chrome/renderer/render_process_impl.cc index 5e08817..59fe985 100644 --- a/chrome/renderer/render_process_impl.cc +++ b/chrome/renderer/render_process_impl.cc @@ -165,14 +165,14 @@ RenderProcessImpl::RenderProcessImpl() // Out of process dev tools rely upon auto break behavior. webkit_glue::SetJavaScriptFlags( - L"--debugger-auto-break" + "--debugger-auto-break" // Enable lazy in-memory profiling. - L" --prof --prof-lazy --logfile=* --compress-log"); + " --prof --prof-lazy --logfile=* --compress-log"); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kJavaScriptFlags)) { webkit_glue::SetJavaScriptFlags( - command_line.GetSwitchValue(switches::kJavaScriptFlags)); + command_line.GetSwitchValueASCII(switches::kJavaScriptFlags)); } if (command_line.HasSwitch(switches::kEnableWatchdog)) { diff --git a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_unittest.cc b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_unittest.cc index 637b2bd..d307134 100644 --- a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_unittest.cc +++ b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_unittest.cc @@ -80,7 +80,7 @@ class PhishingDOMFeatureExtractorTest : public ::testing::Test, IPC::Channel::MODE_SERVER, this)); ASSERT_TRUE(channel_->Connect()); - webkit_glue::SetJavaScriptFlags(L"--expose-gc"); + webkit_glue::SetJavaScriptFlags("--expose-gc"); mock_process_.reset(new MockRenderProcess); render_thread_ = new RenderThread(thread_name); mock_process_->set_main_thread(render_thread_); diff --git a/chrome/test/pyautolib/pyautolib.cc b/chrome/test/pyautolib/pyautolib.cc index 4a24a18..58ac2dd 100644 --- a/chrome/test/pyautolib/pyautolib.cc +++ b/chrome/test/pyautolib/pyautolib.cc @@ -30,7 +30,7 @@ void PyUITestSuiteBase::Initialize(const FilePath& browser_dir) { PyUITestBase::PyUITestBase(bool clear_profile, std::wstring homepage) : UITestBase() { set_clear_profile(clear_profile); - set_homepage(homepage); + set_homepage(WideToASCII(homepage)); message_loop_ = GetSharedMessageLoop(MessageLoop::TYPE_DEFAULT); } diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc index 7503230..156b838 100644 --- a/chrome/test/render_view_test.cc +++ b/chrome/test/render_view_test.cc @@ -80,7 +80,7 @@ void RenderViewTest::SetUp() { // Setting flags and really doing anything with WebKit is fairly fragile and // hacky, but this is the world we live in... - webkit_glue::SetJavaScriptFlags(L" --expose-gc"); + webkit_glue::SetJavaScriptFlags(" --expose-gc"); WebKit::initialize(&webkitclient_); WebScriptController::registerExtension(BaseJsV8Extension::Get()); WebScriptController::registerExtension(JsonSchemaJsV8Extension::Get()); 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(); diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index e6b0f75..f6fadfe 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -74,11 +74,9 @@ namespace webkit_glue { // Global variable used by the plugin quirk "die after unload". bool g_forcefully_terminate_plugin_process = false; -void SetJavaScriptFlags(const std::wstring& str) { +void SetJavaScriptFlags(const std::string& str) { #if WEBKIT_USING_V8 - std::string utf8_str = WideToUTF8(str); - v8::V8::SetFlagsFromString( - utf8_str.data(), static_cast<int>(utf8_str.size())); + v8::V8::SetFlagsFromString(str.data(), static_cast<int>(str.size())); #endif } @@ -257,7 +255,8 @@ void ResetBeforeTestRun(WebView* view) { #ifndef NDEBUG // The log macro was having problems due to collisions with WTF, so we just // code here what that would have inlined. -void DumpLeakedObject(const char* file, int line, const char* object, int count) { +void DumpLeakedObject(const char* file, int line, const char* object, + int count) { std::string msg = StringPrintf("%s LEAKED %d TIMES", object, count); AppendToLog(file, line, msg.c_str()); } diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index 541836b..1c59ff2 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -42,7 +42,7 @@ namespace webkit_glue { //---- BEGIN FUNCTIONS IMPLEMENTED BY WEBKIT/GLUE ----------------------------- -void SetJavaScriptFlags(const std::wstring& flags); +void SetJavaScriptFlags(const std::string& flags); // Turn on the logging for notImplemented() calls from WebCore. void EnableWebCoreNotImplementedLogging(); diff --git a/webkit/support/test_webkit_client.cc b/webkit/support/test_webkit_client.cc index df2e439..5f380e1 100644 --- a/webkit/support/test_webkit_client.cc +++ b/webkit/support/test_webkit_client.cc @@ -121,7 +121,7 @@ TestWebKitClient::TestWebKitClient(bool unit_test_mode) SimpleResourceLoaderBridge::Init(FilePath(), cache_mode, true); // Test shell always exposes the GC. - webkit_glue::SetJavaScriptFlags(L" --expose-gc"); + webkit_glue::SetJavaScriptFlags(" --expose-gc"); // Expose GCController to JavaScript. WebScriptController::registerExtension(extensions_v8::GCExtension::Get()); } diff --git a/webkit/tools/test_shell/run_all_tests.cc b/webkit/tools/test_shell/run_all_tests.cc index 8680af8..09c75bb 100644 --- a/webkit/tools/test_shell/run_all_tests.cc +++ b/webkit/tools/test_shell/run_all_tests.cc @@ -62,9 +62,9 @@ int main(int argc, char* argv[]) { // Allow tests to analyze GC information from V8 log, and expose GC // triggering function. - std::wstring js_flags = - parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags); - js_flags += L" --logfile=* --log_gc --expose_gc"; + std::string js_flags = + parsed_command_line.GetSwitchValueASCII(test_shell::kJavaScriptFlags); + js_flags += " --logfile=* --log_gc --expose_gc"; webkit_glue::SetJavaScriptFlags(js_flags); // Suppress error dialogs and do not show GP fault error box on Windows. diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 8eb549e..f71dc00 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -239,10 +239,10 @@ int main(int argc, char* argv[]) { } } - std::wstring js_flags = - parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags); + std::string js_flags = + parsed_command_line.GetSwitchValueASCII(test_shell::kJavaScriptFlags); // Test shell always exposes the GC. - js_flags += L" --expose-gc"; + js_flags += " --expose-gc"; webkit_glue::SetJavaScriptFlags(js_flags); // Expose GCController to JavaScript. WebScriptController::registerExtension(extensions_v8::GCExtension::Get()); |