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

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

Issue 2828021: Take 2: sync changes to support encryption (Closed)
Patch Set: fix flaky password test under valgrind Created 10 years, 6 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/syncapi.cc ('k') | chrome/browser/sync/engine/syncer_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/syncapi_unittest.cc
diff --git a/chrome/browser/sync/engine/syncapi_unittest.cc b/chrome/browser/sync/engine/syncapi_unittest.cc
index 70157b540d4f5a862e75be0b21fdf20924d62154..a77134bab78db5b3bd3429d5a1a8f03bf5b9c9dd 100644
--- a/chrome/browser/sync/engine/syncapi_unittest.cc
+++ b/chrome/browser/sync/engine/syncapi_unittest.cc
@@ -9,12 +9,15 @@
#include "base/scoped_ptr.h"
#include "base/scoped_temp_dir.h"
#include "chrome/browser/sync/engine/syncapi.h"
+#include "chrome/browser/sync/protocol/password_specifics.pb.h"
#include "chrome/browser/sync/syncable/directory_manager.h"
#include "chrome/browser/sync/syncable/syncable.h"
#include "chrome/test/sync/engine/test_directory_setter_upper.h"
#include "testing/gtest/include/gtest/gtest.h"
+using browser_sync::KeyParams;
+
namespace sync_api {
class SyncApiTest : public testing::Test {
@@ -232,4 +235,33 @@ TEST_F(SyncApiTest, TestDeleteBehavior) {
}
}
+TEST_F(SyncApiTest, WriteAndReadPassword) {
+ KeyParams params = {"localhost", "username", "passphrase"};
+ share_.dir_manager->cryptographer()->AddKey(params);
+ {
+ WriteTransaction trans(&share_);
+ ReadNode root_node(&trans);
+ root_node.InitByRootLookup();
+
+ WriteNode password_node(&trans);
+ EXPECT_TRUE(password_node.InitUniqueByCreation(syncable::PASSWORDS,
+ root_node, "foo"));
+ sync_pb::PasswordSpecificsData data;
+ data.set_password_value("secret");
+ password_node.SetPasswordSpecifics(data);
+ }
+ {
+ ReadTransaction trans(&share_);
+ ReadNode root_node(&trans);
+ root_node.InitByRootLookup();
+
+ ReadNode password_node(&trans);
+ EXPECT_TRUE(password_node.InitByClientTagLookup(syncable::PASSWORDS,
+ "foo"));
+ const sync_pb::PasswordSpecificsData& data =
+ password_node.GetPasswordSpecifics();
+ EXPECT_EQ("secret", data.password_value());
+ }
+}
+
} // namespace browser_sync
« no previous file with comments | « chrome/browser/sync/engine/syncapi.cc ('k') | chrome/browser/sync/engine/syncer_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698