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

Side by Side Diff: chrome/browser/popup_blocker_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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/browser/autocomplete/autocomplete_match.h" 10 #include "chrome/browser/autocomplete/autocomplete_match.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 GURL GetTestURL() { 47 GURL GetTestURL() {
48 return ui_test_utils::GetTestUrl( 48 return ui_test_utils::GetTestUrl(
49 FilePath(kTestDir), 49 FilePath(kTestDir),
50 FilePath(FILE_PATH_LITERAL("popup-blocked-to-post-blank.html"))); 50 FilePath(FILE_PATH_LITERAL("popup-blocked-to-post-blank.html")));
51 } 51 }
52 52
53 std::vector<WebContents*> GetBlockedContents(Browser* browser) { 53 std::vector<WebContents*> GetBlockedContents(Browser* browser) {
54 // Do a round trip to the renderer first to flush any in-flight IPCs to 54 // Do a round trip to the renderer first to flush any in-flight IPCs to
55 // create a to-be-blocked window. 55 // create a to-be-blocked window.
56 WebContents* tab = chrome::GetActiveWebContents(browser); 56 WebContents* tab = chrome::GetActiveWebContents(browser);
57 CHECK(content::ExecuteJavaScript(tab->GetRenderViewHost(), "", "")); 57 CHECK(content::ExecuteScript(tab, ""));
58 BlockedContentTabHelper* blocked_content_tab_helper = 58 BlockedContentTabHelper* blocked_content_tab_helper =
59 BlockedContentTabHelper::FromWebContents(tab); 59 BlockedContentTabHelper::FromWebContents(tab);
60 std::vector<WebContents*> blocked_contents; 60 std::vector<WebContents*> blocked_contents;
61 blocked_content_tab_helper->GetBlockedContents(&blocked_contents); 61 blocked_content_tab_helper->GetBlockedContents(&blocked_contents);
62 return blocked_contents; 62 return blocked_contents;
63 } 63 }
64 64
65 void NavigateAndCheckPopupShown(Browser* browser, const GURL& url) { 65 void NavigateAndCheckPopupShown(Browser* browser, const GURL& url) {
66 content::WindowedNotificationObserver observer( 66 content::WindowedNotificationObserver observer(
67 chrome::NOTIFICATION_TAB_ADDED, 67 chrome::NOTIFICATION_TAB_ADDED,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 browser()->profile()); 166 browser()->profile());
167 ui_test_utils::WaitForTemplateURLServiceToLoad(service); 167 ui_test_utils::WaitForTemplateURLServiceToLoad(service);
168 LocationBar* location_bar = browser()->window()->GetLocationBar(); 168 LocationBar* location_bar = browser()->window()->GetLocationBar();
169 ui_test_utils::SendToOmniboxAndSubmit(location_bar, search_string); 169 ui_test_utils::SendToOmniboxAndSubmit(location_bar, search_string);
170 OmniboxEditModel* model = location_bar->GetLocationEntry()->model(); 170 OmniboxEditModel* model = location_bar->GetLocationEntry()->model();
171 EXPECT_EQ(GURL(search_string), model->CurrentMatch().destination_url); 171 EXPECT_EQ(GURL(search_string), model->CurrentMatch().destination_url);
172 EXPECT_EQ(ASCIIToUTF16(search_string), model->CurrentMatch().contents); 172 EXPECT_EQ(ASCIIToUTF16(search_string), model->CurrentMatch().contents);
173 } 173 }
174 174
175 } // namespace 175 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_prefs_browsertest.cc ('k') | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698