Chromium Code Reviews| Index: chrome/browser/extensions/extension_install_ui_browsertest.cc |
| diff --git a/chrome/browser/extensions/extension_install_ui_browsertest.cc b/chrome/browser/extensions/extension_install_ui_browsertest.cc |
| index ff388d3337da29e7041d39c75322a3790d409fa7..04c044c9667c603a183294345b6dc0a962404779 100644 |
| --- a/chrome/browser/extensions/extension_install_ui_browsertest.cc |
| +++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc |
| @@ -3,13 +3,16 @@ |
| // found in the LICENSE file. |
| #include "base/string_util.h" |
| +#include "chrome/app/chrome_command_ids.h" |
| #include "chrome/browser/extensions/extension_browsertest.h" |
| #include "chrome/browser/extensions/extension_service.h" |
| #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
| #include "chrome/browser/infobars/infobar_tab_helper.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/themes/theme_service.h" |
| #include "chrome/browser/themes/theme_service_factory.h" |
| #include "chrome/browser/ui/browser.h" |
| +#include "chrome/browser/ui/browser_commands.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/browser_tabstrip.h" |
| #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| @@ -36,6 +39,16 @@ class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { |
| ASSERT_EQ(0U, infobar_helper->GetInfoBarCount()); |
| } |
| + // Install the given theme from the data dir and verify expected name. |
| + void InstallThemeAndVerify(const char* theme_name, |
| + const std::string& expected_name) { |
| + const FilePath theme_path = test_data_dir_.AppendASCII(theme_name); |
| + ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path, 1, browser())); |
| + const Extension* theme = GetTheme(); |
| + ASSERT_TRUE(theme); |
| + ASSERT_EQ(theme->name(), expected_name); |
| + } |
| + |
| const Extension* GetTheme() const { |
| return ThemeServiceFactory::GetThemeForProfile(browser()->profile()); |
| } |
| @@ -83,17 +96,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| ui_test_utils::CloseAllInfoBars(chrome::GetActiveTabContents(browser())); |
| // Install first theme. |
| - FilePath theme_path = test_data_dir_.AppendASCII("theme"); |
| - ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path, 1, browser())); |
| + InstallThemeAndVerify("theme", "camo theme"); |
| const Extension* theme = GetTheme(); |
| - ASSERT_TRUE(theme); |
| std::string theme_id = theme->id(); |
| // Then install second theme. |
| - FilePath theme_path2 = test_data_dir_.AppendASCII("theme2"); |
| - ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path2, 1, browser())); |
| + InstallThemeAndVerify("theme2", "snowflake theme"); |
| const Extension* theme2 = GetTheme(); |
| - ASSERT_TRUE(theme2); |
| EXPECT_FALSE(theme_id == theme2->id()); |
| // Undo second theme will revert to first theme. |
| @@ -101,6 +110,23 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| EXPECT_EQ(theme, GetTheme()); |
| } |
| +IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| + TestThemeReset) { |
| + ui_test_utils::CloseAllInfoBars(chrome::GetActiveTabContents(browser())); |
|
jam
2012/09/18 15:41:17
just noticed this. this shouldn't be necessary sin
Nirnimesh
2012/09/18 18:09:14
This was already there in other tests in this file
jam
2012/09/18 18:19:46
ah, those are unnecessary too. can you take them a
Nirnimesh
2012/09/18 18:34:08
Removed all.
|
| + |
| + InstallThemeAndVerify("theme", "camo theme"); |
| + |
| + // Reset to default theme. |
| + ThemeServiceFactory::GetForProfile(browser()->profile())->UseDefaultTheme(); |
| + ASSERT_FALSE(GetTheme()); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, |
| + TestInstallThemeInFullScreen) { |
| + EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_FULLSCREEN)); |
| + InstallThemeAndVerify("theme", "camo theme"); |
| +} |
| + |
| #if defined(OS_WIN) |
| // http://crbug.com/141854 |
| #define MAYBE_AppInstallConfirmation FLAKY_AppInstallConfirmation |