| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/sync/syncable/nigori_util.h" | |
| 6 #include "testing/gtest/include/gtest/gtest.h" | |
| 7 | |
| 8 namespace syncable { | |
| 9 | |
| 10 typedef testing::Test NigoriUtilTest; | |
| 11 | |
| 12 TEST_F(NigoriUtilTest, NigoriEncryptionTypes) { | |
| 13 sync_pb::NigoriSpecifics nigori; | |
| 14 ModelTypeSet encrypted_types; | |
| 15 FillNigoriEncryptedTypes(encrypted_types, &nigori); | |
| 16 ModelTypeSet test_types = GetEncryptedDataTypesFromNigori(nigori); | |
| 17 EXPECT_EQ(encrypted_types, test_types); | |
| 18 | |
| 19 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | |
| 20 encrypted_types.insert(ModelTypeFromInt(i)); | |
| 21 } | |
| 22 FillNigoriEncryptedTypes(encrypted_types, &nigori); | |
| 23 test_types = GetEncryptedDataTypesFromNigori(nigori); | |
| 24 encrypted_types.erase(syncable::NIGORI); // Should not get set. | |
| 25 encrypted_types.erase(syncable::PASSWORDS); // Should not get set. | |
| 26 EXPECT_EQ(encrypted_types, test_types); | |
| 27 | |
| 28 encrypted_types.erase(syncable::BOOKMARKS); | |
| 29 encrypted_types.erase(syncable::SESSIONS); | |
| 30 FillNigoriEncryptedTypes(encrypted_types, &nigori); | |
| 31 test_types = GetEncryptedDataTypesFromNigori(nigori); | |
| 32 EXPECT_EQ(encrypted_types, test_types); | |
| 33 } | |
| 34 | |
| 35 // ProcessUnsyncedChangesForEncryption and other methods that rely on the syncer | |
| 36 // are tested in apply_updates_command_unittest.cc | |
| 37 | |
| 38 } // namespace syncable | |
| OLD | NEW |