| 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 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/sync/profile_sync_components_factory.h" | 26 #include "chrome/browser/sync/profile_sync_components_factory.h" |
| 27 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 27 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| 28 #include "chrome/browser/sync/profile_sync_service.h" | 28 #include "chrome/browser/sync/profile_sync_service.h" |
| 29 #include "chrome/browser/sync/profile_sync_test_util.h" | 29 #include "chrome/browser/sync/profile_sync_test_util.h" |
| 30 #include "chrome/browser/sync/test_profile_sync_service.h" | 30 #include "chrome/browser/sync/test_profile_sync_service.h" |
| 31 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
| 32 #include "chrome/common/net/gaia/gaia_constants.h" | 32 #include "chrome/common/net/gaia/gaia_constants.h" |
| 33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/test/base/profile_mock.h" | 34 #include "chrome/test/base/profile_mock.h" |
| 35 #include "content/public/browser/notification_source.h" | 35 #include "content/public/browser/notification_source.h" |
| 36 #include "content/test/notification_observer_mock.h" | 36 #include "content/public/test/mock_notification_observer.h" |
| 37 #include "content/test/test_browser_thread.h" | 37 #include "content/test/test_browser_thread.h" |
| 38 #include "sync/internal_api/read_node.h" | 38 #include "sync/internal_api/read_node.h" |
| 39 #include "sync/internal_api/read_transaction.h" | 39 #include "sync/internal_api/read_transaction.h" |
| 40 #include "sync/internal_api/write_node.h" | 40 #include "sync/internal_api/write_node.h" |
| 41 #include "sync/internal_api/write_transaction.h" | 41 #include "sync/internal_api/write_transaction.h" |
| 42 #include "sync/protocol/password_specifics.pb.h" | 42 #include "sync/protocol/password_specifics.pb.h" |
| 43 #include "sync/syncable/syncable.h" | 43 #include "sync/syncable/syncable.h" |
| 44 #include "sync/test/engine/test_id_factory.h" | 44 #include "sync/test/engine/test_id_factory.h" |
| 45 #include "testing/gmock/include/gmock/gmock.h" | 45 #include "testing/gmock/include/gmock/gmock.h" |
| 46 #include "webkit/forms/password_form.h" | 46 #include "webkit/forms/password_form.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 lhs.date_created == rhs.date_created && | 281 lhs.date_created == rhs.date_created && |
| 282 lhs.blacklisted_by_user == rhs.blacklisted_by_user; | 282 lhs.blacklisted_by_user == rhs.blacklisted_by_user; |
| 283 } | 283 } |
| 284 | 284 |
| 285 void SetIdleChangeProcessorExpectations() { | 285 void SetIdleChangeProcessorExpectations() { |
| 286 EXPECT_CALL(*password_store_, AddLoginImpl(_)).Times(0); | 286 EXPECT_CALL(*password_store_, AddLoginImpl(_)).Times(0); |
| 287 EXPECT_CALL(*password_store_, UpdateLoginImpl(_)).Times(0); | 287 EXPECT_CALL(*password_store_, UpdateLoginImpl(_)).Times(0); |
| 288 EXPECT_CALL(*password_store_, RemoveLoginImpl(_)).Times(0); | 288 EXPECT_CALL(*password_store_, RemoveLoginImpl(_)).Times(0); |
| 289 } | 289 } |
| 290 | 290 |
| 291 content::NotificationObserverMock observer_; | 291 content::MockNotificationObserver observer_; |
| 292 ProfileMock profile_; | 292 ProfileMock profile_; |
| 293 scoped_refptr<MockPasswordStore> password_store_; | 293 scoped_refptr<MockPasswordStore> password_store_; |
| 294 content::NotificationRegistrar registrar_; | 294 content::NotificationRegistrar registrar_; |
| 295 }; | 295 }; |
| 296 | 296 |
| 297 void AddPasswordEntriesCallback(ProfileSyncServicePasswordTest* test, | 297 void AddPasswordEntriesCallback(ProfileSyncServicePasswordTest* test, |
| 298 const std::vector<PasswordForm>& entries) { | 298 const std::vector<PasswordForm>& entries) { |
| 299 for (size_t i = 0; i < entries.size(); ++i) | 299 for (size_t i = 0; i < entries.size(); ++i) |
| 300 test->AddPasswordSyncNode(entries[i]); | 300 test->AddPasswordSyncNode(entries[i]); |
| 301 } | 301 } |
| (...skipping 287 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 |