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

Unified Diff: chrome/browser/popup_blocker_browsertest.cc

Issue 10938033: Switch BlockedContentTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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/popup_blocker_browsertest.cc
diff --git a/chrome/browser/popup_blocker_browsertest.cc b/chrome/browser/popup_blocker_browsertest.cc
index 84487b767be12677a6c794a92357c8cd62d79b4e..dd8a5c4079ef2ad3fc459c5d7c91e9dee33b495f 100644
--- a/chrome/browser/popup_blocker_browsertest.cc
+++ b/chrome/browser/popup_blocker_browsertest.cc
@@ -21,7 +21,6 @@
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -50,16 +49,15 @@ class PopupBlockerBrowserTest : public InProcessBrowserTest {
FilePath(FILE_PATH_LITERAL("popup-blocked-to-post-blank.html")));
}
- std::vector<TabContents*> GetBlockedContents(Browser* browser) {
+ std::vector<WebContents*> GetBlockedContents(Browser* browser) {
// Do a round trip to the renderer first to flush any in-flight IPCs to
// create a to-be-blocked window.
- TabContents* tab = chrome::GetActiveTabContents(browser);
- CHECK(content::ExecuteJavaScript(
- tab->web_contents()->GetRenderViewHost(), L"", L""));
- BlockedContentTabHelper* blocked_content =
- tab->blocked_content_tab_helper();
- std::vector<TabContents*> blocked_contents;
- blocked_content->GetBlockedContents(&blocked_contents);
+ WebContents* tab = chrome::GetActiveWebContents(browser);
+ CHECK(content::ExecuteJavaScript(tab->GetRenderViewHost(), L"", L""));
+ BlockedContentTabHelper* blocked_content_tab_helper =
+ BlockedContentTabHelper::FromWebContents(tab);
+ std::vector<WebContents*> blocked_contents;
+ blocked_content_tab_helper->GetBlockedContents(&blocked_contents);
return blocked_contents;
}
@@ -72,7 +70,7 @@ class PopupBlockerBrowserTest : public InProcessBrowserTest {
ASSERT_EQ(2u, browser::GetBrowserCount(browser->profile()));
- std::vector<TabContents*> blocked_contents = GetBlockedContents(browser);
+ std::vector<WebContents*> blocked_contents = GetBlockedContents(browser);
ASSERT_TRUE(blocked_contents.empty());
}
@@ -88,17 +86,16 @@ class PopupBlockerBrowserTest : public InProcessBrowserTest {
WebContents* web_contents = chrome::GetActiveWebContents(browser);
EXPECT_EQ(url, web_contents->GetURL());
- std::vector<TabContents*> blocked_contents = GetBlockedContents(browser);
+ std::vector<WebContents*> blocked_contents = GetBlockedContents(browser);
ASSERT_EQ(1u, blocked_contents.size());
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_TAB_ADDED,
content::NotificationService::AllSources());
- TabContents* tab_contents = TabContents::FromWebContents(web_contents);
- BlockedContentTabHelper* blocked_content =
- tab_contents->blocked_content_tab_helper();
- blocked_content->LaunchForContents(blocked_contents[0]);
+ BlockedContentTabHelper* blocked_content_tab_helper =
+ BlockedContentTabHelper::FromWebContents(web_contents);
+ blocked_content_tab_helper->LaunchForContents(blocked_contents[0]);
observer.Wait();
}
@@ -117,7 +114,7 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, MultiplePopups) {
GURL url(ui_test_utils::GetTestUrl(
FilePath(kTestDir), FilePath(FILE_PATH_LITERAL("popup-many.html"))));
ui_test_utils::NavigateToURL(browser(), url);
- std::vector<TabContents*> blocked_contents = GetBlockedContents(browser());
+ std::vector<WebContents*> blocked_contents = GetBlockedContents(browser());
ASSERT_EQ(2u, blocked_contents.size());
}
« no previous file with comments | « chrome/browser/instant/instant_loader.cc ('k') | chrome/browser/ui/blocked_content/blocked_content_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698