From 591a59fe61d07d04b99d333628e23c73f528fa6e Mon Sep 17 00:00:00 2001 From: "avi@chromium.org" Date: Thu, 11 Oct 2012 01:16:23 +0000 Subject: Switch InfoBarTabHelper to use WebContentsUserData. BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11030045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161255 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/policy/policy_browsertest.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'chrome/browser/policy') diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 426c42c..70b5f84 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -973,9 +973,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, AlwaysAuthorizePlugins) { content::WebContents* contents = chrome::GetActiveWebContents(browser()); ASSERT_TRUE(contents); - TabContents* tab_contents = TabContents::FromWebContents(contents); - ASSERT_TRUE(tab_contents); - InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); + InfoBarTabHelper* infobar_helper = + InfoBarTabHelper::FromWebContents(contents); ASSERT_TRUE(infobar_helper); EXPECT_EQ(0u, infobar_helper->GetInfoBarCount()); @@ -984,7 +983,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, AlwaysAuthorizePlugins) { ui_test_utils::NavigateToURL(browser(), url); // This should have triggered the dangerous plugin infobar. ASSERT_EQ(1u, infobar_helper->GetInfoBarCount()); - InfoBarDelegate* infobar_delegate = infobar_helper->GetInfoBarDelegateAt(0); + InfoBarDelegate* infobar_delegate = + infobar_helper->GetInfoBarDelegateAt(0); EXPECT_TRUE(infobar_delegate->AsConfirmInfoBarDelegate()); // And the plugin isn't running. EXPECT_EQ(0, CountPlugins()); @@ -1270,9 +1270,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, TranslateEnabled) { // Get the |infobar_helper|, and verify that there are no infobars on startup. content::WebContents* contents = chrome::GetActiveWebContents(browser()); ASSERT_TRUE(contents); - TabContents* tab_contents = TabContents::FromWebContents(contents); - ASSERT_TRUE(tab_contents); - InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); + InfoBarTabHelper* infobar_helper = + InfoBarTabHelper::FromWebContents(contents); ASSERT_TRUE(infobar_helper); EXPECT_EQ(0u, infobar_helper->GetInfoBarCount()); @@ -1295,7 +1294,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, TranslateEnabled) { language_observer1.Wait(); // Verify that the translate infobar showed up. ASSERT_EQ(1u, infobar_helper->GetInfoBarCount()); - InfoBarDelegate* infobar_delegate = infobar_helper->GetInfoBarDelegateAt(0); + InfoBarDelegate* infobar_delegate = + infobar_helper->GetInfoBarDelegateAt(0); TranslateInfoBarDelegate* delegate = infobar_delegate->AsTranslateInfoBarDelegate(); ASSERT_TRUE(delegate); @@ -1303,7 +1303,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, TranslateEnabled) { EXPECT_EQ("fr", delegate->original_language_code()); // Now force disable translate. - ui_test_utils::CloseAllInfoBars(tab_contents); + infobar_helper->RemoveInfoBar(infobar_delegate); EXPECT_EQ(0u, infobar_helper->GetInfoBarCount()); policies.Set(key::kTranslateEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false)); -- cgit v1.1