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

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

Issue 8851006: [Sync] Replace all instances of ModelTypeSet with ModelEnumSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 9 years 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/sync_backend_registrar_unittest.cc
diff --git a/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc b/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc
index 7ba8d22fa9ddd75c510210d5c64639c711709026..fd789be7cf88913136927acdff0845b722b02168 100644
--- a/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc
+++ b/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc
@@ -30,9 +30,9 @@ using syncable::THEMES;
using syncable::NIGORI;
using syncable::PASSWORDS;
using syncable::MODEL_TYPE_COUNT;
+using syncable::ModelEnumSet;
using syncable::ModelType;
using syncable::ModelTypeFromInt;
-using syncable::ModelTypeSet;
class SyncBackendRegistrarTest : public testing::Test {
protected:
@@ -56,10 +56,10 @@ class SyncBackendRegistrarTest : public testing::Test {
}
void ExpectHasProcessorsForTypes(const SyncBackendRegistrar& registrar,
- const ModelTypeSet& types) {
+ ModelEnumSet types) {
for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
ModelType model_type = ModelTypeFromInt(i);
- EXPECT_EQ(types.count(model_type) > 0,
+ EXPECT_EQ(types.Has(model_type),
registrar.IsTypeActivatedForTest(model_type));
}
}
@@ -73,7 +73,7 @@ class SyncBackendRegistrarTest : public testing::Test {
TEST_F(SyncBackendRegistrarTest, ConstructorEmpty) {
TestingProfile profile;
- SyncBackendRegistrar registrar(ModelTypeSet(), "test", &profile, &loop_);
+ SyncBackendRegistrar registrar(ModelEnumSet(), "test", &profile, &loop_);
EXPECT_FALSE(registrar.IsNigoriEnabled());
{
std::vector<ModelSafeWorker*> workers;
@@ -81,17 +81,17 @@ TEST_F(SyncBackendRegistrarTest, ConstructorEmpty) {
EXPECT_EQ(4u, workers.size());
}
ExpectRoutingInfo(&registrar, ModelSafeRoutingInfo());
- ExpectHasProcessorsForTypes(registrar, ModelTypeSet());
+ ExpectHasProcessorsForTypes(registrar, ModelEnumSet());
registrar.OnSyncerShutdownComplete();
registrar.StopOnUIThread();
}
TEST_F(SyncBackendRegistrarTest, ConstructorNonEmpty) {
TestingProfile profile;
- ModelTypeSet initial_types;
- initial_types.insert(BOOKMARKS);
- initial_types.insert(NIGORI);
- initial_types.insert(PASSWORDS);
+ ModelEnumSet initial_types;
+ initial_types.Put(BOOKMARKS);
+ initial_types.Put(NIGORI);
+ initial_types.Put(PASSWORDS);
SyncBackendRegistrar registrar(initial_types, "test", &profile, &loop_);
EXPECT_TRUE(registrar.IsNigoriEnabled());
{
@@ -106,21 +106,22 @@ TEST_F(SyncBackendRegistrarTest, ConstructorNonEmpty) {
// Passwords dropped because of no password store.
ExpectRoutingInfo(&registrar, expected_routing_info);
}
- ExpectHasProcessorsForTypes(registrar, ModelTypeSet());
+ ExpectHasProcessorsForTypes(registrar, ModelEnumSet());
registrar.OnSyncerShutdownComplete();
registrar.StopOnUIThread();
}
TEST_F(SyncBackendRegistrarTest, ConfigureDataTypes) {
TestingProfile profile;
- SyncBackendRegistrar registrar(ModelTypeSet(), "test", &profile, &loop_);
+ SyncBackendRegistrar registrar(ModelEnumSet(), "test", &profile, &loop_);
// Add.
- ModelTypeSet types1;
- types1.insert(BOOKMARKS);
- types1.insert(NIGORI);
- types1.insert(AUTOFILL);
- EXPECT_EQ(types1, registrar.ConfigureDataTypes(types1, ModelTypeSet()));
+ ModelEnumSet types1;
+ types1.Put(BOOKMARKS);
+ types1.Put(NIGORI);
+ types1.Put(AUTOFILL);
+ EXPECT_TRUE(types1.Equals(
+ registrar.ConfigureDataTypes(types1, ModelEnumSet())));
{
ModelSafeRoutingInfo expected_routing_info;
expected_routing_info[BOOKMARKS] = GROUP_PASSIVE;
@@ -128,25 +129,25 @@ TEST_F(SyncBackendRegistrarTest, ConfigureDataTypes) {
expected_routing_info[AUTOFILL] = GROUP_PASSIVE;
ExpectRoutingInfo(&registrar, expected_routing_info);
}
- ExpectHasProcessorsForTypes(registrar, ModelTypeSet());
+ ExpectHasProcessorsForTypes(registrar, ModelEnumSet());
// Add and remove.
- ModelTypeSet types2;
- types2.insert(PREFERENCES);
- types2.insert(THEMES);
- EXPECT_EQ(types2, registrar.ConfigureDataTypes(types2, types1));
+ ModelEnumSet types2;
+ types2.Put(PREFERENCES);
+ types2.Put(THEMES);
+ EXPECT_TRUE(types2.Equals(registrar.ConfigureDataTypes(types2, types1)));
{
ModelSafeRoutingInfo expected_routing_info;
expected_routing_info[PREFERENCES] = GROUP_PASSIVE;
expected_routing_info[THEMES] = GROUP_PASSIVE;
ExpectRoutingInfo(&registrar, expected_routing_info);
}
- ExpectHasProcessorsForTypes(registrar, ModelTypeSet());
+ ExpectHasProcessorsForTypes(registrar, ModelEnumSet());
// Remove.
- EXPECT_TRUE(registrar.ConfigureDataTypes(ModelTypeSet(), types2).empty());
+ EXPECT_TRUE(registrar.ConfigureDataTypes(ModelEnumSet(), types2).Empty());
ExpectRoutingInfo(&registrar, ModelSafeRoutingInfo());
- ExpectHasProcessorsForTypes(registrar, ModelTypeSet());
+ ExpectHasProcessorsForTypes(registrar, ModelEnumSet());
registrar.OnSyncerShutdownComplete();
registrar.StopOnUIThread();
@@ -161,7 +162,7 @@ void TriggerChanges(SyncBackendRegistrar* registrar, ModelType type) {
TEST_F(SyncBackendRegistrarTest, ActivateDeactivateUIDataType) {
InSequence in_sequence;
TestingProfile profile;
- SyncBackendRegistrar registrar(ModelTypeSet(), "test", &profile, &loop_);
+ SyncBackendRegistrar registrar(ModelEnumSet(), "test", &profile, &loop_);
// Should do nothing.
TriggerChanges(&registrar, BOOKMARKS);
@@ -178,9 +179,10 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateUIDataType) {
EXPECT_CALL(change_processor_mock, IsRunning())
.WillRepeatedly(Return(false));
- ModelTypeSet types;
- types.insert(BOOKMARKS);
- EXPECT_EQ(types, registrar.ConfigureDataTypes(types, ModelTypeSet()));
+ ModelEnumSet types;
+ types.Put(BOOKMARKS);
+ EXPECT_TRUE(types.Equals(
+ registrar.ConfigureDataTypes(types, ModelEnumSet())));
registrar.ActivateDataType(BOOKMARKS, GROUP_UI,
&change_processor_mock,
test_user_share_.user_share());
@@ -195,7 +197,7 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateUIDataType) {
registrar.DeactivateDataType(BOOKMARKS);
ExpectRoutingInfo(&registrar, ModelSafeRoutingInfo());
- ExpectHasProcessorsForTypes(registrar, ModelTypeSet());
+ ExpectHasProcessorsForTypes(registrar, ModelEnumSet());
// Should do nothing.
TriggerChanges(&registrar, BOOKMARKS);
@@ -208,7 +210,7 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateNonUIDataType) {
content::TestBrowserThread db_thread(BrowserThread::DB, &loop_);
InSequence in_sequence;
TestingProfile profile;
- SyncBackendRegistrar registrar(ModelTypeSet(), "test", &profile, &loop_);
+ SyncBackendRegistrar registrar(ModelEnumSet(), "test", &profile, &loop_);
// Should do nothing.
TriggerChanges(&registrar, AUTOFILL);
@@ -225,9 +227,10 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateNonUIDataType) {
EXPECT_CALL(change_processor_mock, IsRunning())
.WillRepeatedly(Return(false));
- ModelTypeSet types;
- types.insert(AUTOFILL);
- EXPECT_EQ(types, registrar.ConfigureDataTypes(types, ModelTypeSet()));
+ ModelEnumSet types;
+ types.Put(AUTOFILL);
+ EXPECT_TRUE(types.Equals(
+ registrar.ConfigureDataTypes(types, ModelEnumSet())));
registrar.ActivateDataType(AUTOFILL, GROUP_DB,
&change_processor_mock,
test_user_share_.user_share());
@@ -242,7 +245,7 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateNonUIDataType) {
registrar.DeactivateDataType(AUTOFILL);
ExpectRoutingInfo(&registrar, ModelSafeRoutingInfo());
- ExpectHasProcessorsForTypes(registrar, ModelTypeSet());
+ ExpectHasProcessorsForTypes(registrar, ModelEnumSet());
// Should do nothing.
TriggerChanges(&registrar, AUTOFILL);

Powered by Google App Engine
This is Rietveld 408576698