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 EXPECT_EQ(encrypted_types, test_types); |
| 26 |
| 27 encrypted_types.erase(syncable::BOOKMARKS); |
| 28 encrypted_types.erase(syncable::SESSIONS); |
| 29 FillNigoriEncryptedTypes(encrypted_types, &nigori); |
| 30 test_types = GetEncryptedDataTypesFromNigori(nigori); |
| 31 EXPECT_EQ(encrypted_types, test_types); |
| 32 } |
| 33 |
| 34 // ProcessUnsyncedChangesForEncryption and other methods that rely on the syncer |
| 35 // are tested in apply_updates_command_unittest.cc |
| 36 |
| 37 } // namespace syncable |
OLD | NEW |