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

Unified Diff: chrome/browser/extensions/extension_install_ui_browsertest.cc

Issue 10916328: Convert themes.py to browser test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1179988c2456d39782c98a4d1a2f36dd19094d0a 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());
}
@@ -51,8 +64,6 @@ class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest {
IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
MAYBE_TestThemeInstallUndoResetsToDefault) {
- ui_test_utils::CloseAllInfoBars(chrome::GetActiveTabContents(browser()));
-
// Install theme once and undo to verify we go back to default theme.
FilePath theme_crx = PackExtension(test_data_dir_.AppendASCII("theme"));
ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 1, browser()));
@@ -80,20 +91,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
TestThemeInstallUndoResetsToPreviousTheme) {
- 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 +106,21 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
EXPECT_EQ(theme, GetTheme());
}
+IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
+ TestThemeReset) {
+ 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
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698