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

Side by Side Diff: chrome/browser/extensions/extension_install_ui_browsertest.cc

Issue 7810002: Move infobar handling to a tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/string_util.h" 5 #include "base/string_util.h"
6 #include "chrome/browser/extensions/extension_browsertest.h" 6 #include "chrome/browser/extensions/extension_browsertest.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" 8 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
9 #include "chrome/browser/infobars/infobar_tab_helper.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
12 #include "chrome/browser/themes/theme_service_factory.h" 13 #include "chrome/browser/themes/theme_service_factory.h"
13 #include "chrome/test/base/ui_test_utils.h" 14 #include "chrome/test/base/ui_test_utils.h"
14 #include "content/browser/tab_contents/tab_contents.h" 15 #include "content/browser/tab_contents/tab_contents.h"
15 16
16 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { 17 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest {
17 public: 18 public:
18 // Checks that a theme info bar is currently visible and issues an undo to 19 // Checks that a theme info bar is currently visible and issues an undo to
19 // revert to the previous theme. 20 // revert to the previous theme.
20 void VerifyThemeInfoBarAndUndoInstall() { 21 void VerifyThemeInfoBarAndUndoInstall() {
21 TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper(); 22 TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
22 ASSERT_TRUE(tab); 23 ASSERT_TRUE(tab);
23 ASSERT_EQ(1U, tab->infobar_count()); 24 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper();
24 ConfirmInfoBarDelegate* delegate = 25 ASSERT_EQ(1U, infobar_helper->infobar_count());
25 tab->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); 26 ConfirmInfoBarDelegate* delegate = infobar_helper->
27 GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate();
26 ASSERT_TRUE(delegate); 28 ASSERT_TRUE(delegate);
27 delegate->Cancel(); 29 delegate->Cancel();
28 ASSERT_EQ(0U, tab->infobar_count()); 30 ASSERT_EQ(0U, infobar_helper->infobar_count());
29 } 31 }
30 32
31 const Extension* GetTheme() const { 33 const Extension* GetTheme() const {
32 return ThemeServiceFactory::GetThemeForProfile(browser()->profile()); 34 return ThemeServiceFactory::GetThemeForProfile(browser()->profile());
33 } 35 }
34 }; 36 };
35 37
36 // Flaky on linux. See http://crbug.com/86105 38 // Flaky on linux. See http://crbug.com/86105
37 #if defined(OS_LINUX) 39 #if defined(OS_LINUX)
38 #define MAYBE_TestThemeInstallUndoResetsToDefault \ 40 #define MAYBE_TestThemeInstallUndoResetsToDefault \
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, 127 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1,
126 incognito_profile)); 128 incognito_profile));
127 129
128 EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count()); 130 EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count());
129 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); 131 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count());
130 TabContents* tab_contents = browser()->GetSelectedTabContents(); 132 TabContents* tab_contents = browser()->GetSelectedTabContents();
131 ASSERT_TRUE(tab_contents); 133 ASSERT_TRUE(tab_contents);
132 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), 134 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(),
133 "chrome://newtab/", false)); 135 "chrome://newtab/", false));
134 } 136 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_ui.cc ('k') | chrome/browser/extensions/extension_management_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698