Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Unified Diff: content/public/test/browser_test_utils.cc

Issue 11728003: Change ExecuteJavaScript* helper functions in browser_test_utils.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding files for gpu_tests and NaCl browser tests. Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/browser_test_utils.cc
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index 6efa0a66c3bd0cbf58723d7e29ae1258055c54a1..5de453bd17c1c28e562eda3344881ebac7bcae84 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -33,7 +33,6 @@
static const int kDefaultWsPort = 8880;
namespace content {
-
namespace {
class DOMOperationObserver : public NotificationObserver,
@@ -79,24 +78,24 @@ class DOMOperationObserver : public NotificationObserver,
// Specifying a prototype so that we can add the WARN_UNUSED_RESULT attribute.
bool ExecuteJavaScriptHelper(RenderViewHost* render_view_host,
- const std::wstring& frame_xpath,
- const std::wstring& original_script,
+ const std::string& frame_xpath,
+ const std::string& original_script,
scoped_ptr<Value>* result) WARN_UNUSED_RESULT;
// Executes the passed |original_script| in the frame pointed to by
// |frame_xpath|. If |result| is not NULL, stores the value that the evaluation
// of the script in |result|. Returns true on success.
bool ExecuteJavaScriptHelper(RenderViewHost* render_view_host,
- const std::wstring& frame_xpath,
- const std::wstring& original_script,
+ const std::string& frame_xpath,
+ const std::string& original_script,
scoped_ptr<Value>* result) {
// TODO(jcampan): we should make the domAutomationController not require an
// automation id.
- std::wstring script = L"window.domAutomationController.setAutomationId(0);" +
- original_script;
+ std::string script =
+ "window.domAutomationController.setAutomationId(0);" + original_script;
DOMOperationObserver dom_op_observer(render_view_host);
- render_view_host->ExecuteJavascriptInWebFrame(WideToUTF16Hack(frame_xpath),
- WideToUTF16Hack(script));
+ render_view_host->ExecuteJavascriptInWebFrame(UTF8ToUTF16(frame_xpath),
+ UTF8ToUTF16(script));
std::string json;
if (!dom_op_observer.WaitAndGetResponse(&json)) {
DLOG(ERROR) << "Cannot communicate with DOMOperationObserver.";
@@ -281,16 +280,16 @@ void SimulateKeyPress(WebContents* web_contents,
}
bool ExecuteJavaScript(RenderViewHost* render_view_host,
- const std::wstring& frame_xpath,
- const std::wstring& original_script) {
- std::wstring script =
- original_script + L";window.domAutomationController.send(0);";
+ const std::string& frame_xpath,
+ const std::string& original_script) {
+ std::string script =
+ original_script + ";window.domAutomationController.send(0);";
return ExecuteJavaScriptHelper(render_view_host, frame_xpath, script, NULL);
}
bool ExecuteJavaScriptAndExtractInt(RenderViewHost* render_view_host,
- const std::wstring& frame_xpath,
- const std::wstring& script,
+ const std::string& frame_xpath,
+ const std::string& script,
int* result) {
DCHECK(result);
scoped_ptr<Value> value;
@@ -302,8 +301,8 @@ bool ExecuteJavaScriptAndExtractInt(RenderViewHost* render_view_host,
}
bool ExecuteJavaScriptAndExtractBool(RenderViewHost* render_view_host,
- const std::wstring& frame_xpath,
- const std::wstring& script,
+ const std::string& frame_xpath,
+ const std::string& script,
bool* result) {
DCHECK(result);
scoped_ptr<Value> value;
@@ -315,8 +314,8 @@ bool ExecuteJavaScriptAndExtractBool(RenderViewHost* render_view_host,
}
bool ExecuteJavaScriptAndExtractString(RenderViewHost* render_view_host,
- const std::wstring& frame_xpath,
- const std::wstring& script,
+ const std::string& frame_xpath,
+ const std::string& script,
std::string* result) {
DCHECK(result);
scoped_ptr<Value> value;
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698