| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/task.h" | 9 #include "base/task.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 178 } |
| 179 | 179 |
| 180 void AddPasswordSyncNode(const PasswordForm& entry) { | 180 void AddPasswordSyncNode(const PasswordForm& entry) { |
| 181 sync_api::WriteTransaction trans( | 181 sync_api::WriteTransaction trans( |
| 182 service_->backend()->GetUserShareHandle()); | 182 service_->backend()->GetUserShareHandle()); |
| 183 sync_api::ReadNode password_root(&trans); | 183 sync_api::ReadNode password_root(&trans); |
| 184 ASSERT_TRUE(password_root.InitByTagLookup(browser_sync::kPasswordTag)); | 184 ASSERT_TRUE(password_root.InitByTagLookup(browser_sync::kPasswordTag)); |
| 185 | 185 |
| 186 sync_api::WriteNode node(&trans); | 186 sync_api::WriteNode node(&trans); |
| 187 std::string tag = PasswordModelAssociator::MakeTag(entry); | 187 std::string tag = PasswordModelAssociator::MakeTag(entry); |
| 188 ASSERT_TRUE(node.InitUniqueByCreation(syncable::PASSWORD, | 188 ASSERT_TRUE(node.InitUniqueByCreation(syncable::PASSWORDS, |
| 189 password_root, | 189 password_root, |
| 190 tag)); | 190 tag)); |
| 191 PasswordModelAssociator::WriteToSyncNode(entry, &node); | 191 PasswordModelAssociator::WriteToSyncNode(entry, &node); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void GetPasswordEntriesFromSyncDB(std::vector<PasswordForm>* entries) { | 194 void GetPasswordEntriesFromSyncDB(std::vector<PasswordForm>* entries) { |
| 195 sync_api::ReadTransaction trans(service_->backend()->GetUserShareHandle()); | 195 sync_api::ReadTransaction trans(service_->backend()->GetUserShareHandle()); |
| 196 sync_api::ReadNode password_root(&trans); | 196 sync_api::ReadNode password_root(&trans); |
| 197 ASSERT_TRUE(password_root.InitByTagLookup(browser_sync::kPasswordTag)); | 197 ASSERT_TRUE(password_root.InitByTagLookup(browser_sync::kPasswordTag)); |
| 198 | 198 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 463 |
| 464 EXPECT_CALL(*(password_store_.get()), UpdateLoginImpl(_)).Times(1); | 464 EXPECT_CALL(*(password_store_.get()), UpdateLoginImpl(_)).Times(1); |
| 465 StartSyncService(&task); | 465 StartSyncService(&task); |
| 466 | 466 |
| 467 std::vector<PasswordForm> new_sync_forms; | 467 std::vector<PasswordForm> new_sync_forms; |
| 468 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 468 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
| 469 | 469 |
| 470 EXPECT_EQ(1U, new_sync_forms.size()); | 470 EXPECT_EQ(1U, new_sync_forms.size()); |
| 471 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 471 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
| 472 } | 472 } |
| OLD | NEW |