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

Side by Side Diff: chrome/browser/themes/theme_service_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/themes/theme_service.h" 5 #include "chrome/browser/themes/theme_service.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "chrome/browser/extensions/extension_service_unittest.h" 8 #include "chrome/browser/extensions/extension_service_unittest.h"
9 #include "chrome/browser/themes/theme_service_factory.h" 9 #include "chrome/browser/themes/theme_service_factory.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 TEST_F(ThemeServiceTest, ThemeInstallUninstall) { 46 TEST_F(ThemeServiceTest, ThemeInstallUninstall) {
47 base::ScopedTempDir temp_dir; 47 base::ScopedTempDir temp_dir;
48 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 48 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
49 ThemeService* theme_service = 49 ThemeService* theme_service =
50 ThemeServiceFactory::GetForProfile(profile_.get()); 50 ThemeServiceFactory::GetForProfile(profile_.get());
51 theme_service->UseDefaultTheme(); 51 theme_service->UseDefaultTheme();
52 scoped_refptr<extensions::Extension> extension = 52 scoped_refptr<extensions::Extension> extension =
53 MakeThemeExtension(temp_dir.path()); 53 MakeThemeExtension(temp_dir.path());
54 service_->FinishInstallationForTest(extension); 54 service_->FinishInstallationForTest(extension);
55 // Let ThemeService finish creating the theme pack. 55 // Let ThemeService finish creating the theme pack.
56 MessageLoop::current()->RunUntilIdle(); 56 base::MessageLoop::current()->RunUntilIdle();
57 EXPECT_FALSE(theme_service->UsingDefaultTheme()); 57 EXPECT_FALSE(theme_service->UsingDefaultTheme());
58 EXPECT_EQ(extension->id(), theme_service->GetThemeID()); 58 EXPECT_EQ(extension->id(), theme_service->GetThemeID());
59 59
60 // Now unload the extension, should revert to the default theme. 60 // Now unload the extension, should revert to the default theme.
61 service_->UnloadExtension(extension->id(), 61 service_->UnloadExtension(extension->id(),
62 extension_misc::UNLOAD_REASON_UNINSTALL); 62 extension_misc::UNLOAD_REASON_UNINSTALL);
63 EXPECT_TRUE(theme_service->UsingDefaultTheme()); 63 EXPECT_TRUE(theme_service->UsingDefaultTheme());
64 } 64 }
65 65
66 // Upgrades a theme and ensures that the ThemeService does not revert to the 66 // Upgrades a theme and ensures that the ThemeService does not revert to the
67 // default theme. 67 // default theme.
68 TEST_F(ThemeServiceTest, ThemeUpgrade) { 68 TEST_F(ThemeServiceTest, ThemeUpgrade) {
69 base::ScopedTempDir temp_dir; 69 base::ScopedTempDir temp_dir;
70 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 70 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
71 ThemeService* theme_service = 71 ThemeService* theme_service =
72 ThemeServiceFactory::GetForProfile(profile_.get()); 72 ThemeServiceFactory::GetForProfile(profile_.get());
73 theme_service->UseDefaultTheme(); 73 theme_service->UseDefaultTheme();
74 scoped_refptr<extensions::Extension> extension = 74 scoped_refptr<extensions::Extension> extension =
75 MakeThemeExtension(temp_dir.path()); 75 MakeThemeExtension(temp_dir.path());
76 service_->FinishInstallationForTest(extension); 76 service_->FinishInstallationForTest(extension);
77 // Let ThemeService finish creating the theme pack. 77 // Let ThemeService finish creating the theme pack.
78 MessageLoop::current()->RunUntilIdle(); 78 base::MessageLoop::current()->RunUntilIdle();
79 EXPECT_FALSE(theme_service->UsingDefaultTheme()); 79 EXPECT_FALSE(theme_service->UsingDefaultTheme());
80 EXPECT_EQ(extension->id(), theme_service->GetThemeID()); 80 EXPECT_EQ(extension->id(), theme_service->GetThemeID());
81 81
82 // Now unload the extension, should revert to the default theme. 82 // Now unload the extension, should revert to the default theme.
83 service_->UnloadExtension(extension->id(), 83 service_->UnloadExtension(extension->id(),
84 extension_misc::UNLOAD_REASON_UPDATE); 84 extension_misc::UNLOAD_REASON_UPDATE);
85 EXPECT_FALSE(theme_service->UsingDefaultTheme()); 85 EXPECT_FALSE(theme_service->UsingDefaultTheme());
86 } 86 }
87 87
88 }; // namespace 88 }; // namespace
OLDNEW
« no previous file with comments | « chrome/browser/themes/browser_theme_pack_unittest.cc ('k') | chrome/browser/themes/theme_syncable_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698