OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/test/live_sync/live_passwords_sync_test.h" | 5 #include "chrome/test/live_sync/live_passwords_sync_test.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/stringprintf.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/password_manager/password_store_consumer.h" | 10 #include "chrome/browser/password_manager/password_store_consumer.h" |
11 #include "chrome/browser/password_manager/password_store.h" | 11 #include "chrome/browser/password_manager/password_store.h" |
12 #include "chrome/browser/sync/profile_sync_service_harness.h" | 12 #include "chrome/browser/sync/profile_sync_service_harness.h" |
13 #include "chrome/test/ui_test_utils.h" | 13 #include "chrome/test/ui_test_utils.h" |
14 #include "content/browser/browser_thread.h" | 14 #include "content/browser/browser_thread.h" |
15 | 15 |
16 using webkit_glue::PasswordForm; | 16 using webkit_glue::PasswordForm; |
17 | 17 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 return GetProfile(index)->GetPasswordStore(Profile::IMPLICIT_ACCESS); | 98 return GetProfile(index)->GetPasswordStore(Profile::IMPLICIT_ACCESS); |
99 } | 99 } |
100 | 100 |
101 PasswordStore* LivePasswordsSyncTest::GetVerifierPasswordStore() { | 101 PasswordStore* LivePasswordsSyncTest::GetVerifierPasswordStore() { |
102 return verifier()->GetPasswordStore(Profile::IMPLICIT_ACCESS); | 102 return verifier()->GetPasswordStore(Profile::IMPLICIT_ACCESS); |
103 } | 103 } |
104 | 104 |
105 PasswordForm LivePasswordsSyncTest::CreateTestPasswordForm(int index) { | 105 PasswordForm LivePasswordsSyncTest::CreateTestPasswordForm(int index) { |
106 PasswordForm form; | 106 PasswordForm form; |
107 form.signon_realm = kFakeSignonRealm; | 107 form.signon_realm = kFakeSignonRealm; |
108 form.origin = GURL(StringPrintf("http://fake-domain%d.google.com/", index)); | 108 form.origin = |
109 form.username_value = ASCIIToUTF16(StringPrintf("username%d", index)); | 109 GURL(base::StringPrintf("http://fake-domain%d.google.com/", index)); |
110 form.password_value = ASCIIToUTF16(StringPrintf("password%d", index)); | 110 form.username_value = ASCIIToUTF16(base::StringPrintf("username%d", index)); |
| 111 form.password_value = ASCIIToUTF16(base::StringPrintf("password%d", index)); |
111 return form; | 112 return form; |
112 } | 113 } |
113 | 114 |
114 void LivePasswordsSyncTest::CleanupTestPasswordForms() { | 115 void LivePasswordsSyncTest::CleanupTestPasswordForms() { |
115 std::vector<PasswordForm> forms; | 116 std::vector<PasswordForm> forms; |
116 GetLogins(GetVerifierPasswordStore(), forms); | 117 GetLogins(GetVerifierPasswordStore(), forms); |
117 for (std::vector<PasswordForm>::iterator it = forms.begin(); | 118 for (std::vector<PasswordForm>::iterator it = forms.begin(); |
118 it != forms.end(); ++it) { | 119 it != forms.end(); ++it) { |
119 GetVerifierPasswordStore()->RemoveLogin(*it); | 120 GetVerifierPasswordStore()->RemoveLogin(*it); |
120 } | 121 } |
121 forms.clear(); | 122 forms.clear(); |
122 GetLogins(GetVerifierPasswordStore(), forms); | 123 GetLogins(GetVerifierPasswordStore(), forms); |
123 ASSERT_EQ(0U, forms.size()); | 124 ASSERT_EQ(0U, forms.size()); |
124 } | 125 } |
OLD | NEW |