Chromium Code Reviews| OLD | NEW |
|---|---|
| 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(); |
|
Peter Kasting
2011/08/31 18:47:32
Nit: Convert this TCW* temp into an InfoBarTabHelp
| |
| 22 ASSERT_TRUE(tab); | 23 ASSERT_TRUE(tab); |
| 23 ASSERT_EQ(1U, tab->infobar_count()); | 24 ASSERT_EQ(1U, tab->infobar_tab_helper()->infobar_count()); |
| 24 ConfirmInfoBarDelegate* delegate = | 25 ConfirmInfoBarDelegate* delegate = tab->infobar_tab_helper()-> |
| 25 tab->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); | 26 GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); |
| 26 ASSERT_TRUE(delegate); | 27 ASSERT_TRUE(delegate); |
| 27 delegate->Cancel(); | 28 delegate->Cancel(); |
| 28 ASSERT_EQ(0U, tab->infobar_count()); | 29 ASSERT_EQ(0U, tab->infobar_tab_helper()->infobar_count()); |
| 29 } | 30 } |
| 30 | 31 |
| 31 const Extension* GetTheme() const { | 32 const Extension* GetTheme() const { |
| 32 return ThemeServiceFactory::GetThemeForProfile(browser()->profile()); | 33 return ThemeServiceFactory::GetThemeForProfile(browser()->profile()); |
| 33 } | 34 } |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 // Flaky on linux. See http://crbug.com/86105 | 37 // Flaky on linux. See http://crbug.com/86105 |
| 37 #if defined(OS_LINUX) | 38 #if defined(OS_LINUX) |
| 38 #define MAYBE_TestThemeInstallUndoResetsToDefault \ | 39 #define MAYBE_TestThemeInstallUndoResetsToDefault \ |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, | 126 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, |
| 126 incognito_profile)); | 127 incognito_profile)); |
| 127 | 128 |
| 128 EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count()); | 129 EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count()); |
| 129 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); | 130 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); |
| 130 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 131 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
| 131 ASSERT_TRUE(tab_contents); | 132 ASSERT_TRUE(tab_contents); |
| 132 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), | 133 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), |
| 133 "chrome://newtab/", false)); | 134 "chrome://newtab/", false)); |
| 134 } | 135 } |
| OLD | NEW |