OLD | NEW |
1 // Copyright (c) 2010 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 "chrome/browser/extensions/extension_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
6 #include "chrome/browser/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
7 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" | 7 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/tab_contents/tab_contents.h" | 9 #include "chrome/browser/tab_contents/tab_contents.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/test/ui_test_utils.h" | 11 #include "chrome/test/ui_test_utils.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 // Theme ID used for testing. | 15 // Theme ID used for testing. |
16 const char* const theme_crx = "iamefpfkojoapidjnbafmgkgncegbkad"; | 16 const char* const theme_crx = "iamefpfkojoapidjnbafmgkgncegbkad"; |
17 | 17 |
18 } // namespace | 18 } // namespace |
19 | 19 |
20 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { | 20 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { |
21 public: | 21 public: |
22 // Checks that a theme info bar is currently visible and issues an undo to | 22 // Checks that a theme info bar is currently visible and issues an undo to |
23 // revert to the previous theme. | 23 // revert to the previous theme. |
24 void VerifyThemeInfoBarAndUndoInstall() { | 24 void VerifyThemeInfoBarAndUndoInstall() { |
25 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 25 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
26 ASSERT_TRUE(tab_contents); | 26 ASSERT_TRUE(tab_contents); |
27 ASSERT_EQ(1, tab_contents->infobar_delegate_count()); | 27 ASSERT_EQ(1, tab_contents->infobar_delegate_count()); |
28 ThemeInstalledInfoBarDelegate* delegate = tab_contents-> | 28 ConfirmInfoBarDelegate* delegate = |
29 GetInfoBarDelegateAt(0)->AsThemePreviewInfobarDelegate(); | 29 tab_contents->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); |
30 ASSERT_TRUE(delegate); | 30 ASSERT_TRUE(delegate); |
31 delegate->Cancel(); | 31 delegate->Cancel(); |
32 ASSERT_EQ(0, tab_contents->infobar_delegate_count()); | 32 ASSERT_EQ(0, tab_contents->infobar_delegate_count()); |
33 } | 33 } |
34 }; | 34 }; |
35 | 35 |
36 // Crashy, http://crbug.com/44548. | 36 // Crashy, http://crbug.com/44548. |
37 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, | 37 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
38 DISABLED_TestThemeInstallUndoResetsToDefault) { | 38 DISABLED_TestThemeInstallUndoResetsToDefault) { |
39 // Install theme once and undo to verify we go back to default theme. | 39 // Install theme once and undo to verify we go back to default theme. |
(...skipping 13 matching lines...) Expand all Loading... |
53 theme = browser()->profile()->GetTheme(); | 53 theme = browser()->profile()->GetTheme(); |
54 ASSERT_TRUE(theme); | 54 ASSERT_TRUE(theme); |
55 ASSERT_EQ(theme_crx, theme->id()); | 55 ASSERT_EQ(theme_crx, theme->id()); |
56 ASSERT_TRUE(InstallExtensionWithUI(theme_path, 0)); | 56 ASSERT_TRUE(InstallExtensionWithUI(theme_path, 0)); |
57 theme = browser()->profile()->GetTheme(); | 57 theme = browser()->profile()->GetTheme(); |
58 ASSERT_TRUE(theme); | 58 ASSERT_TRUE(theme); |
59 ASSERT_EQ(theme_crx, theme->id()); | 59 ASSERT_EQ(theme_crx, theme->id()); |
60 VerifyThemeInfoBarAndUndoInstall(); | 60 VerifyThemeInfoBarAndUndoInstall(); |
61 ASSERT_EQ(NULL, browser()->profile()->GetTheme()); | 61 ASSERT_EQ(NULL, browser()->profile()->GetTheme()); |
62 } | 62 } |
OLD | NEW |