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

Unified Diff: chrome/browser/themes/theme_service_unittest.cc

Issue 22677002: Notify ThemeService via callback when supervised user is ready. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unit test. Created 7 years, 4 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
Index: chrome/browser/themes/theme_service_unittest.cc
diff --git a/chrome/browser/themes/theme_service_unittest.cc b/chrome/browser/themes/theme_service_unittest.cc
index 4168f965971655ab3981d5091569a709bd04de1d..65ea0e619b0be2e7be6a05d3c7dc263994c65b18 100644
--- a/chrome/browser/themes/theme_service_unittest.cc
+++ b/chrome/browser/themes/theme_service_unittest.cc
@@ -6,19 +6,26 @@
#include "base/json/json_reader.h"
#include "chrome/browser/extensions/extension_service_unittest.h"
+#include "chrome/browser/managed_mode/managed_user_service.h"
+#include "chrome/browser/managed_mode/managed_user_service_factory.h"
#include "chrome/browser/themes/custom_theme_supplier.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/pref_names.h"
+#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
+#include "chrome/test/base/testing_profile_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace theme_service_internal {
class ThemeServiceTest : public ExtensionServiceTestBase {
public:
- ThemeServiceTest() {}
+ ThemeServiceTest() {
+ manager_.reset(
+ new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
+ }
virtual ~ThemeServiceTest() {}
scoped_refptr<extensions::Extension> MakeThemeExtension(base::FilePath path) {
@@ -40,11 +47,20 @@ class ThemeServiceTest : public ExtensionServiceTestBase {
virtual void SetUp() {
ExtensionServiceTestBase::SetUp();
InitializeEmptyExtensionService();
+ bool success = manager_->SetUp();
+ EXPECT_TRUE(success);
pkotwicz 2013/08/09 16:49:37 Nit: ASSERT_TRUE() is probably more appropriate.
Adrian Kuegel 2013/08/09 21:21:59 Done.
}
const CustomThemeSupplier* get_theme_supplier(ThemeService* theme_service) {
return theme_service->get_theme_supplier();
}
+
+ TestingProfileManager* manager() {
+ return manager_.get();
+ }
+
+ private:
+ scoped_ptr<TestingProfileManager> manager_;
};
// Installs then uninstalls a theme and makes sure that the ThemeService
@@ -103,6 +119,18 @@ TEST_F(ThemeServiceTest, ManagedUserThemeReplacesDefaultTheme) {
CustomThemeSupplier::MANAGED_USER_THEME);
}
+TEST_F(ThemeServiceTest, ManagedUserThemeNewUser) {
pkotwicz 2013/08/09 16:49:37 I was hoping we could get a browsertest with a rea
Adrian Kuegel 2013/08/09 21:21:59 Ok, I will try to write a browser test for this, b
+ TestingProfile* profile = manager()->CreateTestingProfile("mu");
+ // Simulate the current initialization behavior: first the ThemeService is
+ // created, then the supervised user profile is initialized.
+ ThemeService* theme_service =
+ ThemeServiceFactory::GetForProfile(profile);
+ ManagedUserServiceFactory::GetForProfile(profile)->InitForTesting();
+ EXPECT_EQ(get_theme_supplier(theme_service)->get_theme_type(),
+ CustomThemeSupplier::MANAGED_USER_THEME);
+ manager()->DeleteTestingProfile("mu");
+}
+
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
// Checks that managed users don't use the system theme even if it is the
// default. The system theme is only available on Linux.

Powered by Google App Engine
This is Rietveld 408576698