| 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 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/sync/glue/password_model_associator.h" | 25 #include "chrome/browser/sync/glue/password_model_associator.h" |
| 26 #include "chrome/browser/sync/internal_api/read_node.h" | 26 #include "chrome/browser/sync/internal_api/read_node.h" |
| 27 #include "chrome/browser/sync/internal_api/read_transaction.h" | 27 #include "chrome/browser/sync/internal_api/read_transaction.h" |
| 28 #include "chrome/browser/sync/internal_api/write_node.h" | 28 #include "chrome/browser/sync/internal_api/write_node.h" |
| 29 #include "chrome/browser/sync/internal_api/write_transaction.h" | 29 #include "chrome/browser/sync/internal_api/write_transaction.h" |
| 30 #include "chrome/browser/sync/profile_sync_components_factory.h" | 30 #include "chrome/browser/sync/profile_sync_components_factory.h" |
| 31 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 31 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| 32 #include "chrome/browser/sync/profile_sync_service.h" | 32 #include "chrome/browser/sync/profile_sync_service.h" |
| 33 #include "chrome/browser/sync/profile_sync_test_util.h" | 33 #include "chrome/browser/sync/profile_sync_test_util.h" |
| 34 #include "chrome/browser/sync/test_profile_sync_service.h" | 34 #include "chrome/browser/sync/test_profile_sync_service.h" |
| 35 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 35 #include "chrome/common/chrome_notification_types.h" | 36 #include "chrome/common/chrome_notification_types.h" |
| 36 #include "chrome/common/net/gaia/gaia_constants.h" | 37 #include "chrome/common/net/gaia/gaia_constants.h" |
| 37 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
| 38 #include "chrome/test/base/profile_mock.h" | 39 #include "chrome/test/base/profile_mock.h" |
| 39 #include "content/public/browser/notification_source.h" | 40 #include "content/public/browser/notification_source.h" |
| 40 #include "content/test/notification_observer_mock.h" | 41 #include "content/test/notification_observer_mock.h" |
| 41 #include "content/test/test_browser_thread.h" | 42 #include "content/test/test_browser_thread.h" |
| 42 #include "sync/protocol/password_specifics.pb.h" | 43 #include "sync/protocol/password_specifics.pb.h" |
| 43 #include "sync/syncable/syncable.h" | 44 #include "sync/syncable/syncable.h" |
| 44 #include "sync/test/engine/test_id_factory.h" | 45 #include "sync/test/engine/test_id_factory.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 tag)); | 151 tag)); |
| 151 PasswordModelAssociator::WriteToSyncNode(entry, &node); | 152 PasswordModelAssociator::WriteToSyncNode(entry, &node); |
| 152 } | 153 } |
| 153 | 154 |
| 154 protected: | 155 protected: |
| 155 ProfileSyncServicePasswordTest() {} | 156 ProfileSyncServicePasswordTest() {} |
| 156 | 157 |
| 157 virtual void SetUp() { | 158 virtual void SetUp() { |
| 158 AbstractProfileSyncServiceTest::SetUp(); | 159 AbstractProfileSyncServiceTest::SetUp(); |
| 159 profile_.CreateRequestContext(); | 160 profile_.CreateRequestContext(); |
| 161 // WebDataService is not used in ProfileSyncServicePasswordTest, but |
| 162 // requires correct destruction if instantiated. |
| 163 WebDataServiceFactory::GetInstance()->SetTestingFactory( |
| 164 &profile_, NULL); |
| 165 |
| 160 password_store_ = static_cast<MockPasswordStore*>( | 166 password_store_ = static_cast<MockPasswordStore*>( |
| 161 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( | 167 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( |
| 162 &profile_, MockPasswordStore::Build).get()); | 168 &profile_, MockPasswordStore::Build).get()); |
| 163 | 169 |
| 164 registrar_.Add(&observer_, | 170 registrar_.Add(&observer_, |
| 165 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, | 171 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, |
| 166 content::NotificationService::AllSources()); | 172 content::NotificationService::AllSources()); |
| 167 registrar_.Add(&observer_, | 173 registrar_.Add(&observer_, |
| 168 chrome::NOTIFICATION_SYNC_CONFIGURE_BLOCKED, | 174 chrome::NOTIFICATION_SYNC_CONFIGURE_BLOCKED, |
| 169 content::NotificationService::AllSources()); | 175 content::NotificationService::AllSources()); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 CreateRootHelper create_root(this, syncable::PASSWORDS); | 592 CreateRootHelper create_root(this, syncable::PASSWORDS); |
| 587 StartSyncService(create_root.callback(), | 593 StartSyncService(create_root.callback(), |
| 588 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); | 594 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); |
| 589 | 595 |
| 590 std::vector<PasswordForm> new_sync_forms; | 596 std::vector<PasswordForm> new_sync_forms; |
| 591 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 597 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
| 592 | 598 |
| 593 EXPECT_EQ(1U, new_sync_forms.size()); | 599 EXPECT_EQ(1U, new_sync_forms.size()); |
| 594 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 600 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
| 595 } | 601 } |
| OLD | NEW |