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

Side by Side Diff: chrome/browser/sync/syncable/nigori_util_unittest.cc

Issue 6465005: [Sync] Initial support for encrypting any datatype (no UI hookup yet). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Rest of unit tests. Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698