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

Side by Side Diff: chrome/browser/extensions/api/preferences_private/preferences_private_apitest.cc

Issue 624153002: replace OVERRIDE and FINAL with override and final in chrome/browser/extensions/ (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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 return new FakeProfileSyncService(static_cast<Profile*>(context)); 59 return new FakeProfileSyncService(static_cast<Profile*>(context));
60 } 60 }
61 61
62 void set_sync_initialized(bool sync_initialized) { 62 void set_sync_initialized(bool sync_initialized) {
63 sync_initialized_ = sync_initialized; 63 sync_initialized_ = sync_initialized;
64 } 64 }
65 65
66 bool initialized_state_violation() { return initialized_state_violation_; } 66 bool initialized_state_violation() { return initialized_state_violation_; }
67 67
68 // ProfileSyncService: 68 // ProfileSyncService:
69 virtual bool sync_initialized() const OVERRIDE { 69 virtual bool sync_initialized() const override {
70 return sync_initialized_; 70 return sync_initialized_;
71 } 71 }
72 72
73 virtual void AddObserver( 73 virtual void AddObserver(
74 ProfileSyncServiceBase::Observer* observer) OVERRIDE { 74 ProfileSyncServiceBase::Observer* observer) override {
75 if (sync_initialized_) 75 if (sync_initialized_)
76 initialized_state_violation_ = true; 76 initialized_state_violation_ = true;
77 // Set sync initialized state to true so the function will run after 77 // Set sync initialized state to true so the function will run after
78 // OnStateChanged is called. 78 // OnStateChanged is called.
79 sync_initialized_ = true; 79 sync_initialized_ = true;
80 base::MessageLoop::current()->PostTask( 80 base::MessageLoop::current()->PostTask(
81 FROM_HERE, 81 FROM_HERE,
82 base::Bind(&ProfileSyncServiceBase::Observer::OnStateChanged, 82 base::Bind(&ProfileSyncServiceBase::Observer::OnStateChanged,
83 base::Unretained(observer))); 83 base::Unretained(observer)));
84 } 84 }
85 85
86 virtual syncer::ModelTypeSet GetEncryptedDataTypes() const OVERRIDE { 86 virtual syncer::ModelTypeSet GetEncryptedDataTypes() const override {
87 if (!sync_initialized_) 87 if (!sync_initialized_)
88 initialized_state_violation_ = true; 88 initialized_state_violation_ = true;
89 syncer::ModelTypeSet type_set; 89 syncer::ModelTypeSet type_set;
90 type_set.Put(syncer::AUTOFILL); 90 type_set.Put(syncer::AUTOFILL);
91 return type_set; 91 return type_set;
92 } 92 }
93 93
94 virtual syncer::ModelTypeSet GetPreferredDataTypes() const OVERRIDE { 94 virtual syncer::ModelTypeSet GetPreferredDataTypes() const override {
95 if (!sync_initialized_) 95 if (!sync_initialized_)
96 initialized_state_violation_ = true; 96 initialized_state_violation_ = true;
97 syncer::ModelTypeSet preferred_types = 97 syncer::ModelTypeSet preferred_types =
98 syncer::UserSelectableTypes(); 98 syncer::UserSelectableTypes();
99 preferred_types.Remove(syncer::TYPED_URLS); 99 preferred_types.Remove(syncer::TYPED_URLS);
100 return preferred_types; 100 return preferred_types;
101 } 101 }
102 102
103 private: 103 private:
104 bool sync_initialized_; 104 bool sync_initialized_;
105 // Set to true if a function is called when sync_initialized is in an 105 // Set to true if a function is called when sync_initialized is in an
106 // unexpected state. 106 // unexpected state.
107 mutable bool initialized_state_violation_; 107 mutable bool initialized_state_violation_;
108 108
109 DISALLOW_COPY_AND_ASSIGN(FakeProfileSyncService); 109 DISALLOW_COPY_AND_ASSIGN(FakeProfileSyncService);
110 }; 110 };
111 111
112 class PreferencesPrivateApiTest : public ExtensionApiTest { 112 class PreferencesPrivateApiTest : public ExtensionApiTest {
113 public: 113 public:
114 PreferencesPrivateApiTest() : browser_(NULL), service_(NULL) {} 114 PreferencesPrivateApiTest() : browser_(NULL), service_(NULL) {}
115 virtual ~PreferencesPrivateApiTest() {} 115 virtual ~PreferencesPrivateApiTest() {}
116 116
117 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 117 virtual void SetUpCommandLine(CommandLine* command_line) override {
118 #if defined(OS_CHROMEOS) 118 #if defined(OS_CHROMEOS)
119 command_line->AppendSwitch( 119 command_line->AppendSwitch(
120 chromeos::switches::kIgnoreUserProfileMappingForTests); 120 chromeos::switches::kIgnoreUserProfileMappingForTests);
121 #endif 121 #endif
122 } 122 }
123 123
124 virtual void SetUpOnMainThread() OVERRIDE { 124 virtual void SetUpOnMainThread() override {
125 ExtensionApiTest::SetUpOnMainThread(); 125 ExtensionApiTest::SetUpOnMainThread();
126 126
127 base::FilePath path; 127 base::FilePath path;
128 PathService::Get(chrome::DIR_USER_DATA, &path); 128 PathService::Get(chrome::DIR_USER_DATA, &path);
129 path = path.AppendASCII("test_profile"); 129 path = path.AppendASCII("test_profile");
130 if (!base::PathExists(path)) 130 if (!base::PathExists(path))
131 CHECK(base::CreateDirectory(path)); 131 CHECK(base::CreateDirectory(path));
132 132
133 Profile* profile = 133 Profile* profile =
134 Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS); 134 Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 // Verifies that we wait for the sync service to be ready before checking 192 // Verifies that we wait for the sync service to be ready before checking
193 // encryption status. 193 // encryption status.
194 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, 194 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest,
195 GetSyncCategoriesWithoutPassphraseAsynchronous) { 195 GetSyncCategoriesWithoutPassphraseAsynchronous) {
196 service_->set_sync_initialized(false); 196 service_->set_sync_initialized(false);
197 TestGetSyncCategoriesWithoutPassphraseFunction(); 197 TestGetSyncCategoriesWithoutPassphraseFunction();
198 } 198 }
199 199
200 } // namespace 200 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698