diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 15:42:00 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 15:42:00 +0000 |
commit | 7024d3eea1d8328883736f5cd3cbef480aa0e740 (patch) | |
tree | 5fc40e7da24d79306321037359bce7bd97bcf36b /chrome/browser | |
parent | e9ff5e31b28b6ee684ceaf47afe4f483163f6d1d (diff) | |
download | chromium_src-7024d3eea1d8328883736f5cd3cbef480aa0e740.zip chromium_src-7024d3eea1d8328883736f5cd3cbef480aa0e740.tar.gz chromium_src-7024d3eea1d8328883736f5cd3cbef480aa0e740.tar.bz2 |
Remove wstring from RVH's run Javascript command.
BUG=23581
TEST=no visible changes; all tests pass
Review URL: http://codereview.chromium.org/6312154
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74118 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
43 files changed, 255 insertions, 214 deletions
diff --git a/chrome/browser/accessibility/browser_accessibility_win_unittest.cc b/chrome/browser/accessibility/browser_accessibility_win_unittest.cc index dd264a1..45b7f30 100644 --- a/chrome/browser/accessibility/browser_accessibility_win_unittest.cc +++ b/chrome/browser/accessibility/browser_accessibility_win_unittest.cc @@ -311,14 +311,14 @@ TEST_F(BrowserAccessibilityTest, TestTextBoundaries) { SysFreeString(text); ASSERT_EQ(S_OK, text1_obj->get_text(0, 4, &text)); - ASSERT_EQ(text, std::wstring(L"One ")); + ASSERT_EQ(text, string16(L"One ")); SysFreeString(text); ASSERT_EQ(S_OK, text1_obj->get_textAtOffset( 1, IA2_TEXT_BOUNDARY_CHAR, &start, &end, &text)); ASSERT_EQ(start, 1); ASSERT_EQ(end, 2); - ASSERT_EQ(text, std::wstring(L"n")); + ASSERT_EQ(text, string16(L"n")); SysFreeString(text); ASSERT_EQ(S_FALSE, text1_obj->get_textAtOffset( @@ -330,28 +330,28 @@ TEST_F(BrowserAccessibilityTest, TestTextBoundaries) { 1, IA2_TEXT_BOUNDARY_WORD, &start, &end, &text)); ASSERT_EQ(start, 0); ASSERT_EQ(end, 3); - ASSERT_EQ(text, std::wstring(L"One")); + ASSERT_EQ(text, string16(L"One")); SysFreeString(text); ASSERT_EQ(S_OK, text1_obj->get_textAtOffset( 6, IA2_TEXT_BOUNDARY_WORD, &start, &end, &text)); ASSERT_EQ(start, 4); ASSERT_EQ(end, 7); - ASSERT_EQ(text, std::wstring(L"two")); + ASSERT_EQ(text, string16(L"two")); SysFreeString(text); ASSERT_EQ(S_OK, text1_obj->get_textAtOffset( text1_len, IA2_TEXT_BOUNDARY_WORD, &start, &end, &text)); ASSERT_EQ(start, 25); ASSERT_EQ(end, 29); - ASSERT_EQ(text, std::wstring(L"six.")); + ASSERT_EQ(text, string16(L"six.")); SysFreeString(text); ASSERT_EQ(S_OK, text1_obj->get_textAtOffset( 1, IA2_TEXT_BOUNDARY_LINE, &start, &end, &text)); ASSERT_EQ(start, 0); ASSERT_EQ(end, 13); - ASSERT_EQ(text, std::wstring(L"One two three")); + ASSERT_EQ(text, string16(L"One two three")); SysFreeString(text); // Delete the manager and test that all BrowserAccessibility instances are diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index dfc29f5..1b39869 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -16,6 +16,7 @@ #include "base/string_util.h" #include "base/stringprintf.h" #include "base/threading/thread_restrictions.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/automation/automation_provider.h" @@ -1401,7 +1402,8 @@ PageSnapshotTaker::PageSnapshotTaker(AutomationProvider* automation, received_width_(false) {} void PageSnapshotTaker::Start() { - ExecuteScript(L"window.domAutomationController.send(document.width);"); + ExecuteScript( + ASCIIToUTF16("window.domAutomationController.send(document.width);")); } void PageSnapshotTaker::OnDomOperationCompleted(const std::string& json) { @@ -1413,7 +1415,8 @@ void PageSnapshotTaker::OnDomOperationCompleted(const std::string& json) { received_width_ = true; entire_page_size_.set_width(dimension); - ExecuteScript(L"window.domAutomationController.send(document.height);"); + ExecuteScript( + ASCIIToUTF16("window.domAutomationController.send(document.height);")); } else { entire_page_size_.set_height(dimension); @@ -1440,15 +1443,17 @@ void PageSnapshotTaker::OnSnapshotTaken(const SkBitmap& bitmap) { SendMessage(bytes_written == static_cast<int>(png_data.size())); } -void PageSnapshotTaker::ExecuteScript(const std::wstring& javascript) { - std::wstring set_automation_id; +void PageSnapshotTaker::ExecuteScript(const string16& javascript) { + std::string set_automation_id; base::SStringPrintf( &set_automation_id, - L"window.domAutomationController.setAutomationId(%d);", + "window.domAutomationController.setAutomationId(%d);", reply_message_->routing_id()); - render_view_->ExecuteJavascriptInWebFrame(L"", set_automation_id); - render_view_->ExecuteJavascriptInWebFrame(L"", javascript); + render_view_->ExecuteJavascriptInWebFrame(string16(), + UTF8ToUTF16(set_automation_id)); + render_view_->ExecuteJavascriptInWebFrame(string16(), + javascript); } void PageSnapshotTaker::SendMessage(bool success) { diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index fcb955b..70292cc 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -931,7 +931,7 @@ class PageSnapshotTaker : public DomOperationObserver { void OnSnapshotTaken(const SkBitmap& bitmap); // Helper method to send arbitrary javascript to the renderer for evaluation. - void ExecuteScript(const std::wstring& javascript); + void ExecuteScript(const string16& javascript); // Helper method to send a response back to the client. Deletes this. void SendMessage(bool success); diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 12c752c..f98d4895 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -647,8 +647,8 @@ void TestingAutomationProvider::Reload(int handle, } void TestingAutomationProvider::SetAuth(int tab_handle, - const std::wstring& username, - const std::wstring& password, + const string16& username, + const string16& password, IPC::Message* reply_message) { if (tab_tracker_->ContainsHandle(tab_handle)) { NavigationController* tab = tab_tracker_->GetResource(tab_handle); @@ -935,15 +935,15 @@ void TestingAutomationProvider::GetTabProcessID(int handle, int* process_id) { void TestingAutomationProvider::GetTabTitle(int handle, int* title_string_size, - std::wstring* title) { + string16* title) { *title_string_size = -1; // -1 is the error code if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); NavigationEntry* entry = tab->GetActiveEntry(); if (entry != NULL) { - *title = UTF16ToWideHack(entry->title()); + *title = entry->title(); } else { - *title = std::wstring(); + *title = string16(); } *title_string_size = static_cast<int>(title->size()); } @@ -1116,8 +1116,8 @@ void TestingAutomationProvider::AutocompleteEditIsQueryInProgress( void TestingAutomationProvider::ExecuteJavascript( int handle, - const std::wstring& frame_xpath, - const std::wstring& script, + const string16& frame_xpath, + const string16& script, IPC::Message* reply_message) { TabContents* tab_contents = GetTabContentsForHandle(handle, NULL); if (!tab_contents) { @@ -1139,7 +1139,7 @@ void TestingAutomationProvider::ExecuteJavascript( reply_message_ = reply_message; tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( - frame_xpath, UTF8ToWide(set_automation_id)); + frame_xpath, UTF8ToUTF16(set_automation_id)); tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( frame_xpath, script); } @@ -1523,7 +1523,7 @@ void TestingAutomationProvider::WaitForBookmarkModelToLoad( void TestingAutomationProvider::AddBookmarkGroup(int handle, int64 parent_id, int index, - std::wstring title, + const string16& title, bool* success) { if (browser_tracker_->ContainsHandle(handle)) { Browser* browser = browser_tracker_->GetResource(handle); @@ -1536,8 +1536,7 @@ void TestingAutomationProvider::AddBookmarkGroup(int handle, const BookmarkNode* parent = model->GetNodeByID(parent_id); DCHECK(parent); if (parent) { - const BookmarkNode* child = model->AddGroup(parent, index, - WideToUTF16Hack(title)); + const BookmarkNode* child = model->AddGroup(parent, index, title); DCHECK(child); if (child) *success = true; @@ -1550,7 +1549,7 @@ void TestingAutomationProvider::AddBookmarkGroup(int handle, void TestingAutomationProvider::AddBookmarkURL(int handle, int64 parent_id, int index, - std::wstring title, + const string16& title, const GURL& url, bool* success) { if (browser_tracker_->ContainsHandle(handle)) { @@ -1564,8 +1563,7 @@ void TestingAutomationProvider::AddBookmarkURL(int handle, const BookmarkNode* parent = model->GetNodeByID(parent_id); DCHECK(parent); if (parent) { - const BookmarkNode* child = model->AddURL(parent, index, - WideToUTF16Hack(title), url); + const BookmarkNode* child = model->AddURL(parent, index, title, url); DCHECK(child); if (child) *success = true; @@ -1603,7 +1601,7 @@ void TestingAutomationProvider::ReparentBookmark(int handle, void TestingAutomationProvider::SetBookmarkTitle(int handle, int64 id, - std::wstring title, + const string16& title, bool* success) { if (browser_tracker_->ContainsHandle(handle)) { Browser* browser = browser_tracker_->GetResource(handle); @@ -1616,7 +1614,7 @@ void TestingAutomationProvider::SetBookmarkTitle(int handle, const BookmarkNode* node = model->GetNodeByID(id); DCHECK(node); if (node) { - model->SetTitle(node, WideToUTF16Hack(title)); + model->SetTitle(node, title); *success = true; } } diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index bd42171..731cb2c 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -83,8 +83,8 @@ class TestingAutomationProvider : public AutomationProvider, WindowOpenDisposition disposition, bool* status); void Reload(int handle, IPC::Message* reply_message); - void SetAuth(int tab_handle, const std::wstring& username, - const std::wstring& password, IPC::Message* reply_message); + void SetAuth(int tab_handle, const string16& username, + const string16& password, IPC::Message* reply_message); void CancelAuth(int tab_handle, IPC::Message* reply_message); void NeedsAuth(int tab_handle, bool* needs_auth); void GetRedirectsFrom(int tab_handle, @@ -126,7 +126,7 @@ class TestingAutomationProvider : public AutomationProvider, void GetType(int handle, int* type_as_int); void GetTab(int win_handle, int tab_index, int* tab_handle); void GetTabProcessID(int handle, int* process_id); - void GetTabTitle(int handle, int* title_string_size, std::wstring* title); + void GetTabTitle(int handle, int* title_string_size, string16* title); void GetTabIndex(int handle, int* tabstrip_index); void GetTabURL(int handle, bool* success, GURL* url); void GetShelfVisibility(int handle, bool* visible); @@ -159,8 +159,8 @@ class TestingAutomationProvider : public AutomationProvider, IPC::Message* reply_message); void ExecuteJavascript(int handle, - const std::wstring& frame_xpath, - const std::wstring& script, + const string16& frame_xpath, + const string16& script, IPC::Message* reply_message); void GetConstrainedWindowCount(int handle, int* count); @@ -270,17 +270,17 @@ class TestingAutomationProvider : public AutomationProvider, // Editing, modification, and removal of bookmarks. // Bookmarks are referenced by id. void AddBookmarkGroup(int handle, - int64 parent_id, int index, std::wstring title, + int64 parent_id, int index, const string16& title, bool* success); void AddBookmarkURL(int handle, int64 parent_id, int index, - std::wstring title, const GURL& url, + const string16& title, const GURL& url, bool* success); void ReparentBookmark(int handle, int64 id, int64 new_parent_id, int index, bool* success); void SetBookmarkTitle(int handle, - int64 id, std::wstring title, + int64 id, const string16& title, bool* success); void SetBookmarkURL(int handle, int64 id, const GURL& url, diff --git a/chrome/browser/automation/testing_automation_provider_win.cc b/chrome/browser/automation/testing_automation_provider_win.cc index 8cd2a72..f2d6ed1 100644 --- a/chrome/browser/automation/testing_automation_provider_win.cc +++ b/chrome/browser/automation/testing_automation_provider_win.cc @@ -82,7 +82,7 @@ void TestingAutomationProvider::SetWindowVisible(int handle, void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { gfx::NativeWindow window = window_tracker_->GetResource(handle); - std::wstring result; + string16 result; int length = ::GetWindowTextLength(window) + 1; ::GetWindowText(window, WriteInto(&result, length), length); text->assign(WideToUTF16(result)); diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc index 55a2a84..d928714 100644 --- a/chrome/browser/browser_browsertest.cc +++ b/chrome/browser/browser_browsertest.cc @@ -47,13 +47,13 @@ namespace { -const std::string BEFORE_UNLOAD_HTML = +const char* kBeforeUnloadHTML = "<html><head><title>beforeunload</title></head><body>" "<script>window.onbeforeunload=function(e){return 'foo'}</script>" "</body></html>"; -const std::wstring OPEN_NEW_BEFOREUNLOAD_PAGE = - L"w=window.open(); w.onbeforeunload=function(e){return 'foo'};"; +const char* kOpenNewBeforeUnloadPage = + "w=window.open(); w.onbeforeunload=function(e){return 'foo'};"; const FilePath::CharType* kTitle1File = FILE_PATH_LITERAL("title1.html"); const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); @@ -211,8 +211,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, JavascriptAlertActivatesTab) { EXPECT_EQ(0, browser()->selected_index()); TabContents* second_tab = browser()->GetTabContentsAt(1); ASSERT_TRUE(second_tab); - second_tab->render_view_host()->ExecuteJavascriptInWebFrame(L"", - L"alert('Activate!');"); + second_tab->render_view_host()->ExecuteJavascriptInWebFrame( + string16(), + ASCIIToUTF16("alert('Activate!');")); AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); alert->CloseModalDialog(); EXPECT_EQ(2, browser()->tab_count()); @@ -246,7 +247,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ThirtyFourTabs) { // Test for crbug.com/22004. Reloading a page with a before unload handler and // then canceling the dialog should not leave the throbber spinning. IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { - GURL url("data:text/html," + BEFORE_UNLOAD_HTML); + GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); ui_test_utils::NavigateToURL(browser(), url); // Navigate to another page, but click cancel in the dialog. Make sure that @@ -258,7 +259,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { // Clear the beforeunload handler so the test can easily exit. browser()->GetSelectedTabContents()->render_view_host()-> - ExecuteJavascriptInWebFrame(L"", L"onbeforeunload=null;"); + ExecuteJavascriptInWebFrame(string16(), + ASCIIToUTF16("onbeforeunload=null;")); } // Crashy on mac. http://crbug.com/38522 @@ -274,13 +276,15 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { // two beforeunload dialogs shown. IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_SingleBeforeUnloadAfterWindowClose) { browser()->GetSelectedTabContents()->render_view_host()-> - ExecuteJavascriptInWebFrame(L"", OPEN_NEW_BEFOREUNLOAD_PAGE); + ExecuteJavascriptInWebFrame(string16(), + ASCIIToUTF16(kOpenNewBeforeUnloadPage)); // Close the new window with JavaScript, which should show a single // beforeunload dialog. Then show another alert, to make it easy to verify // that a second beforeunload dialog isn't shown. browser()->GetTabContentsAt(0)->render_view_host()-> - ExecuteJavascriptInWebFrame(L"", L"w.close(); alert('bar');"); + ExecuteJavascriptInWebFrame(string16(), + ASCIIToUTF16("w.close(); alert('bar');")); AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); alert->native_dialog()->AcceptAppModalDialog(); diff --git a/chrome/browser/browser_signin.cc b/chrome/browser/browser_signin.cc index b811a3b..17615ec 100644 --- a/chrome/browser/browser_signin.cc +++ b/chrome/browser/browser_signin.cc @@ -169,7 +169,8 @@ void BrowserSigninHtml::HandleSigninInit(const ListValue* args) { return; RenderViewHost* rvh = dom_ui_->tab_contents()->render_view_host(); - rvh->ExecuteJavascriptInWebFrame(L"//iframe[@id='login']", L"hideBlurb();"); + rvh->ExecuteJavascriptInWebFrame(ASCIIToUTF16("//iframe[@id='login']"), + ASCIIToUTF16("hideBlurb();")); DictionaryValue json_args; std::string json; @@ -188,7 +189,8 @@ void BrowserSigninHtml::HandleSigninInit(const ListValue* args) { base::JSONWriter::Write(&json_args, false, &json); javascript += L"showGaiaLogin(" + UTF8ToWide(json) + L");"; - rvh->ExecuteJavascriptInWebFrame(L"//iframe[@id='login']", javascript); + rvh->ExecuteJavascriptInWebFrame(ASCIIToUTF16("//iframe[@id='login']"), + WideToUTF16Hack(javascript)); } void BrowserSigninHtml::HandleSubmitAuth(const ListValue* args) { diff --git a/chrome/browser/chromeos/login/account_screen.cc b/chrome/browser/chromeos/login/account_screen.cc index 7d08f2a..e650b3e 100644 --- a/chrome/browser/chromeos/login/account_screen.cc +++ b/chrome/browser/chromeos/login/account_screen.cc @@ -126,7 +126,7 @@ void AccountScreen::NavigationStateChanged(const TabContents* source, source->render_view_host()->InsertCSSInWebFrame( L"", kCreateAccountCSS, ""); source->render_view_host()->ExecuteJavascriptInWebFrame( - L"", ASCIIToWide(kCreateAccountJS)); + string16(), ASCIIToUTF16(kCreateAccountJS)); } } diff --git a/chrome/browser/chromeos/views/webui_menu_widget.cc b/chrome/browser/chromeos/views/webui_menu_widget.cc index 6f60db2..aec2f96 100644 --- a/chrome/browser/chromeos/views/webui_menu_widget.cc +++ b/chrome/browser/chromeos/views/webui_menu_widget.cc @@ -9,6 +9,7 @@ #include "base/stringprintf.h" #include "base/singleton.h" #include "base/task.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/views/menu_locator.h" #include "chrome/browser/chromeos/views/native_menu_webui.h" #include "chrome/browser/chromeos/wm_ipc.h" @@ -27,7 +28,7 @@ namespace { -// Colors for menu's graident background. +// Colors for the menu's gradient background. const SkColor kMenuStartColor = SK_ColorWHITE; const SkColor kMenuEndColor = 0xFFEEEEEE; @@ -41,7 +42,7 @@ class RoundedBorder : public views::Border { } private: - // views::Border implementatios. + // views::Border implementations. virtual void Paint(const views::View& view, gfx::Canvas* canvas) const { const SkScalar* corners = menu_locator_->GetCorners(); // The menu is in off screen so no need to draw corners. @@ -80,7 +81,7 @@ class InsetsLayout : public views::LayoutManager { InsetsLayout() : views::LayoutManager() {} private: - // views::LayoutManager implementatios. + // views::LayoutManager implementations. virtual void Layout(views::View* host) { if (host->GetChildViewCount() == 0) return; @@ -253,7 +254,7 @@ void WebUIMenuWidget::ExecuteJavascript(const std::wstring& script) { DCHECK(dom_view_->tab_contents()->render_view_host()); dom_view_->tab_contents()->render_view_host()-> - ExecuteJavascriptInWebFrame(std::wstring(), script); + ExecuteJavascriptInWebFrame(string16(), WideToUTF16Hack(script)); } void WebUIMenuWidget::ShowAt(chromeos::MenuLocator* locator) { diff --git a/chrome/browser/debugger/debugger_remote_service.cc b/chrome/browser/debugger/debugger_remote_service.cc index e2ea5f2..b930365 100644 --- a/chrome/browser/debugger/debugger_remote_service.cc +++ b/chrome/browser/debugger/debugger_remote_service.cc @@ -330,7 +330,7 @@ bool DebuggerRemoteService::DispatchEvaluateJavascript( } std::string javascript; content->GetString(kDataKey, &javascript); - render_view_host->ExecuteJavascriptInWebFrame(std::wstring(), - UTF8ToWide(javascript)); + render_view_host->ExecuteJavascriptInWebFrame(string16(), + UTF8ToUTF16(javascript)); return false; } diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index 26c1025..07caf026 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -276,17 +276,17 @@ bool DevToolsWindow::IsInspectedBrowserPopup() { } void DevToolsWindow::SetAttachedWindow() { - tab_contents_->render_view_host()-> - ExecuteJavascriptInWebFrame( - L"", docked_ ? L"WebInspector.setAttachedWindow(true);" : - L"WebInspector.setAttachedWindow(false);"); + tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( + string16(), + docked_ ? ASCIIToUTF16("WebInspector.setAttachedWindow(true);") + : ASCIIToUTF16("WebInspector.setAttachedWindow(false);")); } void DevToolsWindow::AddDevToolsExtensionsToClient() { if (inspected_tab_) { FundamentalValue tabId(inspected_tab_->controller().session_id().id()); - CallClientFunction(L"WebInspector.setInspectedTabId", tabId); + CallClientFunction(ASCIIToUTF16("WebInspector.setInspectedTabId"), tabId); } ListValue results; const ExtensionService* extension_service = @@ -306,16 +306,17 @@ void DevToolsWindow::AddDevToolsExtensionsToClient() { new StringValue((*extension)->devtools_url().spec())); results.Append(extension_info); } - CallClientFunction(L"WebInspector.addExtensions", results); + CallClientFunction(ASCIIToUTF16("WebInspector.addExtensions"), results); } -void DevToolsWindow::CallClientFunction(const std::wstring& function_name, - const Value& arg) { +void DevToolsWindow::CallClientFunction(const string16& function_name, + const Value& arg) { std::string json; base::JSONWriter::Write(&arg, false, &json); - std::wstring javascript = function_name + L"(" + UTF8ToWide(json) + L");"; + string16 javascript = function_name + char16('(') + UTF8ToUTF16(json) + + ASCIIToUTF16(");"); tab_contents_->render_view_host()-> - ExecuteJavascriptInWebFrame(L"", javascript); + ExecuteJavascriptInWebFrame(string16(), javascript); } void DevToolsWindow::Observe(NotificationType type, @@ -352,13 +353,12 @@ void DevToolsWindow::DoAction() { // TODO: these messages should be pushed through the WebKit API instead. switch (action_on_load_) { case DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE: - tab_contents_->render_view_host()-> - ExecuteJavascriptInWebFrame(L"", L"WebInspector.showConsole();"); + tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( + string16(), ASCIIToUTF16("WebInspector.showConsole();")); break; case DEVTOOLS_TOGGLE_ACTION_INSPECT: - tab_contents_->render_view_host()-> - ExecuteJavascriptInWebFrame( - L"", L"WebInspector.toggleSearchingForNode();"); + tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( + string16(), ASCIIToUTF16("WebInspector.toggleSearchingForNode();")); case DEVTOOLS_TOGGLE_ACTION_NONE: // Do nothing. break; @@ -407,7 +407,7 @@ void DevToolsWindow::UpdateTheme() { SkColorToRGBAString(color_toolbar).c_str(), SkColorToRGBAString(color_tab_text).c_str()); tab_contents_->render_view_host()-> - ExecuteJavascriptInWebFrame(L"", UTF8ToWide(command)); + ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(command)); } void DevToolsWindow::AddNewContents(TabContents* source, diff --git a/chrome/browser/debugger/devtools_window.h b/chrome/browser/debugger/devtools_window.h index d5a81c6..689ae40 100644 --- a/chrome/browser/debugger/devtools_window.h +++ b/chrome/browser/debugger/devtools_window.h @@ -68,7 +68,7 @@ class DevToolsWindow GURL GetDevToolsUrl(); void UpdateTheme(); void AddDevToolsExtensionsToClient(); - void CallClientFunction(const std::wstring& function_name, + void CallClientFunction(const string16& function_name, const Value& arg); // Overridden from TabContentsDelegate. virtual void OpenURLFromTab(TabContents* source, diff --git a/chrome/browser/default_plugin_uitest.cc b/chrome/browser/default_plugin_uitest.cc index 5bd0afa..f7b70f9 100644 --- a/chrome/browser/default_plugin_uitest.cc +++ b/chrome/browser/default_plugin_uitest.cc @@ -4,6 +4,7 @@ #include "base/basictypes.h" #include "base/file_path.h" +#include "base/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/ui/ui_test.h" @@ -30,9 +31,9 @@ TEST_F(DefaultPluginUITest, MAYBE_DefaultPluginLoadTest) { // Check that the default plugin was loaded. It executes a bit of javascript // in the HTML file which replaces the innerHTML of div |result| with "DONE". scoped_refptr<TabProxy> tab(GetActiveTab()); - std::wstring out; - ASSERT_TRUE(tab->ExecuteAndExtractString(L"", - L"domAutomationController.send(" - L"document.getElementById('result').innerHTML)", &out)); - ASSERT_EQ(L"DONE", out); + string16 out; + ASSERT_TRUE(tab->ExecuteAndExtractString(string16(), + ASCIIToUTF16("domAutomationController.send(" + "document.getElementById('result').innerHTML)"), &out)); + ASSERT_EQ(ASCIIToUTF16("DONE"), out); } diff --git a/chrome/browser/dom_ui/bookmarks_ui_uitest.cc b/chrome/browser/dom_ui/bookmarks_ui_uitest.cc index 04c37f6..476caec 100644 --- a/chrome/browser/dom_ui/bookmarks_ui_uitest.cc +++ b/chrome/browser/dom_ui/bookmarks_ui_uitest.cc @@ -5,6 +5,7 @@ #include "chrome/test/ui/ui_test.h" #include "base/test/test_timeouts.h" +#include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/common/url_constants.h" #include "chrome/test/automation/browser_proxy.h" @@ -48,13 +49,13 @@ class BookmarksUITest : public UITest { void AssertIsBookmarksPage(TabProxy* tab) { // tab->GetCurrentURL is not up to date. GURL url; - std::wstring out; - ASSERT_TRUE(tab->ExecuteAndExtractString(L"", - L"domAutomationController.send(location.protocol)", &out)); - ASSERT_EQ(L"chrome-extension:", out); - ASSERT_TRUE(tab->ExecuteAndExtractString(L"", - L"domAutomationController.send(location.pathname)", &out)); - ASSERT_EQ(L"/main.html", out); + string16 out; + ASSERT_TRUE(tab->ExecuteAndExtractString(string16(), + ASCIIToUTF16("domAutomationController.send(location.protocol)"), &out)); + ASSERT_EQ(ASCIIToUTF16("chrome-extension:"), out); + ASSERT_TRUE(tab->ExecuteAndExtractString(string16(), + ASCIIToUTF16("domAutomationController.send(location.pathname)"), &out)); + ASSERT_EQ(ASCIIToUTF16("/main.html"), out); } }; diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc index d91aac9..59a3338 100644 --- a/chrome/browser/dom_ui/dom_ui.cc +++ b/chrome/browser/dom_ui/dom_ui.cc @@ -152,7 +152,8 @@ void DOMUI::AddMessageHandler(DOMMessageHandler* handler) { } void DOMUI::ExecuteJavascript(const std::wstring& javascript) { - GetRenderViewHost()->ExecuteJavascriptInWebFrame(std::wstring(), javascript); + GetRenderViewHost()->ExecuteJavascriptInWebFrame(string16(), + WideToUTF16Hack(javascript)); } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/dom_ui/dom_ui_handler_browsertest.cc b/chrome/browser/dom_ui/dom_ui_handler_browsertest.cc index 89acbcb..0405fce 100644 --- a/chrome/browser/dom_ui/dom_ui_handler_browsertest.cc +++ b/chrome/browser/dom_ui/dom_ui_handler_browsertest.cc @@ -10,7 +10,7 @@ bool DOMUITestHandler::Execute(const std::string& js_test) { dom_ui_->GetRenderViewHost()->ExecuteJavascriptInWebFrame( - std::wstring(), UTF8ToWide(js_test)); + string16(), UTF8ToUTF16(js_test)); return WaitForResult(); } diff --git a/chrome/browser/dom_ui/new_tab_ui_uitest.cc b/chrome/browser/dom_ui/new_tab_ui_uitest.cc index 6280582..932caff 100644 --- a/chrome/browser/dom_ui/new_tab_ui_uitest.cc +++ b/chrome/browser/dom_ui/new_tab_ui_uitest.cc @@ -5,6 +5,7 @@ #include "chrome/test/ui/ui_test.h" #include "base/test/test_timeouts.h" +#include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/dom_ui/new_tab_ui.h" #include "chrome/browser/prefs/pref_value_store.h" @@ -73,7 +74,6 @@ TEST_F(NewTabUITest, DISABLED_NTPHasLoginName) { scoped_refptr<TabProxy> tab = window->GetActiveTab(); ASSERT_TRUE(tab.get()); - std::wstring displayed_username; // The login span should be eventually populated and have the // correct value. ASSERT_TRUE(WaitUntilJavaScriptCondition(tab, L"", @@ -81,13 +81,14 @@ TEST_F(NewTabUITest, DISABLED_NTPHasLoginName) { L"document.getElementById('login-username').innerText.length > 0)", TestTimeouts::action_max_timeout_ms())); + string16 displayed_username; ASSERT_TRUE(tab->ExecuteAndExtractString( - L"", - L"window.domAutomationController.send(" - L"document.getElementById('login-username').innerText)", + string16(), + ASCIIToUTF16("window.domAutomationController.send(" + "document.getElementById('login-username').innerText)"), &displayed_username)); - EXPECT_EQ(L"user@gmail.com", displayed_username); + EXPECT_EQ(ASCIIToUTF16("user@gmail.com"), displayed_username); } // Loads about:hang into two NTP tabs, ensuring we don't crash. @@ -160,9 +161,10 @@ TEST_F(NewTabUITest, FLAKY_ChromeInternalLoadsNTP) { // Ensure there are some thumbnails loaded in the page. int thumbnails_count = -1; - ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", - L"window.domAutomationController.send(" - L"document.getElementsByClassName('thumbnail-container').length)", + ASSERT_TRUE(tab->ExecuteAndExtractInt( + string16(), + ASCIIToUTF16("window.domAutomationController.send(" + "document.getElementsByClassName('thumbnail-container').length)"), &thumbnails_count)); EXPECT_GT(thumbnails_count, 0); } diff --git a/chrome/browser/dom_ui/options/options_ui_uitest.cc b/chrome/browser/dom_ui/options/options_ui_uitest.cc index a7cd621..498a62f 100644 --- a/chrome/browser/dom_ui/options/options_ui_uitest.cc +++ b/chrome/browser/dom_ui/options/options_ui_uitest.cc @@ -26,10 +26,10 @@ class OptionsUITest : public UITest { } void AssertIsOptionsPage(TabProxy* tab) { - std::wstring title; + string16 title; ASSERT_TRUE(tab->GetTabTitle(&title)); string16 expected_title = l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE); - ASSERT_EQ(expected_title, WideToUTF16Hack(title)); + ASSERT_EQ(expected_title, title); } }; diff --git a/chrome/browser/dom_ui/print_preview_ui_uitest.cc b/chrome/browser/dom_ui/print_preview_ui_uitest.cc index 33dd66e..588d93d 100644 --- a/chrome/browser/dom_ui/print_preview_ui_uitest.cc +++ b/chrome/browser/dom_ui/print_preview_ui_uitest.cc @@ -24,11 +24,11 @@ class PrintPreviewUITest : public UITest { } void AssertIsPrintPage(TabProxy* tab) { - std::wstring title; + string16 title; ASSERT_TRUE(tab->GetTabTitle(&title)); string16 expected_title = l10n_util::GetStringUTF16(IDS_PRINT_PREVIEW_TITLE); - ASSERT_EQ(expected_title, WideToUTF16Hack(title)); + ASSERT_EQ(expected_title, title); } }; diff --git a/chrome/browser/extensions/alert_apitest.cc b/chrome/browser/extensions/alert_apitest.cc index 10b310b..cbe2a78 100644 --- a/chrome/browser/extensions/alert_apitest.cc +++ b/chrome/browser/extensions/alert_apitest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/utf_string_conversions.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/extensions/extension_process_manager.h" @@ -18,8 +19,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, AlertBasic) { ExtensionHost* host = browser()->profile()->GetExtensionProcessManager()-> GetBackgroundHostForExtension(extension); ASSERT_TRUE(host); - host->render_view_host()->ExecuteJavascriptInWebFrame(L"", - L"alert('This should not crash.');"); + host->render_view_host()->ExecuteJavascriptInWebFrame(string16(), + ASCIIToUTF16("alert('This should not crash.');")); AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); ASSERT_TRUE(alert); diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index 43c2eab..d31ba67 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc @@ -51,7 +51,7 @@ class IFrameLoader : public NotificationObserver { iframe_id, url.spec().c_str()); browser->GetSelectedTabContents()->render_view_host()-> - ExecuteJavascriptInWebFrame(L"", UTF8ToWide(script)); + ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(script)); ui_test_utils::RunMessageLoop(); EXPECT_EQ(StringPrintf("\"%d\"", iframe_id), javascript_response_); @@ -130,8 +130,8 @@ class GeolocationNotificationObserver : public NotificationObserver { std::string script = "window.domAutomationController.setAutomationId(0);" "window.domAutomationController.send(geoStart());"; - render_view_host->ExecuteJavascriptInWebFrame(iframe_xpath, - UTF8ToWide(script)); + render_view_host->ExecuteJavascriptInWebFrame(WideToUTF16Hack(iframe_xpath), + UTF8ToUTF16(script)); ui_test_utils::RunMessageLoop(); registrar_.RemoveAll(); LOG(WARNING) << "got geolocation watch" << javascript_response_; diff --git a/chrome/browser/history/multipart_uitest.cc b/chrome/browser/history/multipart_uitest.cc index 34d7625..a14f230 100644 --- a/chrome/browser/history/multipart_uitest.cc +++ b/chrome/browser/history/multipart_uitest.cc @@ -7,6 +7,7 @@ #include "app/sql/connection.h" #include "app/sql/statement.h" #include "base/file_util.h" +#include "base/utf_string_conversions.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/browser_proxy.h" #include "net/test/test_server.h" @@ -32,9 +33,9 @@ TEST_F(MultipartResponseUITest, SingleVisit) { scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); NavigateToURL(test_server.GetURL("multipart")); - std::wstring title; + string16 title; EXPECT_TRUE(tab_proxy->GetTabTitle(&title)); - EXPECT_EQ(L"page 9", title); + EXPECT_EQ(ASCIIToUTF16("page 9"), title); CloseBrowserAndServer(); // The browser has shutdown now. Check the contents of the history diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc index db19dfe..2423202 100644 --- a/chrome/browser/history/redirect_uitest.cc +++ b/chrome/browser/history/redirect_uitest.cc @@ -260,9 +260,9 @@ TEST_F(RedirectTest, FLAKY_NoHttpToFile) { // title from the file, because the nav should not have taken place. scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); - std::wstring actual_title; + string16 actual_title; ASSERT_TRUE(tab_proxy->GetTabTitle(&actual_title)); - EXPECT_NE("File!", WideToUTF8(actual_title)); + EXPECT_NE("File!", UTF16ToUTF8(actual_title)); } // Ensures that non-user initiated location changes (within page) are @@ -315,8 +315,8 @@ TEST_F(RedirectTest, // hasn't completed. Our time is now! NavigateToURL(final_url); - std::wstring tab_title; - std::wstring final_url_title = UTF8ToWide("Title Of Awesomeness"); + string16 tab_title; + string16 final_url_title = ASCIIToUTF16("Title Of Awesomeness"); // Wait till the final page has been loaded. for (int i = 0; i < 10; ++i) { base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); diff --git a/chrome/browser/notifications/notifications_interactive_uitest.cc b/chrome/browser/notifications/notifications_interactive_uitest.cc index d2ace68..7affc66 100644 --- a/chrome/browser/notifications/notifications_interactive_uitest.cc +++ b/chrome/browser/notifications/notifications_interactive_uitest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/utf_string_conversions.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/ui/ui_test.h" @@ -35,8 +36,8 @@ TEST_F(NotificationsPermissionTest, FLAKY_TestUserGestureInfobar) { // That's considered a user gesture to webkit, and should produce an infobar. bool result; ASSERT_TRUE(tab->ExecuteAndExtractBool( - L"", - L"window.domAutomationController.send(request());", + string16(), + ASCIIToUTF16("window.domAutomationController.send(request());"), &result)); EXPECT_TRUE(result); diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc index 3277f8d..fd3b87a 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc @@ -291,6 +291,7 @@ void CloudPrintSetupFlow::ExecuteJavascriptInIFrame( const std::wstring& js) { if (dom_ui_) { RenderViewHost* rvh = dom_ui_->tab_contents()->render_view_host(); - rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); + rvh->ExecuteJavascriptInWebFrame(WideToUTF16Hack(iframe_xpath), + WideToUTF16Hack(js)); } } diff --git a/chrome/browser/printing/print_dialog_cloud_uitest.cc b/chrome/browser/printing/print_dialog_cloud_uitest.cc index e64ff81..caced65 100644 --- a/chrome/browser/printing/print_dialog_cloud_uitest.cc +++ b/chrome/browser/printing/print_dialog_cloud_uitest.cc @@ -12,6 +12,7 @@ #include "base/path_service.h" #include "base/singleton.h" #include "base/threading/thread_restrictions.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_thread.h" @@ -249,9 +250,9 @@ IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, DISABLED_DialogGrabbed) { ASSERT_TRUE(browser()->GetSelectedTabContents()); ASSERT_TRUE(browser()->GetSelectedTabContents()->render_view_host()); - std::wstring window_print(L"window.print()"); + string16 window_print = ASCIIToUTF16("window.print()"); browser()->GetSelectedTabContents()->render_view_host()-> - ExecuteJavascriptInWebFrame(std::wstring(), window_print); + ExecuteJavascriptInWebFrame(string16(), window_print); ui_test_utils::RunMessageLoop(); diff --git a/chrome/browser/remoting/setup_flow.cc b/chrome/browser/remoting/setup_flow.cc index 7e0c1bc..ba43543 100644 --- a/chrome/browser/remoting/setup_flow.cc +++ b/chrome/browser/remoting/setup_flow.cc @@ -55,7 +55,8 @@ void SetupFlowStepBase::ExecuteJavascriptInIFrame( DCHECK(dom_ui); RenderViewHost* rvh = dom_ui->tab_contents()->render_view_host(); - rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); + rvh->ExecuteJavascriptInWebFrame(WideToUTF16Hack(iframe_xpath), + WideToUTF16Hack(js)); } void SetupFlowStepBase::FinishStep(SetupFlowStep* next_step) { diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index dd2dd5d..22231df 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -471,10 +471,9 @@ void RenderViewHost::ReservePageIDRange(int size) { } void RenderViewHost::ExecuteJavascriptInWebFrame( - const std::wstring& frame_xpath, - const std::wstring& jscript) { - Send(new ViewMsg_ScriptEvalRequest(routing_id(), WideToUTF16(frame_xpath), - WideToUTF16(jscript), + const string16& frame_xpath, + const string16& jscript) { + Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript, 0, false)); } diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 5f6188d..a16168a 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -261,8 +261,8 @@ class RenderViewHost : public RenderWidgetHost { void ReservePageIDRange(int size); // Runs some javascript within the context of a frame in the page. - void ExecuteJavascriptInWebFrame(const std::wstring& frame_xpath, - const std::wstring& jscript); + void ExecuteJavascriptInWebFrame(const string16& frame_xpath, + const string16& jscript); // Runs some javascript within the context of a frame in the page. The result // is sent back via the notification EXECUTE_JAVASCRIPT_RESULT. diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc index 5271595..b11273d 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc @@ -10,6 +10,7 @@ #include "base/path_service.h" #include "base/string_util.h" #include "base/test/test_timeouts.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/net/url_request_failed_dns_job.h" #include "chrome/browser/net/url_request_mock_http_job.h" #include "chrome/common/url_constants.h" @@ -93,8 +94,10 @@ TEST_F(ResourceDispatcherTest, FLAKY_SyncXMLHttpRequest) { // Let's check the XMLHttpRequest ran successfully. bool success = false; - EXPECT_TRUE(tab->ExecuteAndExtractBool(L"", - L"window.domAutomationController.send(DidSyncRequestSucceed());", + EXPECT_TRUE(tab->ExecuteAndExtractBool( + string16(), + ASCIIToUTF16("window.domAutomationController.send(" + "DidSyncRequestSucceed());"), &success)); EXPECT_TRUE(success); } @@ -115,8 +118,9 @@ TEST_F(ResourceDispatcherTest, FLAKY_SyncXMLHttpRequest_Disallowed) { // Let's check the XMLHttpRequest ran successfully. bool success = false; - EXPECT_TRUE(tab->ExecuteAndExtractBool(L"", - L"window.domAutomationController.send(DidSucceed());", + EXPECT_TRUE(tab->ExecuteAndExtractBool( + string16(), + ASCIIToUTF16("window.domAutomationController.send(DidSucceed());"), &success)); EXPECT_TRUE(success); } @@ -140,9 +144,9 @@ TEST_F(ResourceDispatcherTest, DISABLED_SyncXMLHttpRequest_DuringUnload) { "files/sync_xmlhttprequest_during_unload.html"))); // Confirm that the page has loaded (since it changes its title during load). - std::wstring tab_title; + string16 tab_title; EXPECT_TRUE(tab->GetTabTitle(&tab_title)); - EXPECT_EQ(L"sync xhr on unload", tab_title); + EXPECT_EQ(ASCIIToUTF16("sync xhr on unload"), tab_title); // Navigate to a new page, to dispatch unload event and trigger xhr. // (the bug would make this step hang the renderer). @@ -151,7 +155,7 @@ TEST_F(ResourceDispatcherTest, DISABLED_SyncXMLHttpRequest_DuringUnload) { // Check that the new page got loaded, and that no download was triggered. EXPECT_TRUE(tab->GetTabTitle(&tab_title)); - EXPECT_EQ(L"Title Of Awesomeness", tab_title); + EXPECT_EQ(ASCIIToUTF16("Title Of Awesomeness"), tab_title); bool shelf_is_visible = false; scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); @@ -175,9 +179,9 @@ TEST_F(ResourceDispatcherTest, CrossSiteOnunloadCookie) { ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); // Confirm that the page has loaded (since it changes its title during load). - std::wstring tab_title; + string16 tab_title; EXPECT_TRUE(tab->GetTabTitle(&tab_title)); - EXPECT_EQ(L"set cookie on unload", tab_title); + EXPECT_EQ(ASCIIToUTF16("set cookie on unload"), tab_title); // Navigate to a new cross-site page, to dispatch unload event and set the // cookie. @@ -263,9 +267,9 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) { ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); // Confirm that the page has loaded (since it changes its title during load). - std::wstring tab_title; + string16 tab_title; EXPECT_TRUE(tab->GetTabTitle(&tab_title)); - EXPECT_EQ(L"set cookie on unload", tab_title); + EXPECT_EQ(ASCIIToUTF16("set cookie on unload"), tab_title); // Navigate to a new cross-site URL that results in an error page. // TODO(creis): If this causes crashes or hangs, it might be for the same @@ -294,7 +298,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationErrorPage) { ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(GURL(redirect_url))); EXPECT_TRUE(tab->GetTabTitle(&tab_title)); - EXPECT_EQ(L"Title Of Awesomeness", tab_title); + EXPECT_EQ(ASCIIToUTF16("Title Of Awesomeness"), tab_title); } TEST_F(ResourceDispatcherTest, CrossOriginRedirectBlocked) { @@ -327,9 +331,9 @@ TEST_F(ResourceDispatcherTest, CrossSiteFailedRequest) { ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(broken_url)); // Make sure the navigation finishes. - std::wstring tab_title; + string16 tab_title; EXPECT_TRUE(tab->GetTabTitle(&tab_title)); - EXPECT_EQ(L"chrome://theme/ is not available", tab_title); + EXPECT_EQ(ASCIIToUTF16("chrome://theme/ is not available"), tab_title); } } // namespace diff --git a/chrome/browser/session_history_uitest.cc b/chrome/browser/session_history_uitest.cc index b65c90c..abadd32 100644 --- a/chrome/browser/session_history_uitest.cc +++ b/chrome/browser/session_history_uitest.cc @@ -1,8 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/common/url_constants.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/browser_proxy.h" @@ -61,9 +62,9 @@ class SessionHistoryTest : public UITest { } std::wstring GetTabTitle() { - std::wstring title; + string16 title; EXPECT_TRUE(tab_->GetTabTitle(&title)); - return title; + return UTF16ToWideHack(title); } GURL GetTabURL() { @@ -535,23 +536,31 @@ TEST_F(SessionHistoryTest, DISABLED_HistoryLength) { int length; ASSERT_TRUE(tab_->ExecuteAndExtractInt( - L"", L"domAutomationController.send(history.length)", &length)); + string16(), + ASCIIToUTF16("domAutomationController.send(history.length)"), + &length)); EXPECT_EQ(1, length); ASSERT_TRUE(tab_->NavigateToURL(test_server_.GetURL("files/title1.html"))); ASSERT_TRUE(tab_->ExecuteAndExtractInt( - L"", L"domAutomationController.send(history.length)", &length)); + string16(), + ASCIIToUTF16("domAutomationController.send(history.length)"), + &length)); EXPECT_EQ(2, length); // Now test that history.length is updated when the navigation is committed. ASSERT_TRUE(tab_->NavigateToURL(test_server_.GetURL( "files/session_history/record_length.html"))); ASSERT_TRUE(tab_->ExecuteAndExtractInt( - L"", L"domAutomationController.send(history.length)", &length)); + string16(), + ASCIIToUTF16("domAutomationController.send(history.length)"), + &length)); EXPECT_EQ(3, length); ASSERT_TRUE(tab_->ExecuteAndExtractInt( - L"", L"domAutomationController.send(history_length)", &length)); + string16(), + ASCIIToUTF16("domAutomationController.send(history_length)"), + &length)); EXPECT_EQ(3, length); ASSERT_TRUE(tab_->GoBack()); @@ -560,7 +569,9 @@ TEST_F(SessionHistoryTest, DISABLED_HistoryLength) { // Ensure history.length is properly truncated. ASSERT_TRUE(tab_->NavigateToURL(test_server_.GetURL("files/title2.html"))); ASSERT_TRUE(tab_->ExecuteAndExtractInt( - L"", L"domAutomationController.send(history.length)", &length)); + string16(), + ASCIIToUTF16("domAutomationController.send(history.length)"), + &length)); EXPECT_EQ(2, length); } diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index 71bec48..0d90f80 100644 --- a/chrome/browser/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -357,7 +357,8 @@ void FlowHandler::ExecuteJavascriptInIFrame(const std::wstring& iframe_xpath, const std::wstring& js) { if (dom_ui_) { RenderViewHost* rvh = dom_ui_->tab_contents()->render_view_host(); - rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); + rvh->ExecuteJavascriptInWebFrame(WideToUTF16Hack(iframe_xpath), + WideToUTF16Hack(js)); } } diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm index 3a10095..b99fcd8 100644 --- a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm @@ -285,9 +285,9 @@ return nil; } - std::wstring script = base::SysNSStringToWide( + string16 script = base::SysNSStringToUTF16( [[command evaluatedArguments] objectForKey:@"javascript"]); - view->ExecuteJavascriptInWebFrame(L"", script); + view->ExecuteJavascriptInWebFrame(string16(), script); // TODO(Shreyas): Figure out a way to get the response back. return nil; diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc index 380f7b5..4f8189a 100644 --- a/chrome/browser/ui/login/login_prompt.cc +++ b/chrome/browser/ui/login/login_prompt.cc @@ -124,8 +124,8 @@ RenderViewHostDelegate* LoginHandler::GetRenderViewHostDelegate() const { return rvh->delegate(); } -void LoginHandler::SetAuth(const std::wstring& username, - const std::wstring& password) { +void LoginHandler::SetAuth(const string16& username, + const string16& password) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (TestAndSetAuthHandled()) @@ -133,8 +133,8 @@ void LoginHandler::SetAuth(const std::wstring& username, // Tell the password manager the credentials were submitted / accepted. if (password_manager_) { - password_form_.username_value = WideToUTF16Hack(username); - password_form_.password_value = WideToUTF16Hack(password); + password_form_.username_value = username; + password_form_.password_value = password; password_manager_->ProvisionallySavePassword(password_form_); } @@ -293,8 +293,8 @@ void LoginHandler::NotifyAuthCancelled() { Details<LoginNotificationDetails>(&details)); } -void LoginHandler::NotifyAuthSupplied(const std::wstring& username, - const std::wstring& password) { +void LoginHandler::NotifyAuthSupplied(const string16& username, + const string16& password) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(WasAuthHandled()); @@ -345,12 +345,12 @@ bool LoginHandler::TestAndSetAuthHandled() { } // Calls SetAuth from the IO loop. -void LoginHandler::SetAuthDeferred(const std::wstring& username, - const std::wstring& password) { +void LoginHandler::SetAuthDeferred(const string16& username, + const string16& password) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (request_) { - request_->SetAuth(WideToUTF16Hack(username), WideToUTF16Hack(password)); + request_->SetAuth(username, password); ResetLoginHandlerForRequest(request_); } } @@ -421,8 +421,7 @@ class LoginDialogTask : public Task { l10n_util::GetStringFUTF16(IDS_LOGIN_DIALOG_DESCRIPTION, host_and_port_hack16, realm_hack16); - handler_->BuildViewForPasswordManager(password_manager, - UTF16ToWideHack(explanation)); + handler_->BuildViewForPasswordManager(password_manager, explanation); } private: diff --git a/chrome/browser/ui/login/login_prompt.h b/chrome/browser/ui/login/login_prompt.h index 7c8ae9d..7742996 100644 --- a/chrome/browser/ui/login/login_prompt.h +++ b/chrome/browser/ui/login/login_prompt.h @@ -41,7 +41,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler>, // Initializes the underlying platform specific view. virtual void BuildViewForPasswordManager(PasswordManager* manager, - std::wstring explanation) = 0; + const string16& explanation) = 0; // Sets information about the authentication type (|form|) and the // |password_manager| for this profile. @@ -56,7 +56,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler>, // Resend the request with authentication credentials. // This function can be called from either thread. - void SetAuth(const std::wstring& username, const std::wstring& password); + void SetAuth(const string16& username, const string16& password); // Display the error page without asking for credentials again. // This function can be called from either thread. @@ -99,8 +99,8 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler>, void RemoveObservers(); // Notify observers that authentication is supplied. - void NotifyAuthSupplied(const std::wstring& username, - const std::wstring& password); + void NotifyAuthSupplied(const string16& username, + const string16& password); // Notify observers that authentication is cancelled. void NotifyAuthCancelled(); @@ -110,8 +110,8 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler>, bool TestAndSetAuthHandled(); // Calls SetAuth from the IO loop. - void SetAuthDeferred(const std::wstring& username, - const std::wstring& password); + void SetAuthDeferred(const string16& username, + const string16& password); // Calls CancelAuth from the IO loop. void CancelAuthDeferred(); @@ -179,20 +179,20 @@ class LoginNotificationDetails { class AuthSuppliedLoginNotificationDetails : public LoginNotificationDetails { public: AuthSuppliedLoginNotificationDetails(LoginHandler* handler, - const std::wstring& username, - const std::wstring& password) + const string16& username, + const string16& password) : LoginNotificationDetails(handler), username_(username), password_(password) {} - const std::wstring& username() const { return username_; } - const std::wstring& password() const { return password_; } + const string16& username() const { return username_; } + const string16& password() const { return password_; } private: // The username that was used for the authentication. - const std::wstring username_; + const string16 username_; // The password that was used for the authentication. - const std::wstring password_; + const string16 password_; DISALLOW_COPY_AND_ASSIGN(AuthSuppliedLoginNotificationDetails); }; diff --git a/chrome/browser/ui/login/login_prompt_browsertest.cc b/chrome/browser/ui/login/login_prompt_browsertest.cc index 8c2db99..bc52d66 100644 --- a/chrome/browser/ui/login/login_prompt_browsertest.cc +++ b/chrome/browser/ui/login/login_prompt_browsertest.cc @@ -6,6 +6,7 @@ #include <list> #include <map> +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/ui/browser.h" @@ -56,7 +57,8 @@ void LoginPromptBrowserTest::SetAuthFor(LoginHandler* handler) { EXPECT_TRUE(auth_map_.end() != i); if (i != auth_map_.end()) { const AuthInfo& info = i->second; - handler->SetAuth(info.username_, info.password_); + handler->SetAuth(WideToUTF16Hack(info.username_), + WideToUTF16Hack(info.password_)); } } @@ -364,7 +366,8 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, DISABLED_IncorrectConfirmation) { LoginHandler* handler = *observer.handlers_.begin(); ASSERT_TRUE(handler); - handler->SetAuth(bad_username_, bad_password_); + handler->SetAuth(WideToUTF16Hack(bad_username_), + WideToUTF16Hack(bad_password_)); LOG(INFO) << "Waiting for initial AUTH_SUPPLIED"; auth_supplied_waiter.Wait(); diff --git a/chrome/browser/ui/login/login_prompt_gtk.cc b/chrome/browser/ui/login/login_prompt_gtk.cc index f070b65a..e6487a5 100644 --- a/chrome/browser/ui/login/login_prompt_gtk.cc +++ b/chrome/browser/ui/login/login_prompt_gtk.cc @@ -64,11 +64,11 @@ class LoginHandlerGtk : public LoginHandler, // LoginHandler: virtual void BuildViewForPasswordManager(PasswordManager* manager, - std::wstring explanation) { + const string16& explanation) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); root_.Own(gtk_vbox_new(FALSE, gtk_util::kContentAreaBorder)); - GtkWidget* label = gtk_label_new(WideToUTF8(explanation).c_str()); + GtkWidget* label = gtk_label_new(UTF16ToUTF8(explanation).c_str()); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_box_pack_start(GTK_BOX(root_.get()), label, FALSE, FALSE, 0); @@ -153,8 +153,8 @@ class LoginHandlerGtk : public LoginHandler, void LoginHandlerGtk::OnOKClicked(GtkWidget* sender) { SetAuth( - UTF8ToWide(gtk_entry_get_text(GTK_ENTRY(username_entry_))), - UTF8ToWide(gtk_entry_get_text(GTK_ENTRY(password_entry_)))); + UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(username_entry_))), + UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(password_entry_)))); } void LoginHandlerGtk::OnCancelClicked(GtkWidget* sender) { diff --git a/chrome/browser/ui/login/login_prompt_mac.mm b/chrome/browser/ui/login/login_prompt_mac.mm index f663632..6036831 100644 --- a/chrome/browser/ui/login/login_prompt_mac.mm +++ b/chrome/browser/ui/login/login_prompt_mac.mm @@ -53,7 +53,7 @@ class LoginHandlerMac : public LoginHandler, // LoginHandler: virtual void BuildViewForPasswordManager(PasswordManager* manager, - std::wstring explanation) { + const string16& explanation) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Load nib here instead of in constructor. @@ -64,7 +64,7 @@ class LoginHandlerMac : public LoginHandler, SetModel(manager); - [sheet_controller_ setExplanation:base::SysWideToNSString(explanation)]; + [sheet_controller_ setExplanation:base::SysUTF16ToNSString(explanation)]; // Scary thread safety note: This can potentially be called *after* SetAuth // or CancelAuth (say, if the request was cancelled before the UI thread got @@ -92,8 +92,8 @@ class LoginHandlerMac : public LoginHandler, ReleaseSoon(); } - void OnLoginPressed(const std::wstring& username, - const std::wstring& password) { + void OnLoginPressed(const string16& username, + const string16& password) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); SetAuth(username, password); @@ -147,8 +147,9 @@ LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, - (IBAction)loginPressed:(id)sender { using base::SysNSStringToWide; [NSApp endSheet:[self window]]; - handler_->OnLoginPressed(SysNSStringToWide([nameField_ stringValue]), - SysNSStringToWide([passwordField_ stringValue])); + handler_->OnLoginPressed( + base::SysNSStringToUTF16([nameField_ stringValue]), + base::SysNSStringToUTF16([passwordField_ stringValue])); } - (IBAction)cancelPressed:(id)sender { diff --git a/chrome/browser/ui/login/login_prompt_uitest.cc b/chrome/browser/ui/login/login_prompt_uitest.cc index eabb682..750e6c1 100644 --- a/chrome/browser/ui/login/login_prompt_uitest.cc +++ b/chrome/browser/ui/login/login_prompt_uitest.cc @@ -4,6 +4,7 @@ #include <string> +#include "base/utf_string_conversions.h" #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/common/url_constants.h" #include "chrome/test/automation/tab_proxy.h" @@ -11,8 +12,6 @@ #include "chrome/test/ui/ui_test.h" #include "net/test/test_server.h" -using std::wstring; - namespace { const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); @@ -22,10 +21,10 @@ const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); class LoginPromptTest : public UITest { protected: LoginPromptTest() - : username_basic_(L"basicuser"), - username_digest_(L"digestuser"), - password_(L"secret"), - password_bad_(L"denyme"), + : username_basic_(ASCIIToUTF16("basicuser")), + username_digest_(ASCIIToUTF16("digestuser")), + password_(ASCIIToUTF16("secret")), + password_bad_(ASCIIToUTF16("denyme")), test_server_(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)) { } @@ -36,18 +35,18 @@ class LoginPromptTest : public UITest { } protected: - wstring username_basic_; - wstring username_digest_; - wstring password_; - wstring password_bad_; + string16 username_basic_; + string16 username_digest_; + string16 password_; + string16 password_bad_; net::TestServer test_server_; }; -wstring ExpectedTitleFromAuth(const wstring& username, - const wstring& password) { +string16 ExpectedTitleFromAuth(const string16& username, + const string16& password) { // The TestServer sets the title to username/password on successful login. - return username + L"/" + password; + return username + char16('/') + password; } #if defined(OS_WIN) @@ -78,7 +77,7 @@ TEST_F(LoginPromptTest, MAYBE_TestBasicAuth) { EXPECT_TRUE(tab->NeedsAuth()); EXPECT_TRUE(tab->SetAuth(username_basic_, password_)); EXPECT_EQ(ExpectedTitleFromAuth(username_basic_, password_), - GetActiveTabTitle()); + WideToUTF16Hack(GetActiveTabTitle())); } #if defined(OS_WIN) @@ -108,7 +107,7 @@ TEST_F(LoginPromptTest, MAYBE_TestDigestAuth) { EXPECT_TRUE(tab->NeedsAuth()); EXPECT_TRUE(tab->SetAuth(username_digest_, password_)); EXPECT_EQ(ExpectedTitleFromAuth(username_digest_, password_), - GetActiveTabTitle()); + WideToUTF16Hack(GetActiveTabTitle())); } #if defined(OS_WIN) @@ -138,7 +137,7 @@ TEST_F(LoginPromptTest, MAYBE_TestTwoAuths) { EXPECT_TRUE(digest_tab->NeedsAuth()); EXPECT_TRUE(digest_tab->SetAuth(username_digest_, password_)); - wstring title; + string16 title; EXPECT_TRUE(basic_tab->GetTabTitle(&title)); EXPECT_EQ(ExpectedTitleFromAuth(username_basic_, password_), title); @@ -230,10 +229,10 @@ TEST_F(LoginPromptTest, MAYBE_SupplyRedundantAuths) { EXPECT_TRUE(basic_tab2->WaitForNavigation(last_navigation_time)); // Now both tabs have loaded. - wstring title1; + string16 title1; EXPECT_TRUE(basic_tab1->GetTabTitle(&title1)); EXPECT_EQ(ExpectedTitleFromAuth(username_basic_, password_), title1); - wstring title2; + string16 title2; EXPECT_TRUE(basic_tab2->GetTabTitle(&title2)); EXPECT_EQ(ExpectedTitleFromAuth(username_basic_, password_), title2); } @@ -270,10 +269,10 @@ TEST_F(LoginPromptTest, MAYBE_CancelRedundantAuths) { EXPECT_TRUE(basic_tab2->WaitForNavigation(last_navigation_time)); // Now both tabs have been denied. - wstring title1; + string16 title1; EXPECT_TRUE(basic_tab1->GetTabTitle(&title1)); - EXPECT_EQ(L"Denied: no auth", title1); - wstring title2; + EXPECT_EQ(ASCIIToUTF16("Denied: no auth"), title1); + string16 title2; EXPECT_TRUE(basic_tab2->GetTabTitle(&title2)); - EXPECT_EQ(L"Denied: no auth", title2); + EXPECT_EQ(ASCIIToUTF16("Denied: no auth"), title2); } diff --git a/chrome/browser/ui/login/login_prompt_win.cc b/chrome/browser/ui/login/login_prompt_win.cc index cf111d1..019679c 100644 --- a/chrome/browser/ui/login/login_prompt_win.cc +++ b/chrome/browser/ui/login/login_prompt_win.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/login/login_prompt.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/password_manager/password_manager.h" #include "chrome/browser/renderer_host/render_process_host.h" @@ -101,14 +102,15 @@ class LoginHandlerWin : public LoginHandler, // LoginHandler: virtual void BuildViewForPasswordManager(PasswordManager* manager, - std::wstring explanation) { + const string16& explanation) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); TabContents* tab_contents = GetTabContentsForLogin(); bool should_focus_view = !tab_contents->delegate() || tab_contents->delegate()->ShouldFocusConstrainedWindow(); - LoginView* view = new LoginView(explanation, should_focus_view); + LoginView* view = new LoginView(UTF16ToWideHack(explanation), + should_focus_view); // Set the model for the login view. The model (password manager) is owned // by the view's parent TabContents, so natural destruction order means we diff --git a/chrome/browser/ui/tests/browser_uitest.cc b/chrome/browser/ui/tests/browser_uitest.cc index c72b245..b4fa016 100644 --- a/chrome/browser/ui/tests/browser_uitest.cc +++ b/chrome/browser/ui/tests/browser_uitest.cc @@ -10,6 +10,7 @@ #include "base/sys_info.h" #include "base/test/test_file_util.h" #include "base/test/test_timeouts.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/platform_util.h" @@ -228,9 +229,9 @@ TEST_F(ShowModalDialogTest, FLAKY_BasicTest) { ASSERT_TRUE(browser.get()); scoped_refptr<TabProxy> tab = browser->GetActiveTab(); ASSERT_TRUE(tab.get()); - std::wstring title; + string16 title; ASSERT_TRUE(tab->GetTabTitle(&title)); - ASSERT_EQ(L"SUCCESS", title); + ASSERT_EQ(ASCIIToUTF16("SUCCESS"), title); } class SecurityTest : public UITest { @@ -285,7 +286,7 @@ public: void SetUp() { PathService::Get(base::DIR_TEMP, &tmp_profile_); tmp_profile_ = tmp_profile_.AppendASCII("tmp_profile"); - tmp_profile_ = tmp_profile_.Append(L"Test Chrome G�raldine"); + tmp_profile_ = tmp_profile_.Append(L"Test Chrome G\u00E9raldine"); // Create a fresh, empty copy of this directory. file_util::Delete(tmp_profile_, true); diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc index 4a940b0..60fda0b 100644 --- a/chrome/browser/unload_uitest.cc +++ b/chrome/browser/unload_uitest.cc @@ -442,17 +442,17 @@ TEST_F(UnloadTest, MAYBE_BrowserCloseTabWhenOtherTabHasListener) { scoped_refptr<TabProxy> popup_tab(browser->GetActiveTab()); ASSERT_TRUE(popup_tab.get()); - std::wstring popup_title; + string16 popup_title; EXPECT_TRUE(popup_tab->GetTabTitle(&popup_title)); - EXPECT_EQ(std::wstring(L"popup"), popup_title); + EXPECT_EQ(ASCIIToUTF16("popup"), popup_title); EXPECT_TRUE(popup_tab->Close(true)); ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); ASSERT_TRUE(main_tab.get()); - std::wstring main_title; + string16 main_title; EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); - EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); + EXPECT_EQ(ASCIIToUTF16("only_one_unload"), main_title); } // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |