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

Unified Diff: chrome/browser/sync/glue/search_engine_data_type_controller_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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc
diff --git a/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc b/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc
index 46854467795b8968f2673df7c8bd897f8d655d19..98b8fd779918f4d6ba7f1e93e94560599837312b 100644
--- a/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc
@@ -39,23 +39,26 @@ ACTION_P(ReturnAndRelease, change_processor) {
class SyncSearchEngineDataTypeControllerTest : public testing::Test {
public:
SyncSearchEngineDataTypeControllerTest()
- : change_processor_(new FakeGenericChangeProcessor()) {}
+ : change_processor_(new FakeGenericChangeProcessor()) {
+ }
virtual void SetUp() {
test_util_.SetUp();
+ service_.reset(new ProfileSyncServiceMock(test_util_.profile()));
profile_sync_factory_.reset(new ProfileSyncComponentsFactoryMock());
// Feed the DTC test_util_'s profile so it is reused later.
// This allows us to control the associated TemplateURLService.
search_engine_dtc_ =
new SearchEngineDataTypeController(profile_sync_factory_.get(),
test_util_.profile(),
- &service_);
+ service_.get());
}
virtual void TearDown() {
// Must be done before we pump the loop.
syncable_service_.StopSyncing(syncer::SEARCH_ENGINES);
search_engine_dtc_ = NULL;
+ service_.reset();
test_util_.TearDown();
}
@@ -79,11 +82,13 @@ class SyncSearchEngineDataTypeControllerTest : public testing::Test {
}
void SetActivateExpectations() {
- EXPECT_CALL(service_, ActivateDataType(syncer::SEARCH_ENGINES, _, _));
+ EXPECT_CALL(*service_.get(),
+ ActivateDataType(syncer::SEARCH_ENGINES, _, _));
}
void SetStopExpectations() {
- EXPECT_CALL(service_, DeactivateDataType(syncer::SEARCH_ENGINES));
+ EXPECT_CALL(*service_.get(),
+ DeactivateDataType(syncer::SEARCH_ENGINES));
}
void Start() {
@@ -101,7 +106,7 @@ class SyncSearchEngineDataTypeControllerTest : public testing::Test {
TemplateURLServiceTestUtil test_util_;
scoped_refptr<SearchEngineDataTypeController> search_engine_dtc_;
scoped_ptr<ProfileSyncComponentsFactoryMock> profile_sync_factory_;
- ProfileSyncServiceMock service_;
+ scoped_ptr<ProfileSyncServiceMock> service_;
scoped_ptr<FakeGenericChangeProcessor> change_processor_;
syncer::FakeSyncableService syncable_service_;
StartCallbackMock start_callback_;
@@ -209,7 +214,7 @@ TEST_F(SyncSearchEngineDataTypeControllerTest,
SetStartExpectations();
PreloadTemplateURLService();
SetActivateExpectations();
- EXPECT_CALL(service_, DisableBrokenDatatype(_, _, _)).
+ EXPECT_CALL(*service_.get(), DisableBrokenDatatype(_, _, _)).
WillOnce(InvokeWithoutArgs(search_engine_dtc_.get(),
&SearchEngineDataTypeController::Stop));
SetStopExpectations();

Powered by Google App Engine
This is Rietveld 408576698