OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <vector> | 5 #include <vector> |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 | 140 |
141 void AddPasswordSyncNode(const PasswordForm& entry) { | 141 void AddPasswordSyncNode(const PasswordForm& entry) { |
142 sync_api::WriteTransaction trans(FROM_HERE, service_->GetUserShare()); | 142 sync_api::WriteTransaction trans(FROM_HERE, service_->GetUserShare()); |
143 sync_api::ReadNode password_root(&trans); | 143 sync_api::ReadNode password_root(&trans); |
144 ASSERT_EQ(sync_api::BaseNode::INIT_OK, | 144 ASSERT_EQ(sync_api::BaseNode::INIT_OK, |
145 password_root.InitByTagLookup(browser_sync::kPasswordTag)); | 145 password_root.InitByTagLookup(browser_sync::kPasswordTag)); |
146 | 146 |
147 sync_api::WriteNode node(&trans); | 147 sync_api::WriteNode node(&trans); |
148 std::string tag = PasswordModelAssociator::MakeTag(entry); | 148 std::string tag = PasswordModelAssociator::MakeTag(entry); |
149 ASSERT_TRUE(node.InitUniqueByCreation(syncable::PASSWORDS, | 149 sync_api::WriteNode::InitUniqueByCreationResult result = |
150 password_root, | 150 node.InitUniqueByCreation(syncable::PASSWORDS, password_root, tag); |
151 tag)); | 151 ASSERT_EQ(sync_api::WriteNode::INIT_SUCCESS, result); |
152 PasswordModelAssociator::WriteToSyncNode(entry, &node); | 152 PasswordModelAssociator::WriteToSyncNode(entry, &node); |
153 } | 153 } |
154 | 154 |
155 protected: | 155 protected: |
156 ProfileSyncServicePasswordTest() {} | 156 ProfileSyncServicePasswordTest() {} |
157 | 157 |
158 virtual void SetUp() { | 158 virtual void SetUp() { |
159 AbstractProfileSyncServiceTest::SetUp(); | 159 AbstractProfileSyncServiceTest::SetUp(); |
160 profile_.CreateRequestContext(); | 160 profile_.CreateRequestContext(); |
161 password_store_ = static_cast<MockPasswordStore*>( | 161 password_store_ = static_cast<MockPasswordStore*>( |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 CreateRootHelper create_root(this, syncable::PASSWORDS); | 589 CreateRootHelper create_root(this, syncable::PASSWORDS); |
590 StartSyncService(create_root.callback(), | 590 StartSyncService(create_root.callback(), |
591 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); | 591 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); |
592 | 592 |
593 std::vector<PasswordForm> new_sync_forms; | 593 std::vector<PasswordForm> new_sync_forms; |
594 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 594 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
595 | 595 |
596 EXPECT_EQ(1U, new_sync_forms.size()); | 596 EXPECT_EQ(1U, new_sync_forms.size()); |
597 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 597 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
598 } | 598 } |
OLD | NEW |