OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_TEST_LIVE_SYNC_PASSWORDS_HELPER_H_ | |
6 #define CHROME_TEST_LIVE_SYNC_PASSWORDS_HELPER_H_ | |
7 #pragma once | |
8 | |
9 #include <vector> | |
10 | |
11 #include "base/time.h" | |
12 #include "chrome/browser/profiles/profile.h" | |
13 #include "chrome/test/live_sync/live_sync_test.h" | |
14 #include "webkit/glue/password_form.h" | |
15 | |
16 class PasswordStore; | |
17 | |
18 namespace passwords_helper { | |
19 | |
20 // Adds the login held in |form| to the password store |store|. Even though | |
21 // logins are normally added asynchronously, this method will block until the | |
22 // login is added. | |
23 void AddLogin(PasswordStore* store, const webkit_glue::PasswordForm& form); | |
24 | |
25 // Update the data held in password store |store| with a modified |form|. | |
26 // This method blocks until the operation is complete. | |
27 void UpdateLogin(PasswordStore* store, const webkit_glue::PasswordForm& form); | |
28 | |
29 // Searches |store| for all logins matching a fake signon realm used only by | |
30 // LivePasswordsSyncTest and adds the results to |matches|. Note that the | |
31 // caller is responsible for deleting the forms added to |matches|. | |
32 void GetLogins(PasswordStore* store, | |
33 std::vector<webkit_glue::PasswordForm>& matches); | |
34 | |
35 // Removes the login held in |form| from the password store |store|. This | |
36 // method blocks until the operation is complete. | |
37 void RemoveLogin(PasswordStore* store, const webkit_glue::PasswordForm& form); | |
38 | |
39 // Removes all password forms from the password store |store|. | |
40 void RemoveLogins(PasswordStore* store); | |
41 | |
42 // Sets the cryptographer's passphrase for the profile at index |index| to | |
43 // |passphrase|. |is_creation| is true if a new passphrase is being set up | |
44 // and false otherwise. | |
45 void SetPassphrase(int index, const std::string& passphrase, bool is_creation); | |
46 | |
47 // Gets the password store of the profile with index |index|. | |
48 PasswordStore* GetPasswordStore(int index); | |
49 | |
50 // Gets the password store of the verifier profile. | |
51 PasswordStore* GetVerifierPasswordStore(); | |
52 | |
53 // Returns true iff the profile with index |index| contains the same password | |
54 // forms as the verifier profile. | |
55 bool ProfileContainsSamePasswordFormsAsVerifier(int index); | |
56 | |
57 // Returns true iff the profile with index |index_a| contains the same | |
58 // password forms as the profile with index |index_b|. | |
59 bool ProfilesContainSamePasswordForms(int index_a, int index_b); | |
60 | |
61 // Returns true iff all profiles contain the same password forms as the | |
62 // verifier profile. | |
63 bool AllProfilesContainSamePasswordFormsAsVerifier(); | |
64 | |
65 // Returns true iff all profiles contain the same password forms. | |
66 bool AllProfilesContainSamePasswordForms(); | |
67 | |
68 // Returns the number of forms in the password store of the profile with index | |
69 // |index|. | |
70 int GetPasswordCount(int index); | |
71 | |
72 // Returns the number of forms in the password store of the verifier profile. | |
73 int GetVerifierPasswordCount(); | |
74 | |
75 // Creates a test password form with a well known fake signon realm used only | |
76 // by LivePasswordsSyncTest based on |index|. | |
77 webkit_glue::PasswordForm CreateTestPasswordForm(int index); | |
78 | |
79 } // namespace passwords_helper | |
80 | |
81 #endif // CHROME_TEST_LIVE_SYNC_PASSWORDS_HELPER_H_ | |
OLD | NEW |