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

Side by Side Diff: chrome/browser/sync/profile_sync_service_unittest.cc

Issue 629603002: replace OVERRIDE and FINAL with override and final in chrome/browser/[r-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 namespace { 45 namespace {
46 46
47 class FakeDataTypeManager : public sync_driver::DataTypeManager { 47 class FakeDataTypeManager : public sync_driver::DataTypeManager {
48 public: 48 public:
49 explicit FakeDataTypeManager(sync_driver::DataTypeManagerObserver* observer) 49 explicit FakeDataTypeManager(sync_driver::DataTypeManagerObserver* observer)
50 : observer_(observer) {} 50 : observer_(observer) {}
51 virtual ~FakeDataTypeManager() {}; 51 virtual ~FakeDataTypeManager() {};
52 52
53 virtual void Configure(syncer::ModelTypeSet desired_types, 53 virtual void Configure(syncer::ModelTypeSet desired_types,
54 syncer::ConfigureReason reason) OVERRIDE { 54 syncer::ConfigureReason reason) override {
55 sync_driver::DataTypeManager::ConfigureResult result; 55 sync_driver::DataTypeManager::ConfigureResult result;
56 result.status = sync_driver::DataTypeManager::OK; 56 result.status = sync_driver::DataTypeManager::OK;
57 observer_->OnConfigureDone(result); 57 observer_->OnConfigureDone(result);
58 } 58 }
59 59
60 virtual void ReenableType(syncer::ModelType type) OVERRIDE {} 60 virtual void ReenableType(syncer::ModelType type) override {}
61 virtual void ResetDataTypeErrors() OVERRIDE {} 61 virtual void ResetDataTypeErrors() override {}
62 virtual void PurgeForMigration(syncer::ModelTypeSet undesired_types, 62 virtual void PurgeForMigration(syncer::ModelTypeSet undesired_types,
63 syncer::ConfigureReason reason) OVERRIDE {} 63 syncer::ConfigureReason reason) override {}
64 virtual void Stop() OVERRIDE {}; 64 virtual void Stop() override {};
65 virtual State state() const OVERRIDE { 65 virtual State state() const override {
66 return sync_driver::DataTypeManager::CONFIGURED; 66 return sync_driver::DataTypeManager::CONFIGURED;
67 }; 67 };
68 68
69 private: 69 private:
70 sync_driver::DataTypeManagerObserver* observer_; 70 sync_driver::DataTypeManagerObserver* observer_;
71 }; 71 };
72 72
73 ACTION(ReturnNewDataTypeManager) { 73 ACTION(ReturnNewDataTypeManager) {
74 return new FakeDataTypeManager(arg4); 74 return new FakeDataTypeManager(arg4);
75 } 75 }
76 76
77 using testing::Return; 77 using testing::Return;
78 using testing::StrictMock; 78 using testing::StrictMock;
79 using testing::_; 79 using testing::_;
80 80
81 class TestProfileSyncServiceObserver : public ProfileSyncServiceObserver { 81 class TestProfileSyncServiceObserver : public ProfileSyncServiceObserver {
82 public: 82 public:
83 explicit TestProfileSyncServiceObserver(ProfileSyncService* service) 83 explicit TestProfileSyncServiceObserver(ProfileSyncService* service)
84 : service_(service), first_setup_in_progress_(false) {} 84 : service_(service), first_setup_in_progress_(false) {}
85 virtual void OnStateChanged() OVERRIDE { 85 virtual void OnStateChanged() override {
86 first_setup_in_progress_ = service_->FirstSetupInProgress(); 86 first_setup_in_progress_ = service_->FirstSetupInProgress();
87 } 87 }
88 bool first_setup_in_progress() const { return first_setup_in_progress_; } 88 bool first_setup_in_progress() const { return first_setup_in_progress_; }
89 private: 89 private:
90 ProfileSyncService* service_; 90 ProfileSyncService* service_;
91 bool first_setup_in_progress_; 91 bool first_setup_in_progress_;
92 }; 92 };
93 93
94 // A variant of the SyncBackendHostMock that won't automatically 94 // A variant of the SyncBackendHostMock that won't automatically
95 // call back when asked to initialized. Allows us to test things 95 // call back when asked to initialized. Allows us to test things
96 // that could happen while backend init is in progress. 96 // that could happen while backend init is in progress.
97 class SyncBackendHostNoReturn : public SyncBackendHostMock { 97 class SyncBackendHostNoReturn : public SyncBackendHostMock {
98 virtual void Initialize( 98 virtual void Initialize(
99 sync_driver::SyncFrontend* frontend, 99 sync_driver::SyncFrontend* frontend,
100 scoped_ptr<base::Thread> sync_thread, 100 scoped_ptr<base::Thread> sync_thread,
101 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, 101 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
102 const GURL& service_url, 102 const GURL& service_url,
103 const syncer::SyncCredentials& credentials, 103 const syncer::SyncCredentials& credentials,
104 bool delete_sync_data_folder, 104 bool delete_sync_data_folder,
105 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, 105 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory,
106 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, 106 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler,
107 syncer::ReportUnrecoverableErrorFunction 107 syncer::ReportUnrecoverableErrorFunction
108 report_unrecoverable_error_function, 108 report_unrecoverable_error_function,
109 syncer::NetworkResources* network_resources) OVERRIDE {} 109 syncer::NetworkResources* network_resources) override {}
110 }; 110 };
111 111
112 class SyncBackendHostMockCollectDeleteDirParam : public SyncBackendHostMock { 112 class SyncBackendHostMockCollectDeleteDirParam : public SyncBackendHostMock {
113 public: 113 public:
114 explicit SyncBackendHostMockCollectDeleteDirParam( 114 explicit SyncBackendHostMockCollectDeleteDirParam(
115 std::vector<bool>* delete_dir_param) 115 std::vector<bool>* delete_dir_param)
116 : delete_dir_param_(delete_dir_param) {} 116 : delete_dir_param_(delete_dir_param) {}
117 117
118 virtual void Initialize( 118 virtual void Initialize(
119 sync_driver::SyncFrontend* frontend, 119 sync_driver::SyncFrontend* frontend,
120 scoped_ptr<base::Thread> sync_thread, 120 scoped_ptr<base::Thread> sync_thread,
121 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, 121 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
122 const GURL& service_url, 122 const GURL& service_url,
123 const syncer::SyncCredentials& credentials, 123 const syncer::SyncCredentials& credentials,
124 bool delete_sync_data_folder, 124 bool delete_sync_data_folder,
125 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, 125 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory,
126 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, 126 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler,
127 syncer::ReportUnrecoverableErrorFunction 127 syncer::ReportUnrecoverableErrorFunction
128 report_unrecoverable_error_function, 128 report_unrecoverable_error_function,
129 syncer::NetworkResources* network_resources) OVERRIDE { 129 syncer::NetworkResources* network_resources) override {
130 delete_dir_param_->push_back(delete_sync_data_folder); 130 delete_dir_param_->push_back(delete_sync_data_folder);
131 SyncBackendHostMock::Initialize(frontend, sync_thread.Pass(), 131 SyncBackendHostMock::Initialize(frontend, sync_thread.Pass(),
132 event_handler, service_url, credentials, 132 event_handler, service_url, credentials,
133 delete_sync_data_folder, 133 delete_sync_data_folder,
134 sync_manager_factory.Pass(), 134 sync_manager_factory.Pass(),
135 unrecoverable_error_handler.Pass(), 135 unrecoverable_error_handler.Pass(),
136 report_unrecoverable_error_function, 136 report_unrecoverable_error_function,
137 network_resources); 137 network_resources);
138 } 138 }
139 139
(...skipping 26 matching lines...) Expand all
166 // 166 //
167 // This is useful if we want to test the ProfileSyncService and don't care about 167 // This is useful if we want to test the ProfileSyncService and don't care about
168 // testing the SyncBackendHost. 168 // testing the SyncBackendHost.
169 class ProfileSyncServiceTest : public ::testing::Test { 169 class ProfileSyncServiceTest : public ::testing::Test {
170 protected: 170 protected:
171 ProfileSyncServiceTest() 171 ProfileSyncServiceTest()
172 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), 172 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
173 profile_manager_(TestingBrowserProcess::GetGlobal()) {} 173 profile_manager_(TestingBrowserProcess::GetGlobal()) {}
174 virtual ~ProfileSyncServiceTest() {} 174 virtual ~ProfileSyncServiceTest() {}
175 175
176 virtual void SetUp() OVERRIDE { 176 virtual void SetUp() override {
177 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 177 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
178 switches::kSyncDeferredStartupTimeoutSeconds, "0"); 178 switches::kSyncDeferredStartupTimeoutSeconds, "0");
179 179
180 CHECK(profile_manager_.SetUp()); 180 CHECK(profile_manager_.SetUp());
181 181
182 TestingProfile::TestingFactories testing_facotries; 182 TestingProfile::TestingFactories testing_facotries;
183 testing_facotries.push_back( 183 testing_facotries.push_back(
184 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), 184 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(),
185 BuildAutoIssuingFakeProfileOAuth2TokenService)); 185 BuildAutoIssuingFakeProfileOAuth2TokenService));
186 testing_facotries.push_back( 186 testing_facotries.push_back(
187 std::make_pair( 187 std::make_pair(
188 invalidation::ProfileInvalidationProviderFactory::GetInstance(), 188 invalidation::ProfileInvalidationProviderFactory::GetInstance(),
189 BuildFakeProfileInvalidationProvider)); 189 BuildFakeProfileInvalidationProvider));
190 190
191 profile_ = profile_manager_.CreateTestingProfile( 191 profile_ = profile_manager_.CreateTestingProfile(
192 "sync-service-test", scoped_ptr<PrefServiceSyncable>(), 192 "sync-service-test", scoped_ptr<PrefServiceSyncable>(),
193 base::UTF8ToUTF16("sync-service-test"), 0, std::string(), 193 base::UTF8ToUTF16("sync-service-test"), 0, std::string(),
194 testing_facotries); 194 testing_facotries);
195 } 195 }
196 196
197 virtual void TearDown() OVERRIDE { 197 virtual void TearDown() override {
198 // Kill the service before the profile. 198 // Kill the service before the profile.
199 if (service_) 199 if (service_)
200 service_->Shutdown(); 200 service_->Shutdown();
201 201
202 service_.reset(); 202 service_.reset();
203 } 203 }
204 204
205 void IssueTestTokens() { 205 void IssueTestTokens() {
206 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_) 206 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)
207 ->UpdateCredentials("test", "oauth2_login_token"); 207 ->UpdateCredentials("test", "oauth2_login_token");
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 // See that we can override the URL with a flag. 613 // See that we can override the URL with a flag.
614 CommandLine command_line( 614 CommandLine command_line(
615 base::FilePath(base::FilePath(FILE_PATH_LITERAL("chrome.exe")))); 615 base::FilePath(base::FilePath(FILE_PATH_LITERAL("chrome.exe"))));
616 command_line.AppendSwitchASCII(switches::kSyncServiceURL, "https://foo/bar"); 616 command_line.AppendSwitchASCII(switches::kSyncServiceURL, "https://foo/bar");
617 EXPECT_EQ("https://foo/bar", 617 EXPECT_EQ("https://foo/bar",
618 ProfileSyncService::GetSyncServiceURL(command_line).spec()); 618 ProfileSyncService::GetSyncServiceURL(command_line).spec());
619 } 619 }
620 620
621 } // namespace 621 } // namespace
622 } // namespace browser_sync 622 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698