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

Unified Diff: chrome/browser/sync/glue/data_type_manager_impl_unittest.cc

Issue 10834351: [sync] Divorce DataTypeManager from NotificationService notifications by creating a new DataTypeMa… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/data_type_manager_impl_unittest.cc
diff --git a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc
index 2044e5ef3109fee604e8e52dc0ba1dd07fafbfce..f00f5fe243f4112f5d01335d00d89ba51e5817a7 100644
--- a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc
+++ b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc
@@ -84,12 +84,6 @@ class SyncDataTypeManagerImplTest
protected:
virtual void SetUp() {
- registrar_.Add(&observer_,
- chrome::NOTIFICATION_SYNC_CONFIGURE_START,
- content::NotificationService::AllSources());
- registrar_.Add(&observer_,
- chrome::NOTIFICATION_SYNC_CONFIGURE_DONE,
- content::NotificationService::AllSources());
}
// A clearer name for the param accessor.
@@ -97,20 +91,6 @@ class SyncDataTypeManagerImplTest
return GetParam();
}
- void SetConfigureStartExpectation() {
- EXPECT_CALL(
- observer_,
- Observe(int(chrome::NOTIFICATION_SYNC_CONFIGURE_START),
- _, _));
- }
-
- void SetConfigureDoneExpectation(DataTypeManager::ConfigureStatus status) {
- EXPECT_CALL(
- observer_,
- Observe(int(chrome::NOTIFICATION_SYNC_CONFIGURE_DONE), _,
- ResultOf(&GetStatus, status)));
- }
-
// Configure the given DTM with the given desired types.
void Configure(DataTypeManagerImpl* dtm,
const DataTypeManager::TypeSet& desired_types) {
@@ -155,16 +135,12 @@ class SyncDataTypeManagerImplTest
content::TestBrowserThread ui_thread_;
DataTypeController::TypeMap controllers_;
FakeBackendDataTypeConfigurer configurer_;
- content::MockNotificationObserver observer_;
- content::NotificationRegistrar registrar_;
};
// Set up a DTM with no controllers, configure it, finish downloading,
// and then stop it.
TEST_P(SyncDataTypeManagerImplTest, NoControllers) {
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::OK);
Configure(&dtm, ModelTypeSet());
EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm.state());
@@ -182,8 +158,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureOne) {
AddController(BOOKMARKS);
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::OK);
Configure(&dtm, ModelTypeSet(BOOKMARKS));
EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm.state());
@@ -207,8 +181,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureSlowLoadingType) {
GetController(BOOKMARKS)->SetDelayModelLoad();
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS);
syncer::ModelTypeSet types;
types.Put(BOOKMARKS);
@@ -227,10 +199,8 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureSlowLoadingType) {
timer->Stop();
task.Run();
- SetConfigureDoneExpectation(DataTypeManager::OK);
GetController(APPS)->FinishStart(DataTypeController::OK);
- SetConfigureStartExpectation();
GetController(BOOKMARKS)->SimulateModelLoadFinishing();
FinishDownload(dtm, ModelTypeSet());
@@ -252,8 +222,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureOneStopWhileDownloadPending) {
{
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::ABORTED);
Configure(&dtm, ModelTypeSet(BOOKMARKS));
EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm.state());
@@ -274,8 +242,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureOneStopWhileStartingModel) {
{
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::ABORTED);
Configure(&dtm, ModelTypeSet(BOOKMARKS));
EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm.state());
@@ -299,8 +265,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureOneStopWhileAssociating) {
AddController(BOOKMARKS);
{
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::ABORTED);
Configure(&dtm, ModelTypeSet(BOOKMARKS));
EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm.state());
@@ -328,7 +292,6 @@ TEST_P(SyncDataTypeManagerImplTest, OneWaitingForCrypto) {
AddController(PASSWORDS);
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
const ModelTypeSet types(PASSWORDS);
@@ -344,9 +307,6 @@ TEST_P(SyncDataTypeManagerImplTest, OneWaitingForCrypto) {
GetController(PASSWORDS)->FinishStart(DataTypeController::NEEDS_CRYPTO);
EXPECT_EQ(DataTypeManager::BLOCKED, dtm.state());
- Mock::VerifyAndClearExpectations(&observer_);
- SetConfigureDoneExpectation(DataTypeManager::OK);
-
// Step 4.
Configure(&dtm, types);
EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm.state());
@@ -378,8 +338,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureOneThenBoth) {
AddController(PREFERENCES);
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::OK);
// Step 1.
Configure(&dtm, ModelTypeSet(BOOKMARKS));
@@ -393,10 +351,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureOneThenBoth) {
GetController(BOOKMARKS)->FinishStart(DataTypeController::OK);
EXPECT_EQ(DataTypeManager::CONFIGURED, dtm.state());
- Mock::VerifyAndClearExpectations(&observer_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::OK);
-
// Step 4.
Configure(&dtm, ModelTypeSet(BOOKMARKS, PREFERENCES));
EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm.state());
@@ -428,8 +382,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureOneThenSwitch) {
AddController(PREFERENCES);
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::OK);
// Step 1.
Configure(&dtm, ModelTypeSet(BOOKMARKS));
@@ -443,10 +395,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureOneThenSwitch) {
GetController(BOOKMARKS)->FinishStart(DataTypeController::OK);
EXPECT_EQ(DataTypeManager::CONFIGURED, dtm.state());
- Mock::VerifyAndClearExpectations(&observer_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::OK);
-
// Step 4.
Configure(&dtm, ModelTypeSet(PREFERENCES));
EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm.state());
@@ -478,8 +426,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureWhileOneInFlight) {
AddController(PREFERENCES);
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::OK);
// Step 1.
Configure(&dtm, ModelTypeSet(BOOKMARKS));
@@ -522,8 +468,6 @@ TEST_P(SyncDataTypeManagerImplTest, OneFailingController) {
AddController(BOOKMARKS);
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::UNRECOVERABLE_ERROR);
Configure(&dtm, ModelTypeSet(BOOKMARKS));
EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm.state());
@@ -549,8 +493,6 @@ TEST_P(SyncDataTypeManagerImplTest, SecondControllerFails) {
AddController(PREFERENCES);
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::UNRECOVERABLE_ERROR);
// Step 1.
Configure(&dtm, ModelTypeSet(BOOKMARKS, PREFERENCES));
@@ -587,8 +529,6 @@ TEST_P(SyncDataTypeManagerImplTest, OneControllerFailsAssociation) {
AddController(PREFERENCES);
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::PARTIAL_SUCCESS);
// Step 1.
Configure(&dtm, ModelTypeSet(BOOKMARKS, PREFERENCES));
@@ -625,8 +565,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureWhileDownloadPending) {
AddController(PREFERENCES);
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::OK);
// Step 1.
Configure(&dtm, ModelTypeSet(BOOKMARKS));
@@ -676,8 +614,6 @@ TEST_P(SyncDataTypeManagerImplTest, ConfigureWhileDownloadPendingWithFailure) {
AddController(PREFERENCES);
DataTypeManagerImpl dtm(&configurer_, &controllers_);
- SetConfigureStartExpectation();
- SetConfigureDoneExpectation(DataTypeManager::OK);
// Step 1.
Configure(&dtm, ModelTypeSet(BOOKMARKS));

Powered by Google App Engine
This is Rietveld 408576698