| 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 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_PASSWORDS_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_PASSWORDS_HELPER_H_ |
| 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_PASSWORDS_HELPER_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_PASSWORDS_HELPER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_vector.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/sync/profile_sync_service.h" | 12 #include "chrome/browser/sync/profile_sync_service.h" |
| 12 #include "chrome/browser/sync/test/integration/sync_test.h" | 13 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 13 #include "components/autofill/core/common/password_form.h" | 14 #include "components/autofill/core/common/password_form.h" |
| 14 | 15 |
| 15 namespace password_manager { | 16 namespace password_manager { |
| 16 class PasswordStore; | 17 class PasswordStore; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace passwords_helper { | 20 namespace passwords_helper { |
| 20 | 21 |
| 21 // Adds the login held in |form| to the password store |store|. Even though | 22 // Adds the login held in |form| to the password store |store|. Even though |
| 22 // logins are normally added asynchronously, this method will block until the | 23 // logins are normally added asynchronously, this method will block until the |
| 23 // login is added. | 24 // login is added. |
| 24 void AddLogin(password_manager::PasswordStore* store, | 25 void AddLogin(password_manager::PasswordStore* store, |
| 25 const autofill::PasswordForm& form); | 26 const autofill::PasswordForm& form); |
| 26 | 27 |
| 27 // Update the data held in password store |store| with a modified |form|. | 28 // Update the data held in password store |store| with a modified |form|. |
| 28 // This method blocks until the operation is complete. | 29 // This method blocks until the operation is complete. |
| 29 void UpdateLogin(password_manager::PasswordStore* store, | 30 void UpdateLogin(password_manager::PasswordStore* store, |
| 30 const autofill::PasswordForm& form); | 31 const autofill::PasswordForm& form); |
| 31 | 32 |
| 32 // Searches |store| for all logins matching a fake signon realm used only by | 33 // Returns all logins from |store| matching a fake signon realm used only by |
| 33 // LivePasswordsSyncTest and adds the results to |matches|. Note that the | 34 // PasswordsSyncPerfTest. |
| 34 // caller is responsible for deleting the forms added to |matches|. | 35 ScopedVector<autofill::PasswordForm> GetLogins( |
| 35 void GetLogins(password_manager::PasswordStore* store, | 36 password_manager::PasswordStore* store); |
| 36 std::vector<autofill::PasswordForm>& matches); | |
| 37 | 37 |
| 38 // Removes the login held in |form| from the password store |store|. This | 38 // Removes the login held in |form| from the password store |store|. This |
| 39 // method blocks until the operation is complete. | 39 // method blocks until the operation is complete. |
| 40 void RemoveLogin(password_manager::PasswordStore* store, | 40 void RemoveLogin(password_manager::PasswordStore* store, |
| 41 const autofill::PasswordForm& form); | 41 const autofill::PasswordForm& form); |
| 42 | 42 |
| 43 // Removes all password forms from the password store |store|. | 43 // Removes all password forms from the password store |store|. |
| 44 void RemoveLogins(password_manager::PasswordStore* store); | 44 void RemoveLogins(password_manager::PasswordStore* store); |
| 45 | 45 |
| 46 // Sets the cryptographer's encryption passphrase for the profile at index | 46 // Sets the cryptographer's encryption passphrase for the profile at index |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 bool AwaitProfileContainsSamePasswordFormsAsVerifier(int index); | 84 bool AwaitProfileContainsSamePasswordFormsAsVerifier(int index); |
| 85 | 85 |
| 86 // Returns the number of forms in the password store of the profile with index | 86 // Returns the number of forms in the password store of the profile with index |
| 87 // |index|. | 87 // |index|. |
| 88 int GetPasswordCount(int index); | 88 int GetPasswordCount(int index); |
| 89 | 89 |
| 90 // Returns the number of forms in the password store of the verifier profile. | 90 // Returns the number of forms in the password store of the verifier profile. |
| 91 int GetVerifierPasswordCount(); | 91 int GetVerifierPasswordCount(); |
| 92 | 92 |
| 93 // Creates a test password form with a well known fake signon realm used only | 93 // Creates a test password form with a well known fake signon realm used only |
| 94 // by LivePasswordsSyncTest based on |index|. | 94 // by PasswordsSyncPerfTest based on |index|. |
| 95 autofill::PasswordForm CreateTestPasswordForm(int index); | 95 autofill::PasswordForm CreateTestPasswordForm(int index); |
| 96 | 96 |
| 97 } // namespace passwords_helper | 97 } // namespace passwords_helper |
| 98 | 98 |
| 99 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PASSWORDS_HELPER_H_ | 99 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PASSWORDS_HELPER_H_ |
| OLD | NEW |