This source file includes following definitions.
- TEST
#include "sync/protocol/bookmark_specifics.pb.h"
#include "sync/protocol/sync.pb.h"
#include "sync/syncable/nigori_util.h"
#include "sync/util/cryptographer.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
namespace syncable {
typedef testing::Test NigoriUtilTest;
TEST(NigoriUtilTest, SpecificsNeedsEncryption) {
ModelTypeSet encrypted_types;
encrypted_types.Put(BOOKMARKS);
encrypted_types.Put(PASSWORDS);
sync_pb::EntitySpecifics specifics;
EXPECT_FALSE(SpecificsNeedsEncryption(ModelTypeSet(), specifics));
EXPECT_FALSE(SpecificsNeedsEncryption(encrypted_types, specifics));
AddDefaultFieldValue(PREFERENCES, &specifics);
EXPECT_FALSE(SpecificsNeedsEncryption(encrypted_types, specifics));
sync_pb::EntitySpecifics bookmark_specifics;
AddDefaultFieldValue(BOOKMARKS, &bookmark_specifics);
EXPECT_TRUE(SpecificsNeedsEncryption(encrypted_types, bookmark_specifics));
bookmark_specifics.mutable_bookmark()->set_title("title");
bookmark_specifics.mutable_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;
AddDefaultFieldValue(PASSWORDS, &password_specifics);
EXPECT_FALSE(SpecificsNeedsEncryption(encrypted_types, password_specifics));
}
}
}