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

Side by Side Diff: chrome/browser/extensions/subscribe_page_action_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, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_browsertest.h" 5 #include "chrome/browser/extensions/extension_browsertest.h"
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/browser_tabstrip.h" 7 #include "chrome/browser/ui/browser_tabstrip.h"
8 #include "chrome/common/extensions/extension.h" 8 #include "chrome/common/extensions/extension.h"
9 #include "chrome/common/url_constants.h" 9 #include "chrome/common/url_constants.h"
10 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 extension_id + std::string(kSubscribePage) + std::string("?") + 70 extension_id + std::string(kSubscribePage) + std::string("?") +
71 feed_url.spec() + std::string("&synchronous")); 71 feed_url.spec() + std::string("&synchronous"));
72 } else { 72 } else {
73 // Navigate to the feed content (which will cause the extension to try to 73 // Navigate to the feed content (which will cause the extension to try to
74 // sniff the type and display the subscribe page in another tab. 74 // sniff the type and display the subscribe page in another tab.
75 return GURL(feed_url.spec()); 75 return GURL(feed_url.spec());
76 } 76 }
77 } 77 }
78 78
79 bool ValidatePageElement(WebContents* tab, 79 bool ValidatePageElement(WebContents* tab,
80 const std::string& frame, 80 const std::string& frame_xpath,
81 const std::string& javascript, 81 const std::string& javascript,
82 const std::string& expected_value) { 82 const std::string& expected_value) {
83 std::string returned_value; 83 std::string returned_value;
84 std::string error; 84 std::string error;
85 85
86 if (!content::ExecuteJavaScriptAndExtractString( 86 if (!content::ExecuteScriptInFrameAndExtractString(tab, frame_xpath,
87 tab->GetRenderViewHost(), 87 javascript,
88 frame, 88 &returned_value))
89 javascript,
90 &returned_value))
91 return false; 89 return false;
92 90
93 EXPECT_STREQ(expected_value.c_str(), returned_value.c_str()); 91 EXPECT_STREQ(expected_value.c_str(), returned_value.c_str());
94 return expected_value == returned_value; 92 return expected_value == returned_value;
95 } 93 }
96 94
97 // Navigates to a feed page and, if |sniff_xml_type| is set, wait for the 95 // Navigates to a feed page and, if |sniff_xml_type| is set, wait for the
98 // extension to kick in, detect the feed and redirect to a feed preview page. 96 // extension to kick in, detect the feed and redirect to a feed preview page.
99 // |sniff_xml_type| is generally set to true if the feed is sniffable and false 97 // |sniff_xml_type| is generally set to true if the feed is sniffable and false
100 // for invalid feeds. 98 // for invalid feeds.
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 std::string id = extension->id(); 340 std::string id = extension->id();
343 341
344 // Valid feed but containing no links. 342 // Valid feed but containing no links.
345 NavigateToFeedAndValidate( 343 NavigateToFeedAndValidate(
346 test_server(), kValidFeedNoLinks, browser(), id, true, 344 test_server(), kValidFeedNoLinks, browser(), id, true,
347 "Feed for MyFeedTitle", 345 "Feed for MyFeedTitle",
348 "Title with no link", 346 "Title with no link",
349 "Desc", 347 "Desc",
350 "No error"); 348 "No error");
351 } 349 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/plugin_apitest.cc ('k') | chrome/browser/extensions/web_contents_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698