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

Unified Diff: chrome/browser/sync/engine/nigori_util_unittest.cc

Issue 7795002: [Sync] Gracefully handle writing to a node when the cryptographer is not ready. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer comments Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/engine/nigori_util.cc ('k') | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/nigori_util_unittest.cc
diff --git a/chrome/browser/sync/engine/nigori_util_unittest.cc b/chrome/browser/sync/engine/nigori_util_unittest.cc
index c368f693c9afac7002459df2a351bd0a26dbf4bf..444e78f5cdef0da56dd0bac603d94613c5c04604 100644
--- a/chrome/browser/sync/engine/nigori_util_unittest.cc
+++ b/chrome/browser/sync/engine/nigori_util_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/sync/protocol/bookmark_specifics.pb.h"
#include "chrome/browser/sync/util/cryptographer.h"
#include "chrome/browser/sync/engine/nigori_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -37,6 +38,36 @@ TEST_F(NigoriUtilTest, NigoriEncryptionTypes) {
EXPECT_EQ(encrypted_types, test_types);
}
+TEST(NigoriUtilTest, SpecificsNeedsEncryption) {
+ ModelTypeSet encrypted_types;
+ encrypted_types.insert(BOOKMARKS);
+ encrypted_types.insert(PASSWORDS);
+
+ sync_pb::EntitySpecifics specifics;
+ EXPECT_FALSE(SpecificsNeedsEncryption(ModelTypeSet(), specifics));
+ EXPECT_FALSE(SpecificsNeedsEncryption(encrypted_types, specifics));
+
+ AddDefaultExtensionValue(PREFERENCES, &specifics);
+ EXPECT_FALSE(SpecificsNeedsEncryption(encrypted_types, specifics));
+
+ sync_pb::EntitySpecifics bookmark_specifics;
+ AddDefaultExtensionValue(BOOKMARKS, &bookmark_specifics);
+ EXPECT_TRUE(SpecificsNeedsEncryption(encrypted_types, bookmark_specifics));
+
+ bookmark_specifics.MutableExtension(sync_pb::bookmark)->set_title("title");
+ bookmark_specifics.MutableExtension(sync_pb::bookmark)->set_url("url");
+ EXPECT_TRUE(SpecificsNeedsEncryption(encrypted_types, bookmark_specifics));
+ EXPECT_FALSE(SpecificsNeedsEncryption(ModelTypeSet(), bookmark_specifics));
+
+ bookmark_specifics.mutable_encrypted();
+ EXPECT_FALSE(SpecificsNeedsEncryption(encrypted_types, bookmark_specifics));
+ EXPECT_FALSE(SpecificsNeedsEncryption(ModelTypeSet(), bookmark_specifics));
+
+ sync_pb::EntitySpecifics password_specifics;
+ AddDefaultExtensionValue(PASSWORDS, &password_specifics);
+ EXPECT_FALSE(SpecificsNeedsEncryption(encrypted_types, password_specifics));
+}
+
// ProcessUnsyncedChangesForEncryption and other methods that rely on the syncer
// are tested in apply_updates_command_unittest.cc
« no previous file with comments | « chrome/browser/sync/engine/nigori_util.cc ('k') | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698