summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_install_ui_browsertest.cc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-22 18:05:22 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-22 18:05:22 +0000
commit18280378d78cc83d8e83de21f28411cb4fa777bc (patch)
treea820592ddb8899a850e75061fc2e4e533e8b149e /chrome/browser/extensions/extension_install_ui_browsertest.cc
parent33a85f181bf099afe9067d50277ea0e85e35f302 (diff)
downloadchromium_src-18280378d78cc83d8e83de21f28411cb4fa777bc.zip
chromium_src-18280378d78cc83d8e83de21f28411cb4fa777bc.tar.gz
chromium_src-18280378d78cc83d8e83de21f28411cb4fa777bc.tar.bz2
Profile shouldn't own BrowserThemeProviders; A ThemeService should and should give back a BTP when presented with a Profile.
This removes all Profile methods that deal with themes. A profile is now just the key that ThemeService maps to a BrowserThemeProvider. Any user of a BrowserThemeProvider asks ThemeService::GetForProfile() instead of the now deleted Profile::GetThemeProvider() method. Why do this? Because this will drastically reduce coupling. Right now, the Profile knows about pretty much every major object in chrome/browser/. This should allow easier compile time removal of certain systems. BUG=profile effort TEST=existing tests Review URL: http://codereview.chromium.org/6714003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79001 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_install_ui_browsertest.cc')
-rw-r--r--chrome/browser/extensions/extension_install_ui_browsertest.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/chrome/browser/extensions/extension_install_ui_browsertest.cc b/chrome/browser/extensions/extension_install_ui_browsertest.cc
index 05eebdf..f353bb9 100644
--- a/chrome/browser/extensions/extension_install_ui_browsertest.cc
+++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/themes/theme_service.h"
#include "chrome/test/ui_test_utils.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -29,6 +30,10 @@ class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest {
delegate->Cancel();
ASSERT_EQ(0U, tab_contents->infobar_count());
}
+
+ const Extension* GetTheme() const {
+ return ThemeServiceFactory::GetThemeForProfile(browser()->profile());
+ }
};
IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
@@ -36,26 +41,26 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
// Install theme once and undo to verify we go back to default theme.
FilePath theme_crx = PackExtension(test_data_dir_.AppendASCII("theme"));
ASSERT_TRUE(InstallExtensionWithUI(theme_crx, 1));
- const Extension* theme = browser()->profile()->GetTheme();
+ const Extension* theme = GetTheme();
ASSERT_TRUE(theme);
std::string theme_id = theme->id();
VerifyThemeInfoBarAndUndoInstall();
- ASSERT_EQ(NULL, browser()->profile()->GetTheme());
+ ASSERT_EQ(NULL, GetTheme());
// Set the same theme twice and undo to verify we go back to default theme.
// 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_crx, 0));
- theme = browser()->profile()->GetTheme();
+ theme = GetTheme();
ASSERT_TRUE(theme);
ASSERT_EQ(theme_id, theme->id());
ASSERT_TRUE(InstallExtensionWithUI(theme_crx, 0));
- theme = browser()->profile()->GetTheme();
+ theme = GetTheme();
ASSERT_TRUE(theme);
ASSERT_EQ(theme_id, theme->id());
VerifyThemeInfoBarAndUndoInstall();
- ASSERT_EQ(NULL, browser()->profile()->GetTheme());
+ ASSERT_EQ(NULL, GetTheme());
}
IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
@@ -63,20 +68,20 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
// Install first theme.
FilePath theme_path = test_data_dir_.AppendASCII("theme");
ASSERT_TRUE(InstallExtensionWithUI(theme_path, 1));
- const Extension* theme = browser()->profile()->GetTheme();
+ 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(InstallExtensionWithUI(theme_path2, 1));
- const Extension* theme2 = browser()->profile()->GetTheme();
+ const Extension* theme2 = 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());
+ EXPECT_EQ(theme, GetTheme());
}
IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,