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

Side by Side Diff: chrome/browser/sync/glue/shared_change_processor_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/glue/shared_change_processor.h" 5 #include "chrome/browser/sync/glue/shared_change_processor.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 19 matching lines...) Expand all
30 ACTION_P(GetWeakPtrToSyncableService, syncable_service) { 30 ACTION_P(GetWeakPtrToSyncableService, syncable_service) {
31 // Have to do this within an Action to ensure it's not evaluated on the wrong 31 // Have to do this within an Action to ensure it's not evaluated on the wrong
32 // thread. 32 // thread.
33 return syncable_service->AsWeakPtr(); 33 return syncable_service->AsWeakPtr();
34 } 34 }
35 35
36 class SyncSharedChangeProcessorTest : public testing::Test { 36 class SyncSharedChangeProcessorTest : public testing::Test {
37 public: 37 public:
38 SyncSharedChangeProcessorTest() 38 SyncSharedChangeProcessorTest()
39 : ui_thread_(BrowserThread::UI, &ui_loop_), 39 : ui_thread_(BrowserThread::UI, &ui_loop_),
40 db_thread_(BrowserThread::DB) {} 40 db_thread_(BrowserThread::DB),
41 sync_service_(&profile_) {}
41 42
42 virtual ~SyncSharedChangeProcessorTest() { 43 virtual ~SyncSharedChangeProcessorTest() {
43 EXPECT_FALSE(db_syncable_service_.get()); 44 EXPECT_FALSE(db_syncable_service_.get());
44 } 45 }
45 46
46 protected: 47 protected:
47 virtual void SetUp() OVERRIDE { 48 virtual void SetUp() OVERRIDE {
48 shared_change_processor_ = new SharedChangeProcessor(); 49 shared_change_processor_ = new SharedChangeProcessor();
49 db_thread_.Start(); 50 db_thread_.Start();
50 EXPECT_TRUE(BrowserThread::PostTask( 51 EXPECT_TRUE(BrowserThread::PostTask(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 syncer::AUTOFILL, 111 syncer::AUTOFILL,
111 base::WeakPtr<syncer::SyncMergeResult>())); 112 base::WeakPtr<syncer::SyncMergeResult>()));
112 } 113 }
113 114
114 base::MessageLoopForUI ui_loop_; 115 base::MessageLoopForUI ui_loop_;
115 content::TestBrowserThread ui_thread_; 116 content::TestBrowserThread ui_thread_;
116 content::TestBrowserThread db_thread_; 117 content::TestBrowserThread db_thread_;
117 118
118 scoped_refptr<SharedChangeProcessor> shared_change_processor_; 119 scoped_refptr<SharedChangeProcessor> shared_change_processor_;
119 NiceMock<ProfileSyncComponentsFactoryMock> sync_factory_; 120 NiceMock<ProfileSyncComponentsFactoryMock> sync_factory_;
121 TestingProfile profile_;
120 NiceMock<ProfileSyncServiceMock> sync_service_; 122 NiceMock<ProfileSyncServiceMock> sync_service_;
121 StrictMock<DataTypeErrorHandlerMock> error_handler_; 123 StrictMock<DataTypeErrorHandlerMock> error_handler_;
122 124
123 // Used only on DB thread. 125 // Used only on DB thread.
124 scoped_ptr<syncer::FakeSyncableService> db_syncable_service_; 126 scoped_ptr<syncer::FakeSyncableService> db_syncable_service_;
125 }; 127 };
126 128
127 // Simply connect the shared change processor. It should succeed, and 129 // Simply connect the shared change processor. It should succeed, and
128 // nothing further should happen. 130 // nothing further should happen.
129 TEST_F(SyncSharedChangeProcessorTest, Basic) { 131 TEST_F(SyncSharedChangeProcessorTest, Basic) {
130 Connect(); 132 Connect();
131 } 133 }
132 134
133 } // namespace 135 } // namespace
134 136
135 } // namespace browser_sync 137 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698