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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 : TestProfileSyncService(factory, | 92 : TestProfileSyncService(factory, |
93 profile, | 93 profile, |
94 signin, | 94 signin, |
95 ProfileSyncService::AUTO_START, | 95 ProfileSyncService::AUTO_START, |
96 synchronous_backend_initialization, | 96 synchronous_backend_initialization, |
97 initial_condition_setup_cb), | 97 initial_condition_setup_cb), |
98 callback_(passphrase_accept_cb) {} | 98 callback_(passphrase_accept_cb) {} |
99 | 99 |
100 virtual ~PasswordTestProfileSyncService() {} | 100 virtual ~PasswordTestProfileSyncService() {} |
101 | 101 |
102 virtual void OnPassphraseAccepted() { | 102 virtual void OnPassphraseRequired( |
| 103 syncer::PassphraseRequiredReason reason, |
| 104 const sync_pb::EncryptedData& pending_keys) OVERRIDE { |
| 105 // We purposely don't let passphrase_required_reason_ get set here, in order |
| 106 // to let the datatype manager get blocked later (at which point we then |
| 107 // set the encryption passphrase). |
| 108 // On a normal client, we would have initialized the cryptographer with the |
| 109 // login credentials. |
| 110 } |
| 111 |
| 112 virtual void OnPassphraseAccepted() OVERRIDE { |
103 if (!callback_.is_null()) | 113 if (!callback_.is_null()) |
104 callback_.Run(); | 114 callback_.Run(); |
105 | 115 |
106 TestProfileSyncService::OnPassphraseAccepted(); | 116 TestProfileSyncService::OnPassphraseAccepted(); |
107 } | 117 } |
108 | 118 |
109 private: | 119 private: |
110 base::Closure callback_; | 120 base::Closure callback_; |
111 }; | 121 }; |
112 | 122 |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 CreateRootHelper create_root(this, syncer::PASSWORDS); | 575 CreateRootHelper create_root(this, syncer::PASSWORDS); |
566 StartSyncService(create_root.callback(), | 576 StartSyncService(create_root.callback(), |
567 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); | 577 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); |
568 | 578 |
569 std::vector<PasswordForm> new_sync_forms; | 579 std::vector<PasswordForm> new_sync_forms; |
570 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 580 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
571 | 581 |
572 EXPECT_EQ(1U, new_sync_forms.size()); | 582 EXPECT_EQ(1U, new_sync_forms.size()); |
573 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 583 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
574 } | 584 } |
OLD | NEW |