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/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/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
33 #include "chrome/test/base/profile_mock.h" | 33 #include "chrome/test/base/profile_mock.h" |
34 #include "content/public/browser/notification_source.h" | 34 #include "content/public/browser/notification_source.h" |
| 35 #include "content/public/common/password_form.h" |
35 #include "content/public/test/mock_notification_observer.h" | 36 #include "content/public/test/mock_notification_observer.h" |
36 #include "content/public/test/test_browser_thread.h" | 37 #include "content/public/test/test_browser_thread.h" |
37 #include "google_apis/gaia/gaia_constants.h" | 38 #include "google_apis/gaia/gaia_constants.h" |
38 #include "sync/internal_api/public/read_node.h" | 39 #include "sync/internal_api/public/read_node.h" |
39 #include "sync/internal_api/public/read_transaction.h" | 40 #include "sync/internal_api/public/read_transaction.h" |
40 #include "sync/internal_api/public/write_node.h" | 41 #include "sync/internal_api/public/write_node.h" |
41 #include "sync/internal_api/public/write_transaction.h" | 42 #include "sync/internal_api/public/write_transaction.h" |
42 #include "sync/protocol/password_specifics.pb.h" | 43 #include "sync/protocol/password_specifics.pb.h" |
43 #include "sync/test/engine/test_id_factory.h" | 44 #include "sync/test/engine/test_id_factory.h" |
44 #include "testing/gmock/include/gmock/gmock.h" | 45 #include "testing/gmock/include/gmock/gmock.h" |
45 #include "webkit/forms/password_form.h" | |
46 | 46 |
47 using base::Time; | 47 using base::Time; |
48 using browser_sync::PasswordChangeProcessor; | 48 using browser_sync::PasswordChangeProcessor; |
49 using browser_sync::PasswordDataTypeController; | 49 using browser_sync::PasswordDataTypeController; |
50 using browser_sync::PasswordModelAssociator; | 50 using browser_sync::PasswordModelAssociator; |
51 using content::BrowserThread; | 51 using content::BrowserThread; |
| 52 using content::PasswordForm; |
52 using syncer::syncable::WriteTransaction; | 53 using syncer::syncable::WriteTransaction; |
53 using testing::_; | 54 using testing::_; |
54 using testing::AtLeast; | 55 using testing::AtLeast; |
55 using testing::DoAll; | 56 using testing::DoAll; |
56 using testing::InvokeWithoutArgs; | 57 using testing::InvokeWithoutArgs; |
57 using testing::Return; | 58 using testing::Return; |
58 using testing::SetArgumentPointee; | 59 using testing::SetArgumentPointee; |
59 using webkit::forms::PasswordForm; | |
60 | 60 |
61 ACTION_P3(MakePasswordSyncComponents, service, ps, dtc) { | 61 ACTION_P3(MakePasswordSyncComponents, service, ps, dtc) { |
62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
63 PasswordModelAssociator* model_associator = | 63 PasswordModelAssociator* model_associator = |
64 new PasswordModelAssociator(service, ps, NULL); | 64 new PasswordModelAssociator(service, ps, NULL); |
65 PasswordChangeProcessor* change_processor = | 65 PasswordChangeProcessor* change_processor = |
66 new PasswordChangeProcessor(model_associator, ps, dtc); | 66 new PasswordChangeProcessor(model_associator, ps, dtc); |
67 return ProfileSyncComponentsFactory::SyncComponents(model_associator, | 67 return ProfileSyncComponentsFactory::SyncComponents(model_associator, |
68 change_processor); | 68 change_processor); |
69 } | 69 } |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 CreateRootHelper create_root(this, syncer::PASSWORDS); | 563 CreateRootHelper create_root(this, syncer::PASSWORDS); |
564 StartSyncService(create_root.callback(), | 564 StartSyncService(create_root.callback(), |
565 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); | 565 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); |
566 | 566 |
567 std::vector<PasswordForm> new_sync_forms; | 567 std::vector<PasswordForm> new_sync_forms; |
568 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 568 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
569 | 569 |
570 EXPECT_EQ(1U, new_sync_forms.size()); | 570 EXPECT_EQ(1U, new_sync_forms.size()); |
571 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 571 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
572 } | 572 } |
OLD | NEW |