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

Unified Diff: chrome/browser/ssl/ssl_browser_tests.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
Index: chrome/browser/ssl/ssl_browser_tests.cc
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index bf66efc80b4c9e5e57d80fa922b0c1aff11947fc..4c3b143af2f3ea0e9f90955cf6114e65ecf3136d 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -181,8 +181,9 @@ class SSLUITest : public InProcessBrowserTest {
while (base::Time::Now() < timeToQuit) {
bool workerFinished = false;
ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), std::wstring(),
- L"window.domAutomationController.send(IsWorkerFinished());",
+ tab->GetRenderViewHost(),
+ "",
+ "window.domAutomationController.send(IsWorkerFinished());",
&workerFinished));
if (workerFinished)
@@ -198,8 +199,9 @@ class SSLUITest : public InProcessBrowserTest {
bool actuallyLoadedContent = false;
ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), std::wstring(),
- L"window.domAutomationController.send(IsContentLoaded());",
+ tab->GetRenderViewHost(),
+ "",
+ "window.domAutomationController.send(IsContentLoaded());",
&actuallyLoadedContent));
EXPECT_EQ(expectLoaded, actuallyLoadedContent);
}
@@ -861,8 +863,10 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContents) {
int img_width;
EXPECT_TRUE(content::ExecuteJavaScriptAndExtractInt(
- tab->GetRenderViewHost(), std::wstring(),
- L"window.domAutomationController.send(ImageWidth());", &img_width));
+ tab->GetRenderViewHost(),
+ "",
+ "window.domAutomationController.send(ImageWidth());",
+ &img_width));
// In order to check that the image was not loaded, we check its width.
// The actual image (Google logo) is 114 pixels wide, we assume the broken
// image is less than 100.
@@ -870,8 +874,10 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContents) {
bool js_result = false;
EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), std::wstring(),
- L"window.domAutomationController.send(IsFooSet());", &js_result));
+ tab->GetRenderViewHost(),
+ "",
+ "window.domAutomationController.send(IsFooSet());",
+ &js_result));
EXPECT_FALSE(js_result);
}
@@ -895,7 +901,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentLoadedFromJS) {
// Load the insecure image.
bool js_result = false;
EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), std::wstring(), L"loadBadImage();",
+ tab->GetRenderViewHost(),
+ "",
+ "loadBadImage();",
&js_result));
EXPECT_TRUE(js_result);
@@ -1297,8 +1305,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) {
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(&tab->GetController()));
EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), std::wstring(),
- L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
+ tab->GetRenderViewHost(),
+ "",
+ "window.domAutomationController.send(clickLink('goodHTTPSLink'));",
&success));
ASSERT_TRUE(success);
observer.Wait();
@@ -1313,8 +1322,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) {
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(&tab->GetController()));
EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), std::wstring(),
- L"window.domAutomationController.send(clickLink('badHTTPSLink'));",
+ tab->GetRenderViewHost(),
+ "",
+ "window.domAutomationController.send(clickLink('badHTTPSLink'));",
&success));
ASSERT_TRUE(success);
observer.Wait();
@@ -1325,11 +1335,13 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) {
// And the frame should be blocked.
bool is_content_evil = true;
- std::wstring content_frame_xpath(L"html/frameset/frame[2]");
- std::wstring is_evil_js(L"window.domAutomationController.send("
- L"document.getElementById('evilDiv') != null);");
+ std::string content_frame_xpath("html/frameset/frame[2]");
+ std::string is_evil_js("window.domAutomationController.send("
+ "document.getElementById('evilDiv') != null);");
EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), content_frame_xpath, is_evil_js,
+ tab->GetRenderViewHost(),
+ content_frame_xpath,
+ is_evil_js,
&is_content_evil));
EXPECT_FALSE(is_content_evil);
@@ -1349,8 +1361,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) {
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(&tab->GetController()));
EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), std::wstring(),
- L"window.domAutomationController.send(clickLink('HTTPLink'));",
+ tab->GetRenderViewHost(),
+ "",
+ "window.domAutomationController.send(clickLink('HTTPLink'));",
&success));
ASSERT_TRUE(success);
observer.Wait();
@@ -1396,8 +1409,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) {
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(&tab->GetController()));
EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), std::wstring(),
- L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
+ tab->GetRenderViewHost(),
+ "",
+ "window.domAutomationController.send(clickLink('goodHTTPSLink'));",
&success));
ASSERT_TRUE(success);
observer.Wait();
@@ -1433,8 +1447,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestUnauthenticatedFrameNavigation) {
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(&tab->GetController()));
EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), std::wstring(),
- L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
+ tab->GetRenderViewHost(),
+ "",
+ "window.domAutomationController.send(clickLink('goodHTTPSLink'));",
&success));
ASSERT_TRUE(success);
observer.Wait();
@@ -1450,8 +1465,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestUnauthenticatedFrameNavigation) {
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(&tab->GetController()));
EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), std::wstring(),
- L"window.domAutomationController.send(clickLink('badHTTPSLink'));",
+ tab->GetRenderViewHost(),
+ "",
+ "window.domAutomationController.send(clickLink('badHTTPSLink'));",
&success));
ASSERT_TRUE(success);
observer.Wait();
@@ -1462,11 +1478,13 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestUnauthenticatedFrameNavigation) {
// And the frame should have been blocked (see bug #2316).
bool is_content_evil = true;
- std::wstring content_frame_xpath(L"html/frameset/frame[2]");
- std::wstring is_evil_js(L"window.domAutomationController.send("
- L"document.getElementById('evilDiv') != null);");
+ std::string content_frame_xpath("html/frameset/frame[2]");
+ std::string is_evil_js("window.domAutomationController.send("
+ "document.getElementById('evilDiv') != null);");
EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- tab->GetRenderViewHost(), content_frame_xpath, is_evil_js,
+ tab->GetRenderViewHost(),
+ content_frame_xpath,
+ is_evil_js,
&is_content_evil));
EXPECT_FALSE(is_content_evil);
}
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | chrome/browser/tab_contents/view_source_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698