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 "chrome/browser/sync/test/integration/passwords_helper.h" | 5 #include "chrome/browser/sync/test/integration/passwords_helper.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event)); | 81 store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event)); |
82 wait_event.Wait(); | 82 wait_event.Wait(); |
83 } | 83 } |
84 | 84 |
85 void GetLogins(PasswordStore* store, std::vector<PasswordForm>& matches) { | 85 void GetLogins(PasswordStore* store, std::vector<PasswordForm>& matches) { |
86 ASSERT_TRUE(store); | 86 ASSERT_TRUE(store); |
87 PasswordForm matcher_form; | 87 PasswordForm matcher_form; |
88 matcher_form.signon_realm = kFakeSignonRealm; | 88 matcher_form.signon_realm = kFakeSignonRealm; |
89 PasswordStoreConsumerHelper consumer(&matches); | 89 PasswordStoreConsumerHelper consumer(&matches); |
90 store->GetLogins(matcher_form, &consumer); | 90 store->GetLogins(matcher_form, &consumer); |
91 ui_test_utils::RunMessageLoop(); | 91 content::RunMessageLoop(); |
92 } | 92 } |
93 | 93 |
94 void RemoveLogin(PasswordStore* store, const PasswordForm& form) { | 94 void RemoveLogin(PasswordStore* store, const PasswordForm& form) { |
95 ASSERT_TRUE(store); | 95 ASSERT_TRUE(store); |
96 base::WaitableEvent wait_event(true, false); | 96 base::WaitableEvent wait_event(true, false); |
97 store->RemoveLogin(form); | 97 store->RemoveLogin(form); |
98 store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event)); | 98 store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event)); |
99 wait_event.Wait(); | 99 wait_event.Wait(); |
100 } | 100 } |
101 | 101 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 PasswordForm form; | 210 PasswordForm form; |
211 form.signon_realm = kFakeSignonRealm; | 211 form.signon_realm = kFakeSignonRealm; |
212 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); | 212 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); |
213 form.username_value = ASCIIToUTF16(base::StringPrintf("username%d", index)); | 213 form.username_value = ASCIIToUTF16(base::StringPrintf("username%d", index)); |
214 form.password_value = ASCIIToUTF16(base::StringPrintf("password%d", index)); | 214 form.password_value = ASCIIToUTF16(base::StringPrintf("password%d", index)); |
215 form.date_created = base::Time::Now(); | 215 form.date_created = base::Time::Now(); |
216 return form; | 216 return form; |
217 } | 217 } |
218 | 218 |
219 } // namespace passwords_helper | 219 } // namespace passwords_helper |
OLD | NEW |