Index: chrome/test/pyautolib/pyautolib.cc |
=================================================================== |
--- chrome/test/pyautolib/pyautolib.cc (revision 73855) |
+++ chrome/test/pyautolib/pyautolib.cc (working copy) |
@@ -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 @@ |
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 @@ |
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 @@ |
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 @@ |
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 @@ |
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, |