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

Unified Diff: chrome/browser/sync/engine/apply_updates_command_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 pass #2 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
« no previous file with comments | « chrome/browser/sync/engine/all_status.cc ('k') | chrome/browser/sync/engine/get_commit_ids_command.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/apply_updates_command_unittest.cc
diff --git a/chrome/browser/sync/engine/apply_updates_command_unittest.cc b/chrome/browser/sync/engine/apply_updates_command_unittest.cc
index 734f9207fd97a14ed67c7dbbb6dd549fb0167865..cadc14fe77963d49fa592f18d1a26970091db6b3 100644
--- a/chrome/browser/sync/engine/apply_updates_command_unittest.cc
+++ b/chrome/browser/sync/engine/apply_updates_command_unittest.cc
@@ -27,7 +27,6 @@ namespace browser_sync {
using sessions::SyncSession;
using std::string;
using syncable::Entry;
-using syncable::GetAllRealModelTypes;
using syncable::Id;
using syncable::MutableEntry;
using syncable::ReadTransaction;
@@ -427,16 +426,16 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) {
// Storing the cryptographer separately is bad, but for this test we
// know it's safe.
Cryptographer* cryptographer;
- syncable::ModelTypeSet encrypted_types;
- encrypted_types.insert(syncable::PASSWORDS);
- encrypted_types.insert(syncable::NIGORI);
+ syncable::ModelEnumSet encrypted_types;
+ encrypted_types.Put(syncable::PASSWORDS);
+ encrypted_types.Put(syncable::NIGORI);
{
ScopedDirLookup dir(syncdb()->manager(), syncdb()->name());
ASSERT_TRUE(dir.good());
ReadTransaction trans(FROM_HERE, dir);
cryptographer =
session()->context()->directory_manager()->GetCryptographer(&trans);
- EXPECT_EQ(encrypted_types, cryptographer->GetEncryptedTypes());
+ EXPECT_TRUE(cryptographer->GetEncryptedTypes().Equals(encrypted_types));
}
// Nigori node updates should update the Cryptographer.
@@ -449,7 +448,7 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) {
specifics.MutableExtension(sync_pb::nigori);
other_cryptographer.GetKeys(nigori->mutable_encrypted());
nigori->set_encrypt_bookmarks(true);
- encrypted_types.insert(syncable::BOOKMARKS);
+ encrypted_types.Put(syncable::BOOKMARKS);
CreateUnappliedNewItem(syncable::ModelTypeToRootTag(syncable::NIGORI),
specifics, true);
EXPECT_FALSE(cryptographer->has_pending_keys());
@@ -470,23 +469,25 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) {
EXPECT_FALSE(cryptographer->is_ready());
EXPECT_TRUE(cryptographer->has_pending_keys());
- EXPECT_EQ(GetAllRealModelTypes(), cryptographer->GetEncryptedTypes());
+ EXPECT_TRUE(
+ cryptographer->GetEncryptedTypes()
+ .Equals(syncable::ModelEnumSet::All()));
}
TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) {
// Storing the cryptographer separately is bad, but for this test we
// know it's safe.
Cryptographer* cryptographer;
- syncable::ModelTypeSet encrypted_types;
- encrypted_types.insert(syncable::PASSWORDS);
- encrypted_types.insert(syncable::NIGORI);
+ syncable::ModelEnumSet encrypted_types;
+ encrypted_types.Put(syncable::PASSWORDS);
+ encrypted_types.Put(syncable::NIGORI);
{
ScopedDirLookup dir(syncdb()->manager(), syncdb()->name());
ASSERT_TRUE(dir.good());
ReadTransaction trans(FROM_HERE, dir);
cryptographer =
session()->context()->directory_manager()->GetCryptographer(&trans);
- EXPECT_EQ(encrypted_types, cryptographer->GetEncryptedTypes());
+ EXPECT_TRUE(cryptographer->GetEncryptedTypes().Equals(encrypted_types));
}
// Nigori node updates should update the Cryptographer.
@@ -500,8 +501,8 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) {
other_cryptographer.GetKeys(nigori->mutable_encrypted());
nigori->set_encrypt_sessions(true);
nigori->set_encrypt_themes(true);
- encrypted_types.insert(syncable::SESSIONS);
- encrypted_types.insert(syncable::THEMES);
+ encrypted_types.Put(syncable::SESSIONS);
+ encrypted_types.Put(syncable::THEMES);
CreateUnappliedNewItem(syncable::ModelTypeToRootTag(syncable::NIGORI),
specifics, true);
EXPECT_FALSE(cryptographer->has_pending_keys());
@@ -522,23 +523,25 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) {
EXPECT_FALSE(cryptographer->is_ready());
EXPECT_TRUE(cryptographer->has_pending_keys());
- EXPECT_EQ(GetAllRealModelTypes(), cryptographer->GetEncryptedTypes());
+ EXPECT_TRUE(
+ cryptographer->GetEncryptedTypes()
+ .Equals(syncable::ModelEnumSet::All()));
}
TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) {
// Storing the cryptographer separately is bad, but for this test we
// know it's safe.
Cryptographer* cryptographer;
- syncable::ModelTypeSet encrypted_types;
- encrypted_types.insert(syncable::PASSWORDS);
- encrypted_types.insert(syncable::NIGORI);
+ syncable::ModelEnumSet encrypted_types;
+ encrypted_types.Put(syncable::PASSWORDS);
+ encrypted_types.Put(syncable::NIGORI);
{
ScopedDirLookup dir(syncdb()->manager(), syncdb()->name());
ASSERT_TRUE(dir.good());
ReadTransaction trans(FROM_HERE, dir);
cryptographer =
session()->context()->directory_manager()->GetCryptographer(&trans);
- EXPECT_EQ(encrypted_types, cryptographer->GetEncryptedTypes());
+ EXPECT_TRUE(cryptographer->GetEncryptedTypes().Equals(encrypted_types));
// With default encrypted_types, this should be true.
@@ -576,7 +579,7 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) {
specifics.MutableExtension(sync_pb::nigori);
cryptographer->GetKeys(nigori->mutable_encrypted());
nigori->set_encrypt_bookmarks(true);
- encrypted_types.insert(syncable::BOOKMARKS);
+ encrypted_types.Put(syncable::BOOKMARKS);
CreateUnappliedNewItem(syncable::ModelTypeToRootTag(syncable::NIGORI),
specifics, true);
EXPECT_FALSE(cryptographer->has_pending_keys());
@@ -618,7 +621,8 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) {
// If ProcessUnsyncedChangesForEncryption worked, all our unsynced changes
// should be encrypted now.
- EXPECT_EQ(GetAllRealModelTypes(), cryptographer->GetEncryptedTypes());
+ EXPECT_TRUE(syncable::ModelEnumSet::All().Equals(
+ cryptographer->GetEncryptedTypes()));
EXPECT_TRUE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types));
Syncer::UnsyncedMetaHandles handles;
@@ -631,17 +635,16 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) {
// Storing the cryptographer separately is bad, but for this test we
// know it's safe.
Cryptographer* cryptographer;
- syncable::ModelTypeSet encrypted_types;
- encrypted_types.insert(syncable::PASSWORDS);
- encrypted_types.insert(syncable::NIGORI);
+ syncable::ModelEnumSet encrypted_types;
+ encrypted_types.Put(syncable::PASSWORDS);
+ encrypted_types.Put(syncable::NIGORI);
{
ScopedDirLookup dir(syncdb()->manager(), syncdb()->name());
ASSERT_TRUE(dir.good());
ReadTransaction trans(FROM_HERE, dir);
cryptographer =
session()->context()->directory_manager()->GetCryptographer(&trans);
- EXPECT_EQ(encrypted_types, cryptographer->GetEncryptedTypes());
-
+ EXPECT_TRUE(cryptographer->GetEncryptedTypes().Equals(encrypted_types));
// With default encrypted_types, this should be true.
EXPECT_TRUE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types));
@@ -681,7 +684,7 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) {
specifics.MutableExtension(sync_pb::nigori);
other_cryptographer.GetKeys(nigori->mutable_encrypted());
nigori->set_encrypt_bookmarks(true);
- encrypted_types.insert(syncable::BOOKMARKS);
+ encrypted_types.Put(syncable::BOOKMARKS);
CreateUnappliedNewItem(syncable::ModelTypeToRootTag(syncable::NIGORI),
specifics, true);
EXPECT_FALSE(cryptographer->has_pending_keys());
@@ -725,10 +728,12 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) {
// Since we're in conflict, the specifics don't reflect the unapplied
// changes.
EXPECT_FALSE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types));
- encrypted_types.clear();
- encrypted_types.insert(syncable::PASSWORDS);
- encrypted_types.insert(syncable::BOOKMARKS);
- EXPECT_EQ(GetAllRealModelTypes(), cryptographer->GetEncryptedTypes());
+ encrypted_types.Clear();
+ encrypted_types.Put(syncable::PASSWORDS);
+ encrypted_types.Put(syncable::BOOKMARKS);
+ EXPECT_TRUE(
+ cryptographer->GetEncryptedTypes().Equals(
+ syncable::ModelEnumSet().All()));
Syncer::UnsyncedMetaHandles handles;
SyncerUtil::GetUnsyncedEntries(&trans, &handles);
« no previous file with comments | « chrome/browser/sync/engine/all_status.cc ('k') | chrome/browser/sync/engine/get_commit_ids_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698