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

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

Issue 535683002: Fix use-after-free in HDDDTC shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 6 years, 3 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 PurgeForMigration(syncer::ModelTypeSet undesired_types, 62 virtual void PurgeForMigration(syncer::ModelTypeSet undesired_types,
62 syncer::ConfigureReason reason) OVERRIDE {} 63 syncer::ConfigureReason reason) OVERRIDE {}
63 virtual void Stop() OVERRIDE {}; 64 virtual void Stop() OVERRIDE {};
64 virtual State state() const OVERRIDE { 65 virtual State state() const OVERRIDE {
65 return sync_driver::DataTypeManager::CONFIGURED; 66 return sync_driver::DataTypeManager::CONFIGURED;
66 }; 67 };
67 68
68 private: 69 private:
69 sync_driver::DataTypeManagerObserver* observer_; 70 sync_driver::DataTypeManagerObserver* observer_;
70 }; 71 };
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 sync_driver::SyncPrefs sync_prefs(service()->profile()->GetPrefs()); 245 sync_driver::SyncPrefs sync_prefs(service()->profile()->GetPrefs());
245 sync_prefs.SetFirstSyncTime(base::Time::Now()); 246 sync_prefs.SetFirstSyncTime(base::Time::Now());
246 service_->Initialize(); 247 service_->Initialize();
247 } 248 }
248 249
249 void InitializeForFirstSync() { 250 void InitializeForFirstSync() {
250 service_->Initialize(); 251 service_->Initialize();
251 } 252 }
252 253
253 void ExpectDataTypeManagerCreation(int times) { 254 void ExpectDataTypeManagerCreation(int times) {
254 EXPECT_CALL(*components_factory_, CreateDataTypeManager(_, _, _, _, _, _)) 255 EXPECT_CALL(*components_factory_, CreateDataTypeManager(_, _, _, _, _))
255 .Times(times) 256 .Times(times)
256 .WillRepeatedly(ReturnNewDataTypeManager()); 257 .WillRepeatedly(ReturnNewDataTypeManager());
257 } 258 }
258 259
259 void ExpectSyncBackendHostCreation(int times) { 260 void ExpectSyncBackendHostCreation(int times) {
260 EXPECT_CALL(*components_factory_, CreateSyncBackendHost(_, _, _, _, _)) 261 EXPECT_CALL(*components_factory_, CreateSyncBackendHost(_, _, _, _, _))
261 .Times(times) 262 .Times(times)
262 .WillRepeatedly(ReturnNewSyncBackendHostMock()); 263 .WillRepeatedly(ReturnNewSyncBackendHostMock());
263 } 264 }
264 265
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 // See that we can override the URL with a flag. 611 // See that we can override the URL with a flag.
611 CommandLine command_line( 612 CommandLine command_line(
612 base::FilePath(base::FilePath(FILE_PATH_LITERAL("chrome.exe")))); 613 base::FilePath(base::FilePath(FILE_PATH_LITERAL("chrome.exe"))));
613 command_line.AppendSwitchASCII(switches::kSyncServiceURL, "https://foo/bar"); 614 command_line.AppendSwitchASCII(switches::kSyncServiceURL, "https://foo/bar");
614 EXPECT_EQ("https://foo/bar", 615 EXPECT_EQ("https://foo/bar",
615 ProfileSyncService::GetSyncServiceURL(command_line).spec()); 616 ProfileSyncService::GetSyncServiceURL(command_line).spec());
616 } 617 }
617 618
618 } // namespace 619 } // namespace
619 } // namespace browser_sync 620 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698