| 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 store->UpdateLogin(form); | 86 store->UpdateLogin(form); |
| 87 store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event)); | 87 store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event)); |
| 88 wait_event.Wait(); | 88 wait_event.Wait(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void GetLogins(PasswordStore* store, std::vector<PasswordForm>& matches) { | 91 void GetLogins(PasswordStore* store, std::vector<PasswordForm>& matches) { |
| 92 ASSERT_TRUE(store); | 92 ASSERT_TRUE(store); |
| 93 PasswordForm matcher_form; | 93 PasswordForm matcher_form; |
| 94 matcher_form.signon_realm = kFakeSignonRealm; | 94 matcher_form.signon_realm = kFakeSignonRealm; |
| 95 PasswordStoreConsumerHelper consumer(&matches); | 95 PasswordStoreConsumerHelper consumer(&matches); |
| 96 store->GetLogins(matcher_form, &consumer); | 96 store->GetLogins(matcher_form, PasswordStore::DISALLOW_PROMPT, &consumer); |
| 97 content::RunMessageLoop(); | 97 content::RunMessageLoop(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void RemoveLogin(PasswordStore* store, const PasswordForm& form) { | 100 void RemoveLogin(PasswordStore* store, const PasswordForm& form) { |
| 101 ASSERT_TRUE(store); | 101 ASSERT_TRUE(store); |
| 102 base::WaitableEvent wait_event(true, false); | 102 base::WaitableEvent wait_event(true, false); |
| 103 store->RemoveLogin(form); | 103 store->RemoveLogin(form); |
| 104 store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event)); | 104 store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event)); |
| 105 wait_event.Wait(); | 105 wait_event.Wait(); |
| 106 } | 106 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 PasswordForm form; | 216 PasswordForm form; |
| 217 form.signon_realm = kFakeSignonRealm; | 217 form.signon_realm = kFakeSignonRealm; |
| 218 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); | 218 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); |
| 219 form.username_value = ASCIIToUTF16(base::StringPrintf("username%d", index)); | 219 form.username_value = ASCIIToUTF16(base::StringPrintf("username%d", index)); |
| 220 form.password_value = ASCIIToUTF16(base::StringPrintf("password%d", index)); | 220 form.password_value = ASCIIToUTF16(base::StringPrintf("password%d", index)); |
| 221 form.date_created = base::Time::Now(); | 221 form.date_created = base::Time::Now(); |
| 222 return form; | 222 return form; |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace passwords_helper | 225 } // namespace passwords_helper |
| OLD | NEW |