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

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

Issue 59793008: sync: don't allow NULL profile in ProfileSyncService and friends (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 7 years, 1 month 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/sync/backend_migrator.h" 5 #include "chrome/browser/sync/backend_migrator.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/tracked_objects.h" 8 #include "base/tracked_objects.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/sync/glue/data_type_manager_mock.h" 10 #include "chrome/browser/sync/glue/data_type_manager_mock.h"
(...skipping 11 matching lines...) Expand all
22 using ::testing::Mock; 22 using ::testing::Mock;
23 using ::testing::NiceMock; 23 using ::testing::NiceMock;
24 using ::testing::Return; 24 using ::testing::Return;
25 25
26 namespace browser_sync { 26 namespace browser_sync {
27 27
28 using syncer::sessions::SyncSessionSnapshot; 28 using syncer::sessions::SyncSessionSnapshot;
29 29
30 class SyncBackendMigratorTest : public testing::Test { 30 class SyncBackendMigratorTest : public testing::Test {
31 public: 31 public:
32 SyncBackendMigratorTest() { } 32 SyncBackendMigratorTest() : service_(&profile_) { }
33 virtual ~SyncBackendMigratorTest() { } 33 virtual ~SyncBackendMigratorTest() { }
34 34
35 virtual void SetUp() { 35 virtual void SetUp() {
36 test_user_share_.SetUp(); 36 test_user_share_.SetUp();
37 Mock::VerifyAndClear(manager()); 37 Mock::VerifyAndClear(manager());
38 Mock::VerifyAndClear(&service_); 38 Mock::VerifyAndClear(&service_);
39 preferred_types_.Put(syncer::BOOKMARKS); 39 preferred_types_.Put(syncer::BOOKMARKS);
40 preferred_types_.Put(syncer::PREFERENCES); 40 preferred_types_.Put(syncer::PREFERENCES);
41 preferred_types_.Put(syncer::AUTOFILL); 41 preferred_types_.Put(syncer::AUTOFILL);
42 42
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 preferred_types_.Remove(type); 97 preferred_types_.Remove(type);
98 Mock::VerifyAndClear(&service_); 98 Mock::VerifyAndClear(&service_);
99 ON_CALL(service_, GetPreferredDataTypes()). 99 ON_CALL(service_, GetPreferredDataTypes()).
100 WillByDefault(Return(preferred_types_)); 100 WillByDefault(Return(preferred_types_));
101 } 101 }
102 102
103 private: 103 private:
104 scoped_ptr<SyncSessionSnapshot> snap_; 104 scoped_ptr<SyncSessionSnapshot> snap_;
105 base::MessageLoop message_loop_; 105 base::MessageLoop message_loop_;
106 syncer::ModelTypeSet preferred_types_; 106 syncer::ModelTypeSet preferred_types_;
107 TestingProfile profile_;
107 NiceMock<ProfileSyncServiceMock> service_; 108 NiceMock<ProfileSyncServiceMock> service_;
108 NiceMock<DataTypeManagerMock> manager_; 109 NiceMock<DataTypeManagerMock> manager_;
109 syncer::TestUserShare test_user_share_; 110 syncer::TestUserShare test_user_share_;
110 scoped_ptr<BackendMigrator> migrator_; 111 scoped_ptr<BackendMigrator> migrator_;
111 }; 112 };
112 113
113 class MockMigrationObserver : public MigrationObserver { 114 class MockMigrationObserver : public MigrationObserver {
114 public: 115 public:
115 virtual ~MockMigrationObserver() {} 116 virtual ~MockMigrationObserver() {}
116 117
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 EXPECT_CALL( 333 EXPECT_CALL(
333 *manager(), 334 *manager(),
334 PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)).Times(1); 335 PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)).Times(1);
335 migrator()->MigrateTypes(to_migrate); 336 migrator()->MigrateTypes(to_migrate);
336 SetUnsyncedTypes(syncer::ModelTypeSet()); 337 SetUnsyncedTypes(syncer::ModelTypeSet());
337 SendConfigureDone(DataTypeManager::ABORTED, syncer::ModelTypeSet()); 338 SendConfigureDone(DataTypeManager::ABORTED, syncer::ModelTypeSet());
338 EXPECT_EQ(BackendMigrator::IDLE, migrator()->state()); 339 EXPECT_EQ(BackendMigrator::IDLE, migrator()->state());
339 } 340 }
340 341
341 }; // namespace browser_sync 342 }; // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/invalidation/invalidator_storage.cc ('k') | chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698