| 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" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/waitable_event.h" | |
| 13 #include "chrome/browser/password_manager/password_store.h" | 12 #include "chrome/browser/password_manager/password_store.h" |
| 14 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" | 13 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" |
| 15 #include "chrome/browser/sync/engine/syncapi.h" | 14 #include "chrome/browser/sync/engine/syncapi.h" |
| 16 #include "chrome/browser/sync/glue/password_change_processor.h" | 15 #include "chrome/browser/sync/glue/password_change_processor.h" |
| 17 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 16 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
| 18 #include "chrome/browser/sync/glue/password_model_associator.h" | 17 #include "chrome/browser/sync/glue/password_model_associator.h" |
| 19 #include "chrome/browser/sync/glue/sync_backend_host_mock.h" | 18 #include "chrome/browser/sync/glue/sync_backend_host_mock.h" |
| 20 #include "chrome/browser/sync/profile_sync_factory.h" | 19 #include "chrome/browser/sync/profile_sync_factory.h" |
| 21 #include "chrome/browser/sync/profile_sync_factory_mock.h" | 20 #include "chrome/browser/sync/profile_sync_factory_mock.h" |
| 22 #include "chrome/browser/sync/profile_sync_service.h" | 21 #include "chrome/browser/sync/profile_sync_service.h" |
| 23 #include "chrome/browser/sync/profile_sync_test_util.h" | 22 #include "chrome/browser/sync/profile_sync_test_util.h" |
| 24 #include "chrome/browser/sync/protocol/password_specifics.pb.h" | 23 #include "chrome/browser/sync/protocol/password_specifics.pb.h" |
| 25 #include "chrome/browser/sync/syncable/directory_manager.h" | 24 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 26 #include "chrome/browser/sync/syncable/syncable.h" | 25 #include "chrome/browser/sync/syncable/syncable.h" |
| 27 #include "chrome/browser/sync/test_profile_sync_service.h" | 26 #include "chrome/browser/sync/test_profile_sync_service.h" |
| 28 #include "chrome/common/notification_observer_mock.h" | 27 #include "chrome/common/notification_observer_mock.h" |
| 29 #include "chrome/common/notification_source.h" | 28 #include "chrome/common/notification_source.h" |
| 30 #include "chrome/common/notification_type.h" | 29 #include "chrome/common/notification_type.h" |
| 31 #include "chrome/test/sync/engine/test_id_factory.h" | 30 #include "chrome/test/sync/engine/test_id_factory.h" |
| 32 #include "chrome/test/profile_mock.h" | 31 #include "chrome/test/profile_mock.h" |
| 33 #include "testing/gmock/include/gmock/gmock.h" | 32 #include "testing/gmock/include/gmock/gmock.h" |
| 34 #include "webkit/glue/password_form.h" | 33 #include "webkit/glue/password_form.h" |
| 35 | 34 |
| 36 using base::Time; | 35 using base::Time; |
| 37 using base::WaitableEvent; | |
| 38 using browser_sync::PasswordChangeProcessor; | 36 using browser_sync::PasswordChangeProcessor; |
| 39 using browser_sync::PasswordDataTypeController; | 37 using browser_sync::PasswordDataTypeController; |
| 40 using browser_sync::PasswordModelAssociator; | 38 using browser_sync::PasswordModelAssociator; |
| 41 using browser_sync::SyncBackendHostMock; | 39 using browser_sync::SyncBackendHostMock; |
| 42 using browser_sync::TestIdFactory; | 40 using browser_sync::TestIdFactory; |
| 43 using browser_sync::UnrecoverableErrorHandler; | 41 using browser_sync::UnrecoverableErrorHandler; |
| 44 using sync_api::SyncManager; | 42 using sync_api::SyncManager; |
| 45 using sync_api::UserShare; | 43 using sync_api::UserShare; |
| 46 using syncable::BASE_VERSION; | 44 using syncable::BASE_VERSION; |
| 47 using syncable::CREATE; | 45 using syncable::CREATE; |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 AddPasswordEntriesTask node_task(this, sync_forms); | 516 AddPasswordEntriesTask node_task(this, sync_forms); |
| 519 | 517 |
| 520 StartSyncService(&root_task, &node_task); | 518 StartSyncService(&root_task, &node_task); |
| 521 | 519 |
| 522 std::vector<PasswordForm> new_sync_forms; | 520 std::vector<PasswordForm> new_sync_forms; |
| 523 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 521 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
| 524 | 522 |
| 525 EXPECT_EQ(1U, new_sync_forms.size()); | 523 EXPECT_EQ(1U, new_sync_forms.size()); |
| 526 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 524 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
| 527 } | 525 } |
| OLD | NEW |