summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-08 15:42:00 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-08 15:42:00 +0000
commit7024d3eea1d8328883736f5cd3cbef480aa0e740 (patch)
tree5fc40e7da24d79306321037359bce7bd97bcf36b /chrome
parente9ff5e31b28b6ee684ceaf47afe4f483163f6d1d (diff)
downloadchromium_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')
-rw-r--r--chrome/browser/accessibility/browser_accessibility_win_unittest.cc12
-rw-r--r--chrome/browser/automation/automation_provider_observers.cc19
-rw-r--r--chrome/browser/automation/automation_provider_observers.h2
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc30
-rw-r--r--chrome/browser/automation/testing_automation_provider.h16
-rw-r--r--chrome/browser/automation/testing_automation_provider_win.cc2
-rw-r--r--chrome/browser/browser_browsertest.cc22
-rw-r--r--chrome/browser/browser_signin.cc6
-rw-r--r--chrome/browser/chromeos/login/account_screen.cc2
-rw-r--r--chrome/browser/chromeos/views/webui_menu_widget.cc9
-rw-r--r--chrome/browser/debugger/debugger_remote_service.cc4
-rw-r--r--chrome/browser/debugger/devtools_window.cc32
-rw-r--r--chrome/browser/debugger/devtools_window.h2
-rw-r--r--chrome/browser/default_plugin_uitest.cc11
-rw-r--r--chrome/browser/dom_ui/bookmarks_ui_uitest.cc15
-rw-r--r--chrome/browser/dom_ui/dom_ui.cc3
-rw-r--r--chrome/browser/dom_ui/dom_ui_handler_browsertest.cc2
-rw-r--r--chrome/browser/dom_ui/new_tab_ui_uitest.cc18
-rw-r--r--chrome/browser/dom_ui/options/options_ui_uitest.cc4
-rw-r--r--chrome/browser/dom_ui/print_preview_ui_uitest.cc4
-rw-r--r--chrome/browser/extensions/alert_apitest.cc5
-rw-r--r--chrome/browser/geolocation/geolocation_browsertest.cc6
-rw-r--r--chrome/browser/history/multipart_uitest.cc5
-rw-r--r--chrome/browser/history/redirect_uitest.cc8
-rw-r--r--chrome/browser/notifications/notifications_interactive_uitest.cc5
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc3
-rw-r--r--chrome/browser/printing/print_dialog_cloud_uitest.cc5
-rw-r--r--chrome/browser/remoting/setup_flow.cc3
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc7
-rw-r--r--chrome/browser/renderer_host/render_view_host.h4
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc32
-rw-r--r--chrome/browser/session_history_uitest.cc27
-rw-r--r--chrome/browser/sync/sync_setup_flow.cc3
-rw-r--r--chrome/browser/ui/cocoa/applescript/tab_applescript.mm4
-rw-r--r--chrome/browser/ui/login/login_prompt.cc21
-rw-r--r--chrome/browser/ui/login/login_prompt.h24
-rw-r--r--chrome/browser/ui/login/login_prompt_browsertest.cc7
-rw-r--r--chrome/browser/ui/login/login_prompt_gtk.cc8
-rw-r--r--chrome/browser/ui/login/login_prompt_mac.mm13
-rw-r--r--chrome/browser/ui/login/login_prompt_uitest.cc43
-rw-r--r--chrome/browser/ui/login/login_prompt_win.cc6
-rw-r--r--chrome/browser/ui/tests/browser_uitest.cc7
-rw-r--r--chrome/browser/unload_uitest.cc8
-rw-r--r--chrome/common/automation_messages_internal.h16
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_test_test.cc4
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc100
-rw-r--r--chrome/test/automation/browser_proxy.cc6
-rw-r--r--chrome/test/automation/browser_proxy.h8
-rw-r--r--chrome/test/automation/extension_proxy_uitest.cc11
-rw-r--r--chrome/test/automation/tab_proxy.cc34
-rw-r--r--chrome/test/automation/tab_proxy.h24
-rw-r--r--chrome/test/page_cycler/page_cycler_test.cc13
-rw-r--r--chrome/test/pyautolib/pyautolib.cc43
-rw-r--r--chrome/test/pyautolib/pyautolib.h18
-rw-r--r--chrome/test/pyautolib/pyautolib.i18
-rw-r--r--chrome/test/ui/dom_checker_uitest.cc17
-rw-r--r--chrome/test/ui/dromaeo_benchmark_uitest.cc23
-rw-r--r--chrome/test/ui/layout_plugin_uitest.cc7
-rw-r--r--chrome/test/ui/sunspider_uitest.cc23
-rw-r--r--chrome/test/ui/ui_test.cc9
-rw-r--r--chrome/test/ui/v8_benchmark_uitest.cc23
-rw-r--r--chrome/test/ui_test_utils.cc6
-rw-r--r--chrome/test/url_fetch_test/url_fetch_test.cc7
-rw-r--r--chrome/test/webdriver/automation.cc17
-rw-r--r--chrome/tools/convert_dict/convert_dict_unittest.cc31
65 files changed, 500 insertions, 427 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
diff --git a/chrome/common/automation_messages_internal.h b/chrome/common/automation_messages_internal.h
index 8ff405d..1a6418a 100644
--- a/chrome/common/automation_messages_internal.h
+++ b/chrome/common/automation_messages_internal.h
@@ -133,7 +133,7 @@ IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_Tab,
IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_TabTitle,
int,
int,
- std::wstring)
+ string16)
// This message requests the url of the tab with the given handle.
// The return value contains a success flag and the URL string. The URL will
@@ -161,8 +161,8 @@ IPC_MESSAGE_CONTROL1(AutomationMsg_HandleUnused,
// authentication challenge.
IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetAuth,
int /* tab handle */,
- std::wstring /* username */,
- std::wstring /* password */,
+ string16 /* username */,
+ string16 /* password */,
AutomationMsg_NavigationResponseValues /* status */)
// This message tells the AutomationProvider to cancel the login in the
@@ -195,8 +195,8 @@ IPC_SYNC_MESSAGE_CONTROL1_1(AutomationMsg_NeedsAuth,
// a serialized JSON string response.
IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_DomOperation,
int /* tab handle */,
- std::wstring /* context_frame */,
- std::wstring /* the javascript to be executed */,
+ string16 /* context_frame */,
+ string16 /* the javascript to be executed */,
std::string /* the serialized json string containg
the result of a javascript
execution */)
@@ -1236,13 +1236,13 @@ IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_AddBookmarkGroup,
int /* browser_handle */,
int64 /* parent_id */,
int /* index */,
- std::wstring /* title */,
+ string16 /* title */,
bool /* success */)
IPC_SYNC_MESSAGE_CONTROL5_1(AutomationMsg_AddBookmarkURL,
int /* browser_handle */,
int64 /* parent_id */,
int /* index */,
- std::wstring /* title */,
+ string16 /* title */,
GURL /* url */,
bool /* success */)
IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_ReparentBookmark,
@@ -1254,7 +1254,7 @@ IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_ReparentBookmark,
IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetBookmarkTitle,
int /* browser_handle */,
int64 /* id */,
- std::wstring /* title */,
+ string16 /* title */,
bool /* success */)
IPC_SYNC_MESSAGE_CONTROL3_1(AutomationMsg_SetBookmarkURL,
int /* browser_handle */,
diff --git a/chrome/test/automated_ui_tests/automated_ui_test_test.cc b/chrome/test/automated_ui_tests/automated_ui_test_test.cc
index 75cfe5a..80b6753 100644
--- a/chrome/test/automated_ui_tests/automated_ui_test_test.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_test_test.cc
@@ -29,9 +29,9 @@ TEST_F(AutomatedUITestBase, Home) {
ASSERT_TRUE(active_browser()->GetActiveTab()->GetCurrentURL(&url));
EXPECT_EQ(GURL(chrome::kAboutBlankURL), url);
- std::wstring title;
+ string16 title;
ASSERT_TRUE(active_browser()->GetActiveTab()->GetTabTitle(&title));
- EXPECT_EQ(L"", title);
+ EXPECT_EQ(string16(), title);
}
TEST_F(AutomatedUITestBase, OpenNewTab) {
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index 5680c77..34c449c 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -262,9 +262,9 @@ TEST_F(AutomationProxyVisibleTest, AppendTab) {
scoped_refptr<TabProxy> tab(window->GetTab(appended_tab_index));
ASSERT_TRUE(tab.get());
- std::wstring title;
+ string16 title;
ASSERT_TRUE(tab->GetTabTitle(&title));
- ASSERT_STREQ(L"Title Of Awesomeness", title.c_str());
+ ASSERT_EQ(ASCIIToUTF16("Title Of Awesomeness"), title);
}
TEST_F(AutomationProxyTest, ActivateTab) {
@@ -289,10 +289,10 @@ TEST_F(AutomationProxyTest, GetTab) {
{
scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring title;
+ string16 title;
ASSERT_TRUE(tab->GetTabTitle(&title));
// BUG [634097] : expected title should be "about:blank"
- ASSERT_STREQ(L"", title.c_str());
+ ASSERT_EQ(string16(), title);
}
{
@@ -311,10 +311,10 @@ TEST_F(AutomationProxyTest, NavigateToURL) {
scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring title;
+ string16 title;
ASSERT_TRUE(tab->GetTabTitle(&title));
// BUG [634097] : expected title should be "about:blank"
- ASSERT_STREQ(L"", title.c_str());
+ ASSERT_EQ(string16(), title);
FilePath filename(test_data_directory_);
filename = filename.AppendASCII("title2.html");
@@ -322,7 +322,7 @@ TEST_F(AutomationProxyTest, NavigateToURL) {
ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
tab->NavigateToURL(net::FilePathToFileURL(filename)));
ASSERT_TRUE(tab->GetTabTitle(&title));
- ASSERT_STREQ(L"Title Of Awesomeness", title.c_str());
+ ASSERT_EQ(ASCIIToUTF16("Title Of Awesomeness"), title);
// TODO(vibhor) : Add a test using testserver.
}
@@ -333,33 +333,33 @@ TEST_F(AutomationProxyTest, GoBackForward) {
scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring title;
+ string16 title;
ASSERT_TRUE(tab->GetTabTitle(&title));
// BUG [634097] : expected title should be "about:blank"
- ASSERT_STREQ(L"", title.c_str());
+ ASSERT_EQ(string16(), title);
ASSERT_FALSE(tab->GoBack());
ASSERT_TRUE(tab->GetTabTitle(&title));
- ASSERT_STREQ(L"", title.c_str());
+ ASSERT_EQ(string16(), title);
FilePath filename(test_data_directory_);
filename = filename.AppendASCII("title2.html");
ASSERT_TRUE(tab->NavigateToURL(net::FilePathToFileURL(filename)));
ASSERT_TRUE(tab->GetTabTitle(&title));
- ASSERT_STREQ(L"Title Of Awesomeness", title.c_str());
+ ASSERT_EQ(ASCIIToUTF16("Title Of Awesomeness"), title);
ASSERT_TRUE(tab->GoBack());
ASSERT_TRUE(tab->GetTabTitle(&title));
// BUG [634097] : expected title should be "about:blank"
- ASSERT_STREQ(L"", title.c_str());
+ ASSERT_EQ(string16(), title.c_str());
ASSERT_TRUE(tab->GoForward());
ASSERT_TRUE(tab->GetTabTitle(&title));
- ASSERT_STREQ(L"Title Of Awesomeness", title.c_str());
+ ASSERT_EQ(ASCIIToUTF16("Title Of Awesomeness"), title);
ASSERT_FALSE(tab->GoForward());
ASSERT_TRUE(tab->GetTabTitle(&title));
- ASSERT_STREQ(L"Title Of Awesomeness", title.c_str());
+ ASSERT_EQ(ASCIIToUTF16("Title Of Awesomeness"), title);
}
TEST_F(AutomationProxyTest, GetCurrentURL) {
@@ -413,14 +413,14 @@ TEST_F(AutomationProxyTest2, GetTabTitle) {
ASSERT_TRUE(window.get());
scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring title;
+ string16 title;
ASSERT_TRUE(tab->GetTabTitle(&title));
- ASSERT_STREQ(L"title1.html", title.c_str());
+ ASSERT_EQ(ASCIIToUTF16("title1.html"), title);
tab = window->GetTab(1);
ASSERT_TRUE(tab.get());
ASSERT_TRUE(tab->GetTabTitle(&title));
- ASSERT_STREQ(L"Title Of Awesomeness", title.c_str());
+ ASSERT_EQ(ASCIIToUTF16("Title Of Awesomeness"), title);
}
TEST_F(AutomationProxyTest, Cookies) {
@@ -547,11 +547,12 @@ TEST_F(AutomationProxyTest4, StringValueIsEchoedByDomAutomationController) {
scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring expected(L"string");
- std::wstring jscript = CreateJSString(L"\"" + expected + L"\"");
- std::wstring actual;
- ASSERT_TRUE(tab->ExecuteAndExtractString(L"", jscript, &actual));
- ASSERT_STREQ(expected.c_str(), actual.c_str());
+ string16 expected = ASCIIToUTF16("string");
+ string16 jscript = WideToUTF16Hack(
+ CreateJSString(L"\"" + UTF16ToWideHack(expected) + L"\""));
+ string16 actual;
+ ASSERT_TRUE(tab->ExecuteAndExtractString(string16(), jscript, &actual));
+ ASSERT_EQ(expected, actual);
}
std::wstring BooleanToString(bool bool_value) {
@@ -572,7 +573,9 @@ TEST_F(AutomationProxyTest4, BooleanValueIsEchoedByDomAutomationController) {
bool expected = true;
std::wstring jscript = CreateJSString(BooleanToString(expected));
bool actual = false;
- ASSERT_TRUE(tab->ExecuteAndExtractBool(L"", jscript, &actual));
+ ASSERT_TRUE(tab->ExecuteAndExtractBool(string16(),
+ WideToUTF16Hack(jscript),
+ &actual));
ASSERT_EQ(expected, actual);
}
@@ -588,7 +591,9 @@ TEST_F(AutomationProxyTest4, NumberValueIsEchoedByDomAutomationController) {
std::wstring expected_string;
base::SStringPrintf(&expected_string, L"%d", expected);
std::wstring jscript = CreateJSString(expected_string);
- ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", jscript, &actual));
+ ASSERT_TRUE(tab->ExecuteAndExtractInt(string16(),
+ WideToUTF16Hack(jscript),
+ &actual));
ASSERT_EQ(expected, actual);
}
@@ -625,21 +630,27 @@ TEST_F(AutomationProxyTest3, FrameDocumentCanBeAccessed) {
scoped_refptr<TabProxy> tab(window->GetTab(0));
ASSERT_TRUE(tab.get());
- std::wstring actual;
- std::wstring xpath1 = L""; // top level frame
+ string16 actual;
+ string16 xpath1 = ASCIIToUTF16(""); // top level frame
std::wstring jscript1 = CreateJSStringForDOMQuery(L"myinput");
- ASSERT_TRUE(tab->ExecuteAndExtractString(xpath1, jscript1, &actual));
- ASSERT_EQ(L"INPUT", actual);
+ ASSERT_TRUE(tab->ExecuteAndExtractString(xpath1,
+ WideToUTF16Hack(jscript1),
+ &actual));
+ ASSERT_EQ(ASCIIToUTF16("INPUT"), actual);
- std::wstring xpath2 = L"/html/body/iframe";
+ string16 xpath2 = ASCIIToUTF16("/html/body/iframe");
std::wstring jscript2 = CreateJSStringForDOMQuery(L"myspan");
- ASSERT_TRUE(tab->ExecuteAndExtractString(xpath2, jscript2, &actual));
- ASSERT_EQ(L"SPAN", actual);
+ ASSERT_TRUE(tab->ExecuteAndExtractString(xpath2,
+ WideToUTF16Hack(jscript2),
+ &actual));
+ ASSERT_EQ(ASCIIToUTF16("SPAN"), actual);
- std::wstring xpath3 = L"/html/body/iframe\n/html/body/iframe";
+ string16 xpath3 = ASCIIToUTF16("/html/body/iframe\n/html/body/iframe");
std::wstring jscript3 = CreateJSStringForDOMQuery(L"mydiv");
- ASSERT_TRUE(tab->ExecuteAndExtractString(xpath3, jscript3, &actual));
- ASSERT_EQ(L"DIV", actual);
+ ASSERT_TRUE(tab->ExecuteAndExtractString(xpath3,
+ WideToUTF16Hack(jscript3),
+ &actual));
+ ASSERT_EQ(ASCIIToUTF16("DIV"), actual);
}
// Flaky, http://crbug.com/70937
@@ -1518,8 +1529,9 @@ TEST_F(AutomationProxyTest, FLAKY_AppModalDialogTest) {
EXPECT_FALSE(modal_dialog_showing);
int result = -1;
EXPECT_TRUE(tab->ExecuteAndExtractInt(
- std::wstring(),
- L"window.domAutomationController.send(result);", &result));
+ string16(),
+ ASCIIToUTF16("window.domAutomationController.send(result);"),
+ &result));
EXPECT_EQ(0, result);
// Try again.
@@ -1539,8 +1551,9 @@ TEST_F(AutomationProxyTest, FLAKY_AppModalDialogTest) {
&button));
EXPECT_FALSE(modal_dialog_showing);
EXPECT_TRUE(tab->ExecuteAndExtractInt(
- std::wstring(),
- L"window.domAutomationController.send(result);", &result));
+ string16(),
+ ASCIIToUTF16("window.domAutomationController.send(result);"),
+ &result));
EXPECT_EQ(1, result);
}
@@ -1571,10 +1584,13 @@ TEST_F(AutomationProxyTest5, TestLifetimeOfDomAutomationController) {
// Allow some time for the popup to show up and close.
base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
- std::wstring expected(L"string");
- std::wstring jscript = CreateJSString(L"\"" + expected + L"\"");
- std::wstring actual;
- ASSERT_TRUE(tab->ExecuteAndExtractString(L"", jscript, &actual));
+ string16 expected(ASCIIToUTF16("string"));
+ std::wstring jscript =
+ CreateJSString(L"\"" + UTF16ToWideHack(expected) + L"\"");
+ string16 actual;
+ ASSERT_TRUE(tab->ExecuteAndExtractString(string16(),
+ WideToUTF16Hack(jscript),
+ &actual));
ASSERT_EQ(expected, actual);
}
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc
index 316815c..b206359 100644
--- a/chrome/test/automation/browser_proxy.cc
+++ b/chrome/test/automation/browser_proxy.cc
@@ -307,7 +307,7 @@ bool BrowserProxy::WaitForBookmarkModelToLoad() {
}
bool BrowserProxy::AddBookmarkGroup(int64 parent_id, int index,
- std::wstring& title) {
+ const string16& title) {
if (!is_valid())
return false;
bool result = false;
@@ -319,7 +319,7 @@ bool BrowserProxy::AddBookmarkGroup(int64 parent_id, int index,
}
bool BrowserProxy::AddBookmarkURL(int64 parent_id, int index,
- std::wstring& title, const GURL& url) {
+ const string16& title, const GURL& url) {
if (!is_valid())
return false;
bool result = false;
@@ -341,7 +341,7 @@ bool BrowserProxy::ReparentBookmark(int64 id, int64 new_parent_id, int index) {
return result;
}
-bool BrowserProxy::SetBookmarkTitle(int64 id, const std::wstring& title) {
+bool BrowserProxy::SetBookmarkTitle(int64 id, const string16& title) {
if (!is_valid())
return false;
bool result = false;
diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h
index 7d77949..f6c0bd3 100644
--- a/chrome/test/automation/browser_proxy.h
+++ b/chrome/test/automation/browser_proxy.h
@@ -154,13 +154,13 @@ class BrowserProxy : public AutomationResourceProxy {
// Editing of the bookmark model. Bookmarks are referenced by id.
// Bookmark or group (folder) creation:
bool AddBookmarkGroup(int64 parent_id, int index,
- std::wstring& title) WARN_UNUSED_RESULT;
- bool AddBookmarkURL(int64 parent_id, int index,
- std::wstring& title, const GURL& url) WARN_UNUSED_RESULT;
+ const string16& title) WARN_UNUSED_RESULT;
+ bool AddBookmarkURL(int64 parent_id, int index, const string16& title,
+ const GURL& url) WARN_UNUSED_RESULT;
// Bookmark editing:
bool ReparentBookmark(int64 id, int64 new_parent_id,
int index) WARN_UNUSED_RESULT;
- bool SetBookmarkTitle(int64 id, const std::wstring& title) WARN_UNUSED_RESULT;
+ bool SetBookmarkTitle(int64 id, const string16& title) WARN_UNUSED_RESULT;
bool SetBookmarkURL(int64 id, const GURL& url) WARN_UNUSED_RESULT;
// Finally, bookmark deletion:
bool RemoveBookmark(int64 id) WARN_UNUSED_RESULT;
diff --git a/chrome/test/automation/extension_proxy_uitest.cc b/chrome/test/automation/extension_proxy_uitest.cc
index 743de6e..6eab744 100644
--- a/chrome/test/automation/extension_proxy_uitest.cc
+++ b/chrome/test/automation/extension_proxy_uitest.cc
@@ -4,6 +4,7 @@
#include "base/path_service.h"
#include "base/ref_counted.h"
+#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/automation/automation_proxy.h"
#include "chrome/test/automation/browser_proxy.h"
@@ -121,9 +122,9 @@ TEST_F(ExtensionProxyUITest, DISABLED_ExecuteBrowserActionInActiveTabAsync) {
scoped_refptr<TabProxy> display_tab = browser->GetTab(0);
ASSERT_TRUE(display_tab);
- std::wstring title_wstring;
- ASSERT_TRUE(display_tab->GetTabTitle(&title_wstring));
- ASSERT_STREQ(L"0", title_wstring.c_str());
+ string16 title_string;
+ ASSERT_TRUE(display_tab->GetTabTitle(&title_string));
+ ASSERT_EQ(ASCIIToUTF16("0"), title_string);
// Click the action again right after navigating to a new page.
ASSERT_TRUE(browser->AppendTab(localhost));
@@ -132,8 +133,8 @@ TEST_F(ExtensionProxyUITest, DISABLED_ExecuteBrowserActionInActiveTabAsync) {
ASSERT_TRUE(rename_tab_extension->
ExecuteActionInActiveTabAsync(browser.get()));
ASSERT_NO_FATAL_FAILURE(automation()->EnsureExtensionTestResult());
- ASSERT_TRUE(display_tab->GetTabTitle(&title_wstring));
- ASSERT_STREQ(L"1", title_wstring.c_str());
+ ASSERT_TRUE(display_tab->GetTabTitle(&title_string));
+ ASSERT_EQ(ASCIIToUTF16("1"), title_string);
// Do not forget to stop the server.
StopHttpServer();
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index e04c039..9451372 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -22,7 +22,7 @@ TabProxy::TabProxy(AutomationMessageSender* sender,
}
-bool TabProxy::GetTabTitle(std::wstring* title) const {
+bool TabProxy::GetTabTitle(string16* title) const {
if (!is_valid())
return false;
@@ -98,8 +98,8 @@ AutomationMsg_NavigationResponseValues
return navigate_response;
}
-bool TabProxy::SetAuth(const std::wstring& username,
- const std::wstring& password) {
+bool TabProxy::SetAuth(const string16& username,
+ const string16& password) {
if (!is_valid())
return false;
@@ -233,9 +233,9 @@ bool TabProxy::GetProcessID(int* process_id) const {
return sender_->Send(new AutomationMsg_TabProcessID(handle_, process_id));
}
-bool TabProxy::ExecuteAndExtractString(const std::wstring& frame_xpath,
- const std::wstring& jscript,
- std::wstring* string_value) {
+bool TabProxy::ExecuteAndExtractString(const string16& frame_xpath,
+ const string16& jscript,
+ string16* string_value) {
Value* root = NULL;
bool succeeded = ExecuteAndExtractValue(frame_xpath, jscript, &root);
if (!succeeded)
@@ -247,18 +247,16 @@ bool TabProxy::ExecuteAndExtractString(const std::wstring& frame_xpath,
if (succeeded) {
string16 read_value;
succeeded = value->GetAsString(&read_value);
- if (succeeded) {
- // TODO(viettrungluu): remove conversion. (But should |jscript| be UTF-8?)
- *string_value = UTF16ToWideHack(read_value);
- }
+ if (succeeded)
+ *string_value = read_value;
}
delete root;
return succeeded;
}
-bool TabProxy::ExecuteAndExtractBool(const std::wstring& frame_xpath,
- const std::wstring& jscript,
+bool TabProxy::ExecuteAndExtractBool(const string16& frame_xpath,
+ const string16& jscript,
bool* bool_value) {
Value* root = NULL;
bool succeeded = ExecuteAndExtractValue(frame_xpath, jscript, &root);
@@ -280,8 +278,8 @@ bool TabProxy::ExecuteAndExtractBool(const std::wstring& frame_xpath,
return succeeded;
}
-bool TabProxy::ExecuteAndExtractInt(const std::wstring& frame_xpath,
- const std::wstring& jscript,
+bool TabProxy::ExecuteAndExtractInt(const string16& frame_xpath,
+ const string16& jscript,
int* int_value) {
Value* root = NULL;
bool succeeded = ExecuteAndExtractValue(frame_xpath, jscript, &root);
@@ -303,8 +301,8 @@ bool TabProxy::ExecuteAndExtractInt(const std::wstring& frame_xpath,
return succeeded;
}
-bool TabProxy::ExecuteAndExtractValue(const std::wstring& frame_xpath,
- const std::wstring& jscript,
+bool TabProxy::ExecuteAndExtractValue(const string16& frame_xpath,
+ const string16& jscript,
Value** value) {
if (!is_valid())
return false;
@@ -824,8 +822,8 @@ bool TabProxy::ExecuteJavaScriptAndGetJSON(const std::string& script,
NOTREACHED();
return false;
}
- return sender_->Send(new AutomationMsg_DomOperation(handle_, L"",
- UTF8ToWide(script),
+ return sender_->Send(new AutomationMsg_DomOperation(handle_, string16(),
+ UTF8ToUTF16(script),
json));
}
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index e8dc599..c13a1b2 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -66,7 +66,7 @@ class TabProxy : public AutomationResourceProxy,
bool GetCurrentURL(GURL* url) const WARN_UNUSED_RESULT;
// Gets the title of the tab.
- bool GetTabTitle(std::wstring* title) const WARN_UNUSED_RESULT;
+ bool GetTabTitle(string16* title) const WARN_UNUSED_RESULT;
// Gets the tabstrip index of the tab.
bool GetTabIndex(int* index) const WARN_UNUSED_RESULT;
@@ -83,17 +83,17 @@ class TabProxy : public AutomationResourceProxy,
// will result in value = 24
// NOTE: If this is called from a ui test, |dom_automation_enabled_| must be
// set to true for these functions to work.
- bool ExecuteAndExtractString(const std::wstring& frame_xpath,
- const std::wstring& jscript,
- std::wstring* value) WARN_UNUSED_RESULT;
- bool ExecuteAndExtractBool(const std::wstring& frame_xpath,
- const std::wstring& jscript,
+ bool ExecuteAndExtractString(const string16& frame_xpath,
+ const string16& jscript,
+ string16* value) WARN_UNUSED_RESULT;
+ bool ExecuteAndExtractBool(const string16& frame_xpath,
+ const string16& jscript,
bool* value) WARN_UNUSED_RESULT;
- bool ExecuteAndExtractInt(const std::wstring& frame_xpath,
- const std::wstring& jscript,
+ bool ExecuteAndExtractInt(const string16& frame_xpath,
+ const string16& jscript,
int* value) WARN_UNUSED_RESULT;
- bool ExecuteAndExtractValue(const std::wstring& frame_xpath,
- const std::wstring& jscript,
+ bool ExecuteAndExtractValue(const string16& frame_xpath,
+ const string16& jscript,
Value** value) WARN_UNUSED_RESULT;
// Returns a DOMElementProxyRef to the tab's current DOM document.
@@ -209,8 +209,8 @@ class TabProxy : public AutomationResourceProxy,
// Supply or cancel authentication to a login prompt. These are synchronous
// calls and hence block until the load finishes (or another login prompt
// appears, in the case of invalid login info).
- bool SetAuth(const std::wstring& username,
- const std::wstring& password) WARN_UNUSED_RESULT;
+ bool SetAuth(const string16& username,
+ const string16& password) WARN_UNUSED_RESULT;
bool CancelAuth() WARN_UNUSED_RESULT;
// Checks if this tab has a login prompt waiting for auth. This will be
diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc
index 3ba9f67..e09b15b 100644
--- a/chrome/test/page_cycler/page_cycler_test.cc
+++ b/chrome/test/page_cycler/page_cycler_test.cc
@@ -250,12 +250,13 @@ class PageCyclerTest : public UIPerfTest {
ASSERT_FALSE(pages->empty());
// Get the timing cookie value from the DOM automation.
- std::wstring wcookie;
- ASSERT_TRUE(tab->ExecuteAndExtractString(L"",
- L"window.domAutomationController.send("
- L"JSON.stringify(__get_timings()));",
- &wcookie));
- cookie = base::SysWideToNativeMB(wcookie);
+ string16 cookie16;
+ ASSERT_TRUE(tab->ExecuteAndExtractString(
+ string16(),
+ ASCIIToUTF16("window.domAutomationController.send("
+ "JSON.stringify(__get_timings()));"),
+ &cookie16));
+ cookie = base::SysWideToNativeMB(UTF16ToWide(cookie16));
// JSON.stringify() encapsulates the returned string in quotes, strip them.
std::string::size_type start_idx = cookie.find("\"");
diff --git a/chrome/test/pyautolib/pyautolib.cc b/chrome/test/pyautolib/pyautolib.cc
index a1da137..455574a 100644
--- a/chrome/test/pyautolib/pyautolib.cc
+++ b/chrome/test/pyautolib/pyautolib.cc
@@ -11,9 +11,9 @@
#include "chrome/test/pyautolib/pyautolib.h"
#include "googleurl/src/gurl.h"
-static int64 StringToId(const std::wstring& str) {
+static int64 StringToId(const string16& str) {
int64 id;
- base::StringToInt64(WideToUTF8(str), &id);
+ base::StringToInt64(str, &id);
return id;
}
@@ -241,19 +241,22 @@ std::string PyUITestBase::_GetBookmarksAsJSON() {
return s;
}
-bool PyUITestBase::AddBookmarkGroup(std::wstring& parent_id, int index,
- std::wstring& title) {
+bool PyUITestBase::AddBookmarkGroup(const string16& parent_id, int index,
+ const string16& title) {
scoped_refptr<BrowserProxy> browser_proxy =
automation()->GetBrowserWindow(0); // Window doesn't matter.
EXPECT_TRUE(browser_proxy.get());
if (!browser_proxy.get())
return false;
- return browser_proxy->AddBookmarkGroup(StringToId(parent_id), index, title);
+ return browser_proxy->AddBookmarkGroup(StringToId(parent_id),
+ index,
+ title);
}
-bool PyUITestBase::AddBookmarkURL(std::wstring& parent_id, int index,
- std::wstring& title, std::wstring& url) {
+bool PyUITestBase::AddBookmarkURL(const string16& parent_id, int index,
+ const string16& title,
+ const string16& url) {
scoped_refptr<BrowserProxy> browser_proxy =
automation()->GetBrowserWindow(0); // Window doesn't matter.
EXPECT_TRUE(browser_proxy.get());
@@ -261,12 +264,13 @@ bool PyUITestBase::AddBookmarkURL(std::wstring& parent_id, int index,
return false;
return browser_proxy->AddBookmarkURL(StringToId(parent_id),
- index, title,
- GURL(WideToUTF8(url)));
+ index,
+ title,
+ GURL(UTF16ToUTF8(url)));
}
bool PyUITestBase::ReparentBookmark(
- std::wstring& id, std::wstring& new_parent_id, int index) {
+ const string16& id, const string16& new_parent_id, int index) {
scoped_refptr<BrowserProxy> browser_proxy =
automation()->GetBrowserWindow(0); // Window doesn't matter.
EXPECT_TRUE(browser_proxy.get());
@@ -278,7 +282,7 @@ bool PyUITestBase::ReparentBookmark(
index);
}
-bool PyUITestBase::SetBookmarkTitle(std::wstring& id, std::wstring& title) {
+bool PyUITestBase::SetBookmarkTitle(const string16& id, const string16& title) {
scoped_refptr<BrowserProxy> browser_proxy =
automation()->GetBrowserWindow(0); // Window doesn't matter.
EXPECT_TRUE(browser_proxy.get());
@@ -288,17 +292,17 @@ bool PyUITestBase::SetBookmarkTitle(std::wstring& id, std::wstring& title) {
return browser_proxy->SetBookmarkTitle(StringToId(id), title);
}
-bool PyUITestBase::SetBookmarkURL(std::wstring& id, std::wstring& url) {
+bool PyUITestBase::SetBookmarkURL(const string16& id, const string16& url) {
scoped_refptr<BrowserProxy> browser_proxy =
automation()->GetBrowserWindow(0); // Window doesn't matter.
EXPECT_TRUE(browser_proxy.get());
if (!browser_proxy.get())
return false;
- return browser_proxy->SetBookmarkURL(StringToId(id), GURL(WideToUTF8(url)));
+ return browser_proxy->SetBookmarkURL(StringToId(id), GURL(UTF16ToUTF8(url)));
}
-bool PyUITestBase::RemoveBookmark(std::wstring& id) {
+bool PyUITestBase::RemoveBookmark(const string16& id) {
scoped_refptr<BrowserProxy> browser_proxy =
automation()->GetBrowserWindow(0); // Window doesn't matter.
EXPECT_TRUE(browser_proxy.get());
@@ -331,18 +335,19 @@ std::wstring PyUITestBase::ExecuteJavascript(const std::wstring& script,
scoped_refptr<BrowserProxy> browser_proxy =
automation()->GetBrowserWindow(window_index);
EXPECT_TRUE(browser_proxy.get());
- std::wstring response;
if (!browser_proxy.get())
- return response;
+ return std::wstring();
scoped_refptr<TabProxy> tab_proxy =
browser_proxy->GetTab(tab_index);
EXPECT_TRUE(tab_proxy.get());
if (!tab_proxy.get())
- return response;
+ return std::wstring();
- EXPECT_TRUE(tab_proxy->ExecuteAndExtractString(frame_xpath, script,
+ string16 response;
+ EXPECT_TRUE(tab_proxy->ExecuteAndExtractString(WideToUTF16Hack(frame_xpath),
+ WideToUTF16Hack(script),
&response));
- return response;
+ return UTF16ToWideHack(response);
}
std::wstring PyUITestBase::GetDOMValue(const std::wstring& expr,
diff --git a/chrome/test/pyautolib/pyautolib.h b/chrome/test/pyautolib/pyautolib.h
index a3a8e23..3abe987 100644
--- a/chrome/test/pyautolib/pyautolib.h
+++ b/chrome/test/pyautolib/pyautolib.h
@@ -135,23 +135,23 @@ class PyUITestBase : public UITestBase {
std::string _GetBookmarksAsJSON();
// Editing of the bookmark model. Bookmarks are referenced by id.
- // The id is a std::wstring, not an int64, for convenience, since
+ // The id is a string16, not an int64, for convenience, since
// the python side gets IDs converted from a JSON representation
// (which "extracts" into a string, not an int). Since IDs are
// grabbed from the current model (and not generated), a conversion
// is unnecessary. URLs are strings and not GURLs for a similar reason.
// Bookmark or group (folder) creation:
- bool AddBookmarkGroup(std::wstring& parent_id, int index,
- std::wstring& title);
- bool AddBookmarkURL(std::wstring& parent_id, int index,
- std::wstring& title, std::wstring& url);
+ bool AddBookmarkGroup(const string16& parent_id, int index,
+ const string16& title);
+ bool AddBookmarkURL(const string16& parent_id, int index,
+ const string16& title, const string16& url);
// Bookmark editing:
- bool ReparentBookmark(std::wstring& id, std::wstring& new_parent_id,
+ bool ReparentBookmark(const string16& id, const string16& new_parent_id,
int index);
- bool SetBookmarkTitle(std::wstring& id, std::wstring& title);
- bool SetBookmarkURL(std::wstring& id, std::wstring& url);
+ bool SetBookmarkTitle(const string16& id, const string16& title);
+ bool SetBookmarkURL(const string16& id, const string16& url);
// Finally, bookmark deletion:
- bool RemoveBookmark(std::wstring& id);
+ bool RemoveBookmark(const string16& id);
// Get a handle to browser window at the given index, or NULL on failure.
scoped_refptr<BrowserProxy> GetBrowserWindow(int window_index);
diff --git a/chrome/test/pyautolib/pyautolib.i b/chrome/test/pyautolib/pyautolib.i
index 34ad6e2..894b7e9 100644
--- a/chrome/test/pyautolib/pyautolib.i
+++ b/chrome/test/pyautolib/pyautolib.i
@@ -14,7 +14,7 @@
// and attach it to your node (class or method). This doc string will be
// copied over in the generated python classes/methods.
-%module(docstring="Python interface to Automtion Proxy.") pyautolib
+%module(docstring="Python interface to Automation Proxy.") pyautolib
%feature("autodoc", "1");
%include <std_wstring.i>
@@ -152,7 +152,7 @@ class TabProxy {
%feature("docstring", "Supply authentication to a login prompt. "
"Blocks until navigation completes or another login prompt appears "
"in the case of failed auth.") SetAuth;
- bool SetAuth(const std::wstring& username, const std::wstring& password);
+ bool SetAuth(const string16& username, const string16& password);
%feature("docstring", "Cancel authentication to a login prompt. ")
CancelAuth;
bool CancelAuth();
@@ -277,23 +277,23 @@ class PyUITestBase {
%feature("docstring", "Add a bookmark folder with the given index in the parent."
" |title| is the title/name of the folder.") AddBookmarkGroup;
- bool AddBookmarkGroup(std::wstring parent_id, int index, std::wstring title);
+ bool AddBookmarkGroup(string16 parent_id, int index, string16 title);
%feature("docstring", "Add a bookmark with the given title and URL.") AddBookmarkURL;
- bool AddBookmarkURL(std::wstring parent_id, int index,
- std::wstring title, const std::wstring url);
+ bool AddBookmarkURL(string16 parent_id, int index,
+ string16 title, const string16 url);
%feature("docstring", "Move a bookmark to a new parent.") ReparentBookmark;
- bool ReparentBookmark(std::wstring id, std::wstring new_parent_id, int index);
+ bool ReparentBookmark(string16 id, string16 new_parent_id, int index);
%feature("docstring", "Set the title of a bookmark.") SetBookmarkTitle;
- bool SetBookmarkTitle(std::wstring id, std::wstring title);
+ bool SetBookmarkTitle(string16 id, string16 title);
%feature("docstring", "Set the URL of a bookmark.") SetBookmarkURL;
- bool SetBookmarkURL(std::wstring id, const std::wstring url);
+ bool SetBookmarkURL(string16 id, string16 url);
%feature("docstring", "Remove (delete) a bookmark.") RemoveBookmark;
- bool RemoveBookmark(std::wstring id);
+ bool RemoveBookmark(string16 id);
%feature("docstring", "Open the Find box in the given or first browser "
"window.") OpenFindInPage;
diff --git a/chrome/test/ui/dom_checker_uitest.cc b/chrome/test/ui/dom_checker_uitest.cc
index 458b847..e162206 100644
--- a/chrome/test/ui/dom_checker_uitest.cc
+++ b/chrome/test/ui/dom_checker_uitest.cc
@@ -149,17 +149,18 @@ class DomCheckerTest : public UITest {
}
bool GetTestCount(TabProxy* tab, int* test_count) {
- return tab->ExecuteAndExtractInt(L"",
- L"window.domAutomationController.send(automation.GetTestCount());",
+ return tab->ExecuteAndExtractInt(string16(),
+ ASCIIToUTF16("window.domAutomationController.send("
+ "automation.GetTestCount());"),
test_count);
}
bool GetTestsFailed(TabProxy* tab, ResultsSet* tests_failed) {
- std::wstring json_wide;
- bool succeeded = tab->ExecuteAndExtractString(L"",
- L"window.domAutomationController.send("
- L" JSON.stringify(automation.GetFailures()));",
- &json_wide);
+ string16 json16;
+ bool succeeded = tab->ExecuteAndExtractString(string16(),
+ ASCIIToUTF16("window.domAutomationController.send("
+ "JSON.stringify(automation.GetFailures()));"),
+ &json16);
// Note that we don't use ASSERT_TRUE here (and in some other places) as it
// doesn't work inside a function with a return type other than void.
@@ -167,7 +168,7 @@ class DomCheckerTest : public UITest {
if (!succeeded)
return false;
- std::string json = WideToUTF8(json_wide);
+ std::string json = UTF16ToUTF8(json16);
JSONStringValueSerializer deserializer(json);
scoped_ptr<Value> value(deserializer.Deserialize(NULL, NULL));
diff --git a/chrome/test/ui/dromaeo_benchmark_uitest.cc b/chrome/test/ui/dromaeo_benchmark_uitest.cc
index 684f695..350481d 100644
--- a/chrome/test/ui/dromaeo_benchmark_uitest.cc
+++ b/chrome/test/ui/dromaeo_benchmark_uitest.cc
@@ -65,10 +65,11 @@ class DromaeoTest : public UIPerfTest {
}
bool GetScore(TabProxy* tab, std::string* score) {
- std::wstring score_wide;
- bool succeeded = tab->ExecuteAndExtractString(L"",
- L"window.domAutomationController.send(automation.GetScore());",
- &score_wide);
+ string16 score16;
+ bool succeeded = tab->ExecuteAndExtractString(string16(),
+ ASCIIToUTF16("window.domAutomationController.send("
+ "automation.GetScore());"),
+ &score16);
// Note that we don't use ASSERT_TRUE here (and in some other places) as it
// doesn't work inside a function with a return type other than void.
@@ -76,22 +77,22 @@ class DromaeoTest : public UIPerfTest {
if (!succeeded)
return false;
- score->assign(WideToUTF8(score_wide));
+ score->assign(UTF16ToUTF8(score16));
return true;
}
bool GetResults(TabProxy* tab, ResultsMap* results) {
- std::wstring json_wide;
- bool succeeded = tab->ExecuteAndExtractString(L"",
- L"window.domAutomationController.send("
- L" JSON.stringify(automation.GetResults()));",
- &json_wide);
+ string16 json16;
+ bool succeeded = tab->ExecuteAndExtractString(string16(),
+ ASCIIToUTF16("window.domAutomationController.send("
+ "JSON.stringify(automation.GetResults()));"),
+ &json16);
EXPECT_TRUE(succeeded);
if (!succeeded)
return false;
- std::string json = WideToUTF8(json_wide);
+ std::string json = UTF16ToUTF8(json16);
return JsonDictionaryToMap(json, results);
}
diff --git a/chrome/test/ui/layout_plugin_uitest.cc b/chrome/test/ui/layout_plugin_uitest.cc
index 0e173f8a..4651032 100644
--- a/chrome/test/ui/layout_plugin_uitest.cc
+++ b/chrome/test/ui/layout_plugin_uitest.cc
@@ -7,6 +7,7 @@
#include "base/file_path.h"
#include "base/path_service.h"
#include "base/test/test_timeouts.h"
+#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/ui_test_utils.h"
@@ -33,15 +34,15 @@ TEST_F(LayoutPluginTester, UnloadNoCrash) {
path = path.AppendASCII("npapi").AppendASCII("layout_test_plugin.html");
NavigateToURL(net::FilePathToFileURL(path));
- std::wstring title;
+ string16 title;
scoped_refptr<TabProxy> tab = GetActiveTab();
ASSERT_TRUE(tab);
EXPECT_TRUE(tab->GetTabTitle(&title));
- EXPECT_EQ(L"Layout Test Plugin Test", title);
+ EXPECT_EQ(ASCIIToUTF16("Layout Test Plugin Test"), title);
ASSERT_TRUE(tab->GoBack());
EXPECT_TRUE(tab->GetTabTitle(&title));
- EXPECT_EQ(L"", title);
+ EXPECT_EQ(string16(), title);
}
// Tests if a plugin executing a self deleting script using NPN_GetURL
diff --git a/chrome/test/ui/sunspider_uitest.cc b/chrome/test/ui/sunspider_uitest.cc
index bcc8ff6..6b9d0f0 100644
--- a/chrome/test/ui/sunspider_uitest.cc
+++ b/chrome/test/ui/sunspider_uitest.cc
@@ -66,10 +66,11 @@ class SunSpiderTest : public UIPerfTest {
}
bool GetTotal(TabProxy* tab, std::string* total) {
- std::wstring total_wide;
- bool succeeded = tab->ExecuteAndExtractString(L"",
- L"window.domAutomationController.send(automation.GetTotal());",
- &total_wide);
+ string16 total16;
+ bool succeeded = tab->ExecuteAndExtractString(string16(),
+ ASCIIToUTF16("window.domAutomationController.send("
+ "automation.GetTotal());"),
+ &total16);
// Note that we don't use ASSERT_TRUE here (and in some other places) as it
// doesn't work inside a function with a return type other than void.
@@ -77,22 +78,22 @@ class SunSpiderTest : public UIPerfTest {
if (!succeeded)
return false;
- total->assign(WideToUTF8(total_wide));
+ total->assign(UTF16ToUTF8(total16));
return true;
}
bool GetResults(TabProxy* tab, ResultsMap* results) {
- std::wstring json_wide;
- bool succeeded = tab->ExecuteAndExtractString(L"",
- L"window.domAutomationController.send("
- L" JSON.stringify(automation.GetResults()));",
- &json_wide);
+ string16 json16;
+ bool succeeded = tab->ExecuteAndExtractString(string16(),
+ ASCIIToUTF16("window.domAutomationController.send("
+ "JSON.stringify(automation.GetResults()));"),
+ &json16);
EXPECT_TRUE(succeeded);
if (!succeeded)
return false;
- std::string json = WideToUTF8(json_wide);
+ std::string json = UTF16ToUTF8(json16);
return JsonDictionaryToMap(json, results);
}
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 2424006..b06d7e6 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -339,14 +339,14 @@ GURL UITestBase::GetActiveTabURL(int window_index) {
}
std::wstring UITestBase::GetActiveTabTitle(int window_index) {
- std::wstring title;
+ string16 title;
scoped_refptr<TabProxy> tab_proxy(GetActiveTab(window_index));
EXPECT_TRUE(tab_proxy.get());
if (!tab_proxy.get())
- return title;
+ return std::wstring();
EXPECT_TRUE(tab_proxy->GetTabTitle(&title));
- return title;
+ return UTF16ToWideHack(title);
}
int UITestBase::GetActiveTabIndex(int window_index) {
@@ -724,7 +724,8 @@ bool UITest::WaitUntilJavaScriptCondition(TabProxy* tab,
return false;
bool done_value = false;
- bool success = tab->ExecuteAndExtractBool(frame_xpath, jscript,
+ bool success = tab->ExecuteAndExtractBool(WideToUTF16Hack(frame_xpath),
+ WideToUTF16Hack(jscript),
&done_value);
EXPECT_TRUE(success);
if (!success)
diff --git a/chrome/test/ui/v8_benchmark_uitest.cc b/chrome/test/ui/v8_benchmark_uitest.cc
index b3d12c9..1d30bff 100644
--- a/chrome/test/ui/v8_benchmark_uitest.cc
+++ b/chrome/test/ui/v8_benchmark_uitest.cc
@@ -67,10 +67,11 @@ class V8BenchmarkTest : public UIPerfTest {
}
bool GetScore(TabProxy* tab, std::string* score) {
- std::wstring score_wide;
- bool succeeded = tab->ExecuteAndExtractString(L"",
- L"window.domAutomationController.send(automation.GetScore());",
- &score_wide);
+ string16 score16;
+ bool succeeded = tab->ExecuteAndExtractString(string16(),
+ ASCIIToUTF16("window.domAutomationController.send("
+ "automation.GetScore());"),
+ &score16);
// Note that we don't use ASSERT_TRUE here (and in some other places) as it
// doesn't work inside a function with a return type other than void.
@@ -78,22 +79,22 @@ class V8BenchmarkTest : public UIPerfTest {
if (!succeeded)
return false;
- score->assign(WideToUTF8(score_wide));
+ score->assign(UTF16ToUTF8(score16));
return true;
}
bool GetResults(TabProxy* tab, ResultsMap* results) {
- std::wstring json_wide;
- bool succeeded = tab->ExecuteAndExtractString(L"",
- L"window.domAutomationController.send("
- L" JSON.stringify(automation.GetResults()));",
- &json_wide);
+ string16 json16;
+ bool succeeded = tab->ExecuteAndExtractString(string16(),
+ ASCIIToUTF16("window.domAutomationController.send("
+ "JSON.stringify(automation.GetResults()));"),
+ &json16);
EXPECT_TRUE(succeeded);
if (!succeeded)
return false;
- std::string json = WideToUTF8(json_wide);
+ std::string json = UTF16ToUTF8(json16);
return JsonDictionaryToMap(json, results);
}
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index 436273b..4712faf 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -288,7 +288,8 @@ class InProcessJavaScriptExecutionController
// Executes |script| and sets the JSON response |json|.
virtual bool ExecuteJavaScriptAndGetJSON(const std::string& script,
std::string* json) {
- render_view_host_->ExecuteJavascriptInWebFrame(L"", UTF8ToWide(script));
+ render_view_host_->ExecuteJavascriptInWebFrame(string16(),
+ UTF8ToUTF16(script));
DOMOperationObserver dom_op_observer(render_view_host_);
return dom_op_observer.GetResponse(json);
}
@@ -323,7 +324,8 @@ bool ExecuteJavaScriptHelper(RenderViewHost* render_view_host,
// automation id.
std::wstring script = L"window.domAutomationController.setAutomationId(0);" +
original_script;
- render_view_host->ExecuteJavascriptInWebFrame(frame_xpath, script);
+ render_view_host->ExecuteJavascriptInWebFrame(WideToUTF16Hack(frame_xpath),
+ WideToUTF16Hack(script));
DOMOperationObserver dom_op_observer(render_view_host);
std::string json;
if (!dom_op_observer.GetResponse(&json))
diff --git a/chrome/test/url_fetch_test/url_fetch_test.cc b/chrome/test/url_fetch_test/url_fetch_test.cc
index 5f1607c..9ff033b 100644
--- a/chrome/test/url_fetch_test/url_fetch_test.cc
+++ b/chrome/test/url_fetch_test/url_fetch_test.cc
@@ -85,11 +85,12 @@ class UrlFetchTest : public UITest {
std::string script = StringPrintf(
"window.domAutomationController.send(%s);", var_to_fetch);
- std::wstring value;
- bool success = tab->ExecuteAndExtractString(L"", ASCIIToWide(script),
+ string16 value;
+ bool success = tab->ExecuteAndExtractString(string16(),
+ ASCIIToUTF16(script),
&value);
ASSERT_TRUE(success);
- result->javascript_variable = WideToUTF8(value);
+ result->javascript_variable = UTF16ToUTF8(value);
}
}
};
diff --git a/chrome/test/webdriver/automation.cc b/chrome/test/webdriver/automation.cc
index e0cd968..37d87f6 100644
--- a/chrome/test/webdriver/automation.cc
+++ b/chrome/test/webdriver/automation.cc
@@ -50,13 +50,12 @@ void Automation::ExecuteScript(const std::string& frame_xpath,
const std::string& script,
std::string* result,
bool* success) {
- std::wstring wide_xpath = UTF8ToWide(frame_xpath);
- std::wstring wide_script = UTF8ToWide(script);
- std::wstring wide_result;
- *success = tab_->ExecuteAndExtractString(
- wide_xpath, wide_script, &wide_result);
+ string16 xpath16 = UTF8ToUTF16(frame_xpath);
+ string16 script16 = UTF8ToUTF16(script);
+ string16 result16;
+ *success = tab_->ExecuteAndExtractString(xpath16, script16, &result16);
if (*success)
- *result = WideToUTF8(wide_result);
+ *result = UTF16ToUTF8(result16);
}
void Automation::NavigateToURL(const std::string& url,
@@ -86,10 +85,10 @@ void Automation::GetURL(std::string* url,
void Automation::GetTabTitle(std::string* tab_title,
bool* success) {
- std::wstring wide_title;
- *success = tab_->GetTabTitle(&wide_title);
+ string16 title16;
+ *success = tab_->GetTabTitle(&title16);
if (*success)
- *tab_title = WideToUTF8(wide_title);
+ *tab_title = UTF16ToUTF8(title16);
}
} // namespace webdriver
diff --git a/chrome/tools/convert_dict/convert_dict_unittest.cc b/chrome/tools/convert_dict/convert_dict_unittest.cc
index 5f56c69..f8d1971 100644
--- a/chrome/tools/convert_dict/convert_dict_unittest.cc
+++ b/chrome/tools/convert_dict/convert_dict_unittest.cc
@@ -1,4 +1,4 @@
-// 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.
@@ -62,18 +62,18 @@ bool VerifyWords(const convert_dict::DicReader::WordList& org_words,
// * Creates bdict data.
// * Verify the bdict data.
void RunDictionaryTest(const char* codepage,
- const std::map<std::wstring, bool>& word_list) {
+ const std::map<string16, bool>& word_list) {
// Create an affix data and a dictionary data.
std::string aff_data(StringPrintf("SET %s\n", codepage));
std::string dic_data(StringPrintf("%" PRIuS "\n", word_list.size()));
- for (std::map<std::wstring, bool>::const_iterator it = word_list.begin();
+ for (std::map<string16, bool>::const_iterator it = word_list.begin();
it != word_list.end(); ++it) {
std::string encoded_word;
- EXPECT_TRUE(WideToCodepage(it->first,
- codepage,
- base::OnStringConversionError::FAIL,
- &encoded_word));
+ EXPECT_TRUE(UTF16ToCodepage(it->first,
+ codepage,
+ base::OnStringConversionError::FAIL,
+ &encoded_word));
dic_data += encoded_word;
dic_data += "\n";
}
@@ -101,7 +101,7 @@ void RunDictionaryTest(const char* codepage,
for (size_t i = 0; i < dic_reader.words().size(); ++i) {
SCOPED_TRACE(StringPrintf("dic_reader.words()[%" PRIuS "]: %s",
i, dic_reader.words()[i].first.c_str()));
- std::wstring word(UTF8ToWide(dic_reader.words()[i].first));
+ string16 word(UTF8ToUTF16(dic_reader.words()[i].first));
EXPECT_TRUE(word_list.find(word) != word_list.end());
}
@@ -149,9 +149,10 @@ TEST(ConvertDictTest, English) {
L"they",
};
- std::map<std::wstring, bool> word_list;
+ std::map<string16, bool> word_list;
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kWords); ++i)
- word_list.insert(std::make_pair<std::wstring, bool>(kWords[i], true));
+ word_list.insert(std::make_pair<string16, bool>(WideToUTF16(kWords[i]),
+ true));
RunDictionaryTest(kCodepage, word_list);
}
@@ -170,9 +171,10 @@ TEST(ConvertDictTest, Russian) {
L"\x043e\x043d\x0438",
};
- std::map<std::wstring, bool> word_list;
+ std::map<string16, bool> word_list;
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kWords); ++i)
- word_list.insert(std::make_pair<std::wstring, bool>(kWords[i], true));
+ word_list.insert(std::make_pair<string16, bool>(WideToUTF16(kWords[i]),
+ true));
RunDictionaryTest(kCodepage, word_list);
}
@@ -193,9 +195,10 @@ TEST(ConvertDictTest, Hungarian) {
L"\x006d\x0061\x0067\x0075\x006b",
};
- std::map<std::wstring, bool> word_list;
+ std::map<string16, bool> word_list;
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kWords); ++i)
- word_list.insert(std::make_pair<std::wstring, bool>(kWords[i], true));
+ word_list.insert(std::make_pair<string16, bool>(WideToUTF16(kWords[i]),
+ true));
RunDictionaryTest(kCodepage, word_list);
}