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

Unified Diff: chrome/browser/policy/policy_browsertest.cc

Issue 11753009: Simplify ExecuteJavaScript* functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update prerender_browsertest.cc. 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/policy/policy_browsertest.cc
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index 1bec8bdf6e0ce54027b54274faba3ecf957dbcfc..ee50acd1850d9e795066f48dfa5eeadf6ec1cbaa 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -235,9 +235,8 @@ void CheckURLIsBlocked(Browser* browser, const char* spec) {
// Verify that the expected error page is being displayed.
// (error 138 == NETWORK_ACCESS_DENIED)
bool result = false;
- EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- contents->GetRenderViewHost(),
- "",
+ EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
+ contents,
"var hasError = false;"
"var error = document.getElementById('errorDetails');"
"if (error)"
@@ -289,9 +288,8 @@ int CountScreenshots() {
// Checks if WebGL is enabled in the given WebContents.
bool IsWebGLEnabled(content::WebContents* contents) {
bool result = false;
- EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- contents->GetRenderViewHost(),
- "",
+ EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
+ contents,
"var canvas = document.createElement('canvas');"
"var context = canvas.getContext('experimental-webgl');"
"domAutomationController.send(context != null);",
@@ -460,9 +458,8 @@ class PolicyTest : public InProcessBrowserTest {
// (setupCurrentScreenshot is replaced with our hook) or after it has
// completed (in that case send result immediately).
bool result = false;
- EXPECT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- web_contents->GetRenderViewHost(),
- "",
+ EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
+ web_contents,
"function btest_initCompleted(url) {"
" var img = new Image();"
" img.src = url;"
@@ -1723,9 +1720,8 @@ IN_PROC_BROWSER_TEST_F(PolicyStatisticsCollectorTest, Startup) {
ui_test_utils::NavigateToURL(browser(), kAboutHistograms);
content::WebContents* contents = chrome::GetActiveWebContents(browser());
std::string text;
- ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
- contents->GetRenderViewHost(),
- "",
+ ASSERT_TRUE(content::ExecuteScriptAndExtractString(
+ contents,
"var nodes = document.querySelectorAll('body > pre');"
"var result = '';"
"for (var i = 0; i < nodes.length; ++i) {"
« no previous file with comments | « chrome/browser/notifications/notification_browsertest.cc ('k') | chrome/browser/policy/policy_prefs_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698