diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 01:05:54 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 01:05:54 +0000 |
commit | c87d51abc0a1452c596830f185281d2f8ce1d31e (patch) | |
tree | 9f69637201a3eb1349addbf9fd8b0a8b9242ed32 /webkit | |
parent | 05b4878b77f5f93b375a021f677e62351ab78894 (diff) | |
download | chromium_src-c87d51abc0a1452c596830f185281d2f8ce1d31e.zip chromium_src-c87d51abc0a1452c596830f185281d2f8ce1d31e.tar.gz chromium_src-c87d51abc0a1452c596830f185281d2f8ce1d31e.tar.bz2 |
Remove more wstrings in webkit/tools/test_shell.
The printfs are also no longer used. I can completely remove them in a follow
up change.
BUG=23581
TEST=None
Review URL: http://codereview.chromium.org/8983009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116253 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
8 files changed, 37 insertions, 35 deletions
diff --git a/webkit/tools/test_shell/image_decoder_unittest.cc b/webkit/tools/test_shell/image_decoder_unittest.cc index 82b3bb7..280b58f 100644 --- a/webkit/tools/test_shell/image_decoder_unittest.cc +++ b/webkit/tools/test_shell/image_decoder_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -50,7 +50,7 @@ FilePath GetMD5SumPath(const FilePath& path) { } #if defined(CALCULATE_MD5_SUMS) -void SaveMD5Sum(const std::wstring& path, const WebKit::WebImage& web_image) { +void SaveMD5Sum(const FilePath& path, const WebKit::WebImage& web_image) { // Calculate MD5 sum. base::MD5Digest digest; web_image.getSkBitmap().lockPixels(); @@ -209,7 +209,7 @@ void ImageDecoderTest::TestWebKitImageDecoder(const FilePath& image_path, // image dats to the size is returned. WebKit::WebSize size(decoder->getImage(desired_frame_index).size()); const WebKit::WebImage& image = WebKit::WebImage::fromData(data, size); - SaveMD5Sum(md5_sum_path.value(), image); + SaveMD5Sum(md5_sum_path, image); #else VerifyImage(*decoder, image_path, md5_sum_path, desired_frame_index); #endif diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 208a413..9ec8eed 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -49,7 +49,6 @@ #include "webkit/tools/test_shell/test_webview_delegate.h" using std::string; -using std::wstring; using WebKit::WebBindings; using WebKit::WebConsoleMessage; @@ -269,11 +268,12 @@ void LayoutTestController::PolicyDelegateDone() { void LayoutTestController::fallbackMethod( const CppArgumentList& args, CppVariant* result) { - std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestController"); + std::string message( + "JavaScript ERROR: unknown method called on LayoutTestController"); if (!shell_->layout_test_mode()) { logging::LogMessage("CONSOLE:", 0).stream() << message; } else { - printf("CONSOLE MESSAGE: %S\n", message.c_str()); + printf("CONSOLE MESSAGE: %s\n", message.c_str()); } result->SetNull(); } diff --git a/webkit/tools/test_shell/mac/test_webview_delegate.mm b/webkit/tools/test_shell/mac/test_webview_delegate.mm index e0beb0b..dce18b5 100644 --- a/webkit/tools/test_shell/mac/test_webview_delegate.mm +++ b/webkit/tools/test_shell/mac/test_webview_delegate.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -205,9 +205,9 @@ void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { // Private methods ------------------------------------------------------------ -void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) { +void TestWebViewDelegate::ShowJavaScriptAlert(const string16& message) { NSString *text = - [NSString stringWithUTF8String:WideToUTF8(message).c_str()]; + [NSString stringWithUTF8String:UTF16ToUTF8(message).c_str()]; NSAlert *alert = [NSAlert alertWithMessageText:@"JavaScript Alert" defaultButton:@"OK" alternateButton:nil diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index e3de932..a5b1d8c 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -178,7 +178,7 @@ void TestShell::InitializeTestShell(bool layout_test_mode, const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); if (parsed_command_line.HasSwitch(test_shell::kCrashDumps)) { - std::wstring dir( + string16 dir( parsed_command_line.GetSwitchValueNative(test_shell::kCrashDumps)); if (parsed_command_line.HasSwitch(test_shell::kCrashDumpsFulldump)) { new google_breakpad::ExceptionHandler( @@ -247,10 +247,10 @@ std::string TestShell::RewriteLocalUrl(const std::string& url) { replace_url = replace_url.AppendASCII("third_party"); replace_url = replace_url.AppendASCII("WebKit"); replace_url = replace_url.AppendASCII("LayoutTests"); - std::wstring replace_url_str = replace_url.value(); + string16 replace_url_str = replace_url.value(); replace_url_str.push_back(L'/'); new_url = std::string("file:///") + - WideToUTF8(replace_url_str).append(url.substr(kPrefixLen)); + UTF16ToUTF8(replace_url_str).append(url.substr(kPrefixLen)); } return new_url; } diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 6425bbd..8938599 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -454,7 +454,7 @@ WebString TestWebViewDelegate::autoCorrectWord(const WebString& word) { void TestWebViewDelegate::runModalAlertDialog( WebFrame* frame, const WebString& message) { if (!shell_->layout_test_mode()) { - ShowJavaScriptAlert(UTF16ToWideHack(message)); + ShowJavaScriptAlert(message); } else { printf("ALERT: %s\n", message.utf8().data()); } @@ -768,8 +768,8 @@ void TestWebViewDelegate::didStartProvisionalLoad(WebFrame* frame) { } if (shell_->layout_test_controller()->StopProvisionalFrameLoads()) { - printf("%S - stopping load in didStartProvisionalLoadForFrame callback\n", - GetFrameDescription(frame).c_str()); + printf("%s - stopping load in didStartProvisionalLoadForFrame callback\n", + UTF16ToUTF8(GetFrameDescription(frame)).c_str()); frame->stopLoading(); } UpdateAddressBar(frame->view()); @@ -836,8 +836,8 @@ void TestWebViewDelegate::didReceiveTitle( void TestWebViewDelegate::didFinishDocumentLoad(WebFrame* frame) { unsigned pending_unload_events = frame->unloadListenerCount(); if (pending_unload_events) { - printf("%S - has %u onunload handler(s)\n", - GetFrameDescription(frame).c_str(), pending_unload_events); + printf("%s - has %u onunload handler(s)\n", + UTF16ToUTF8(GetFrameDescription(frame)).c_str(), pending_unload_events); } } @@ -1137,20 +1137,21 @@ void TestWebViewDelegate::UpdateSessionHistory(WebFrame* frame) { entry->SetContentState(webkit_glue::HistoryItemToString(history_item)); } -std::wstring TestWebViewDelegate::GetFrameDescription(WebFrame* webframe) { - std::wstring name = UTF16ToWideHack(webframe->name()); +string16 TestWebViewDelegate::GetFrameDescription(WebFrame* webframe) { + std::string name = UTF16ToUTF8(webframe->name()); if (webframe == shell_->webView()->mainFrame()) { if (name.length()) - return L"main frame \"" + name + L"\""; + name = "main frame \"" + name + "\""; else - return L"main frame"; + name = "main frame"; } else { if (name.length()) - return L"frame \"" + name + L"\""; + name = "frame \"" + name + "\""; else - return L"frame (anonymous)"; + name = "frame (anonymous)"; } + return UTF8ToUTF16(name); } void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index b89a692..ef5bd4e 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,6 +17,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/string16.h" #include "build/build_config.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h" @@ -344,7 +345,7 @@ class TestWebViewDelegate : public WebKit::WebViewClient, // Show a JavaScript alert as a popup message. // The caller should test whether we're in layout test mode and only // call this function when we really want a message to pop up. - void ShowJavaScriptAlert(const std::wstring& message); + void ShowJavaScriptAlert(const string16& message); // In the Mac code, this is called to trigger the end of a test after the // page has finished loading. From here, we can generate the dump for the @@ -369,7 +370,7 @@ class TestWebViewDelegate : public WebKit::WebViewClient, void UpdateSelectionClipboard(bool is_empty_selection); // Get a string suitable for dumping a frame to the console. - std::wstring GetFrameDescription(WebKit::WebFrame* webframe); + string16 GetFrameDescription(WebKit::WebFrame* webframe); // Causes navigation actions just printout the intended navigation instead // of taking you to the page. This is used for cases like mailto, where you diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc index e0e39e8..c3d8f60 100644 --- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc +++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -252,10 +252,10 @@ void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { // Private methods ------------------------------------------------------------ -void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) { +void TestWebViewDelegate::ShowJavaScriptAlert(const string16& message) { GtkWidget* dialog = gtk_message_dialog_new( shell_->mainWnd(), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, "%s", WideToUTF8(message).c_str()); + GTK_BUTTONS_OK, "%s", UTF16ToUTF8(message).c_str()); gtk_window_set_title(GTK_WINDOW(dialog), "JavaScript Alert"); gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop. gtk_widget_destroy(dialog); diff --git a/webkit/tools/test_shell/test_webview_delegate_win.cc b/webkit/tools/test_shell/test_webview_delegate_win.cc index 2f90eda..c7212fa 100644 --- a/webkit/tools/test_shell/test_webview_delegate_win.cc +++ b/webkit/tools/test_shell/test_webview_delegate_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -192,7 +192,7 @@ void TestWebViewDelegate::UpdateSelectionClipboard(bool is_empty_selection) { // Private methods ------------------------------------------------------------ -void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) { +void TestWebViewDelegate::ShowJavaScriptAlert(const string16& message) { MessageBox(NULL, message.c_str(), L"JavaScript Alert", MB_OK); } @@ -201,7 +201,7 @@ void TestWebViewDelegate::SetPageTitle(const string16& title) { } void TestWebViewDelegate::SetAddressBarURL(const GURL& url) { - std::wstring url_string = UTF8ToWide(url.spec()); + string16 url_string = UTF8ToUTF16(url.spec()); SendMessage(shell_->editWnd(), WM_SETTEXT, 0, reinterpret_cast<LPARAM>(url_string.c_str())); } |