From 19a906b8dce8dc3cc7a68673f6ca671808e054fc Mon Sep 17 00:00:00 2001 From: "tessamac@chromium.org" Date: Mon, 7 Feb 2011 20:56:37 +0000 Subject: New test checks that theme install undo reverts to previous theme. Test is for the code change in revision 70686 and to help ensure the bug 65967 doesn't reappear. (Also remove dependency on crx files.) BUG=65867 TEST=browser_tests and try bots Review URL: http://codereview.chromium.org/6269020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74024 0039d316-1c4b-4281-b951-d872f2087c98 --- .../extensions/extension_install_ui_browsertest.cc | 38 ++++++++++++++++------ 1 file changed, 28 insertions(+), 10 deletions(-) (limited to '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 465b189..327a923 100644 --- a/chrome/browser/extensions/extension_install_ui_browsertest.cc +++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc @@ -13,9 +13,6 @@ namespace { -// Theme ID used for testing. -const char* const theme_crx = "iamefpfkojoapidjnbafmgkgncegbkad"; - } // namespace class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { @@ -37,11 +34,11 @@ class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, TestThemeInstallUndoResetsToDefault) { // Install theme once and undo to verify we go back to default theme. - FilePath theme_path = test_data_dir_.AppendASCII("theme.crx"); - ASSERT_TRUE(InstallExtensionWithUI(theme_path, 1)); + FilePath theme_crx = PackExtension(test_data_dir_.AppendASCII("theme")); + ASSERT_TRUE(InstallExtensionWithUI(theme_crx, 1)); const Extension* theme = browser()->profile()->GetTheme(); ASSERT_TRUE(theme); - ASSERT_EQ(theme_crx, theme->id()); + std::string theme_id = theme->id(); VerifyThemeInfoBarAndUndoInstall(); ASSERT_EQ(NULL, browser()->profile()->GetTheme()); @@ -49,19 +46,40 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, // We set the |expected_change| to zero in these 'InstallExtensionWithUI' // calls since the theme has already been installed above and this is an // overinstall to set the active theme. - ASSERT_TRUE(InstallExtensionWithUI(theme_path, 0)); + ASSERT_TRUE(InstallExtensionWithUI(theme_crx, 0)); theme = browser()->profile()->GetTheme(); ASSERT_TRUE(theme); - ASSERT_EQ(theme_crx, theme->id()); - ASSERT_TRUE(InstallExtensionWithUI(theme_path, 0)); + ASSERT_EQ(theme_id, theme->id()); + ASSERT_TRUE(InstallExtensionWithUI(theme_crx, 0)); theme = browser()->profile()->GetTheme(); ASSERT_TRUE(theme); - ASSERT_EQ(theme_crx, theme->id()); + ASSERT_EQ(theme_id, theme->id()); VerifyThemeInfoBarAndUndoInstall(); ASSERT_EQ(NULL, browser()->profile()->GetTheme()); } IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, + TestThemeInstallUndoResetsToPreviousTheme) { + // Install first theme. + FilePath theme_path = test_data_dir_.AppendASCII("theme"); + ASSERT_TRUE(InstallExtensionWithUI(theme_path, 1)); + const Extension* theme = browser()->profile()->GetTheme(); + ASSERT_TRUE(theme); + std::string theme_id = theme->id(); + + // Then install second theme. + FilePath theme_path2 = test_data_dir_.AppendASCII("theme2"); + ASSERT_TRUE(InstallExtensionWithUI(theme_path2, 1)); + const Extension* theme2 = browser()->profile()->GetTheme(); + ASSERT_TRUE(theme2); + EXPECT_FALSE(theme_id == theme2->id()); + + // Undo second theme will revert to first theme. + VerifyThemeInfoBarAndUndoInstall(); + EXPECT_EQ(theme, browser()->profile()->GetTheme()); +} + +IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, AppInstallConfirmation) { int num_tabs = browser()->tab_count(); -- cgit v1.1