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

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

Issue 648653003: Standardize usage of virtual/override/final in chrome/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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_syncable_service.h" 5 #include "chrome/browser/themes/theme_syncable_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 class FakeThemeService : public ThemeService { 55 class FakeThemeService : public ThemeService {
56 public: 56 public:
57 FakeThemeService() : 57 FakeThemeService() :
58 using_system_theme_(false), 58 using_system_theme_(false),
59 using_default_theme_(false), 59 using_default_theme_(false),
60 theme_extension_(NULL), 60 theme_extension_(NULL),
61 is_dirty_(false) {} 61 is_dirty_(false) {}
62 62
63 // ThemeService implementation 63 // ThemeService implementation
64 virtual void SetTheme(const extensions::Extension* extension) override { 64 void SetTheme(const extensions::Extension* extension) override {
65 is_dirty_ = true; 65 is_dirty_ = true;
66 theme_extension_ = extension; 66 theme_extension_ = extension;
67 using_system_theme_ = false; 67 using_system_theme_ = false;
68 using_default_theme_ = false; 68 using_default_theme_ = false;
69 } 69 }
70 70
71 virtual void UseDefaultTheme() override { 71 void UseDefaultTheme() override {
72 is_dirty_ = true; 72 is_dirty_ = true;
73 using_default_theme_ = true; 73 using_default_theme_ = true;
74 using_system_theme_ = false; 74 using_system_theme_ = false;
75 theme_extension_ = NULL; 75 theme_extension_ = NULL;
76 } 76 }
77 77
78 virtual void UseSystemTheme() override { 78 void UseSystemTheme() override {
79 is_dirty_ = true; 79 is_dirty_ = true;
80 using_system_theme_ = true; 80 using_system_theme_ = true;
81 using_default_theme_ = false; 81 using_default_theme_ = false;
82 theme_extension_ = NULL; 82 theme_extension_ = NULL;
83 } 83 }
84 84
85 virtual bool UsingDefaultTheme() const override { 85 bool UsingDefaultTheme() const override { return using_default_theme_; }
86 return using_default_theme_;
87 }
88 86
89 virtual bool UsingSystemTheme() const override { 87 bool UsingSystemTheme() const override { return using_system_theme_; }
90 return using_system_theme_;
91 }
92 88
93 virtual string GetThemeID() const override { 89 string GetThemeID() const override {
94 if (theme_extension_.get()) 90 if (theme_extension_.get())
95 return theme_extension_->id(); 91 return theme_extension_->id();
96 else 92 else
97 return std::string(); 93 return std::string();
98 } 94 }
99 95
100 const extensions::Extension* theme_extension() const { 96 const extensions::Extension* theme_extension() const {
101 return theme_extension_.get(); 97 return theme_extension_.get();
102 } 98 }
103 99
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 #endif 225 #endif
230 226
231 scoped_ptr<TestingProfile> profile_; 227 scoped_ptr<TestingProfile> profile_;
232 FakeThemeService* fake_theme_service_; 228 FakeThemeService* fake_theme_service_;
233 scoped_refptr<extensions::Extension> theme_extension_; 229 scoped_refptr<extensions::Extension> theme_extension_;
234 scoped_ptr<ThemeSyncableService> theme_sync_service_; 230 scoped_ptr<ThemeSyncableService> theme_sync_service_;
235 scoped_ptr<syncer::FakeSyncChangeProcessor> fake_change_processor_; 231 scoped_ptr<syncer::FakeSyncChangeProcessor> fake_change_processor_;
236 }; 232 };
237 233
238 class PolicyInstalledThemeTest : public ThemeSyncableServiceTest { 234 class PolicyInstalledThemeTest : public ThemeSyncableServiceTest {
239 virtual extensions::Manifest::Location GetThemeLocation() override { 235 extensions::Manifest::Location GetThemeLocation() override {
240 return extensions::Manifest::EXTERNAL_POLICY_DOWNLOAD; 236 return extensions::Manifest::EXTERNAL_POLICY_DOWNLOAD;
241 } 237 }
242 }; 238 };
243 239
244 TEST_F(ThemeSyncableServiceTest, AreThemeSpecificsEqual) { 240 TEST_F(ThemeSyncableServiceTest, AreThemeSpecificsEqual) {
245 sync_pb::ThemeSpecifics a, b; 241 sync_pb::ThemeSpecifics a, b;
246 EXPECT_TRUE(ThemeSyncableService::AreThemeSpecificsEqual(a, b, false)); 242 EXPECT_TRUE(ThemeSyncableService::AreThemeSpecificsEqual(a, b, false));
247 EXPECT_TRUE(ThemeSyncableService::AreThemeSpecificsEqual(a, b, true)); 243 EXPECT_TRUE(ThemeSyncableService::AreThemeSpecificsEqual(a, b, true));
248 244
249 // Custom vs. non-custom. 245 // Custom vs. non-custom.
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 649
654 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) { 650 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) {
655 // Set up theme service to use custom theme that was installed by policy. 651 // Set up theme service to use custom theme that was installed by policy.
656 fake_theme_service_->SetTheme(theme_extension_.get()); 652 fake_theme_service_->SetTheme(theme_extension_.get());
657 653
658 syncer::SyncDataList data_list = 654 syncer::SyncDataList data_list =
659 theme_sync_service_->GetAllSyncData(syncer::THEMES); 655 theme_sync_service_->GetAllSyncData(syncer::THEMES);
660 656
661 ASSERT_EQ(0u, data_list.size()); 657 ASSERT_EQ(0u, data_list.size());
662 } 658 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_syncable_service.h ('k') | chrome/browser/thumbnails/content_based_thumbnailing_algorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698