Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/sync/test/integration/passwords_helper.cc

Issue 8341117: Converted top-level NewRunnable* to Bind for Sync module (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Indenting. Removed trailing whitespace. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/test/integration/autofill_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/password_manager/password_form_data.h" 10 #include "chrome/browser/password_manager/password_form_data.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 }; 59 };
60 60
61 } // namespace 61 } // namespace
62 62
63 namespace passwords_helper { 63 namespace passwords_helper {
64 64
65 void AddLogin(PasswordStore* store, const PasswordForm& form) { 65 void AddLogin(PasswordStore* store, const PasswordForm& form) {
66 ASSERT_TRUE(store); 66 ASSERT_TRUE(store);
67 base::WaitableEvent wait_event(true, false); 67 base::WaitableEvent wait_event(true, false);
68 store->AddLogin(form); 68 store->AddLogin(form);
69 store->ScheduleTask(NewRunnableFunction(&PasswordStoreCallback, &wait_event)); 69 store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event));
70 wait_event.Wait(); 70 wait_event.Wait();
71 } 71 }
72 72
73 void UpdateLogin(PasswordStore* store, const PasswordForm& form) { 73 void UpdateLogin(PasswordStore* store, const PasswordForm& form) {
74 ASSERT_TRUE(store); 74 ASSERT_TRUE(store);
75 base::WaitableEvent wait_event(true, false); 75 base::WaitableEvent wait_event(true, false);
76 store->UpdateLogin(form); 76 store->UpdateLogin(form);
77 store->ScheduleTask(NewRunnableFunction(&PasswordStoreCallback, &wait_event)); 77 store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event));
78 wait_event.Wait(); 78 wait_event.Wait();
79 } 79 }
80 80
81 void GetLogins(PasswordStore* store, std::vector<PasswordForm>& matches) { 81 void GetLogins(PasswordStore* store, std::vector<PasswordForm>& matches) {
82 ASSERT_TRUE(store); 82 ASSERT_TRUE(store);
83 PasswordForm matcher_form; 83 PasswordForm matcher_form;
84 matcher_form.signon_realm = kFakeSignonRealm; 84 matcher_form.signon_realm = kFakeSignonRealm;
85 PasswordStoreConsumerHelper consumer(&matches); 85 PasswordStoreConsumerHelper consumer(&matches);
86 store->GetLogins(matcher_form, &consumer); 86 store->GetLogins(matcher_form, &consumer);
87 ui_test_utils::RunMessageLoop(); 87 ui_test_utils::RunMessageLoop();
88 } 88 }
89 89
90 void RemoveLogin(PasswordStore* store, const PasswordForm& form) { 90 void RemoveLogin(PasswordStore* store, const PasswordForm& form) {
91 ASSERT_TRUE(store); 91 ASSERT_TRUE(store);
92 base::WaitableEvent wait_event(true, false); 92 base::WaitableEvent wait_event(true, false);
93 store->RemoveLogin(form); 93 store->RemoveLogin(form);
94 store->ScheduleTask(NewRunnableFunction(&PasswordStoreCallback, &wait_event)); 94 store->ScheduleTask(base::Bind(&PasswordStoreCallback, &wait_event));
95 wait_event.Wait(); 95 wait_event.Wait();
96 } 96 }
97 97
98 void RemoveLogins(PasswordStore* store) { 98 void RemoveLogins(PasswordStore* store) {
99 std::vector<PasswordForm> forms; 99 std::vector<PasswordForm> forms;
100 GetLogins(store, forms); 100 GetLogins(store, forms);
101 for (std::vector<PasswordForm>::iterator it = forms.begin(); 101 for (std::vector<PasswordForm>::iterator it = forms.begin();
102 it != forms.end(); ++it) { 102 it != forms.end(); ++it) {
103 RemoveLogin(store, *it); 103 RemoveLogin(store, *it);
104 } 104 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 PasswordForm CreateTestPasswordForm(int index) { 196 PasswordForm CreateTestPasswordForm(int index) {
197 PasswordForm form; 197 PasswordForm form;
198 form.signon_realm = kFakeSignonRealm; 198 form.signon_realm = kFakeSignonRealm;
199 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); 199 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index));
200 form.username_value = ASCIIToUTF16(base::StringPrintf("username%d", index)); 200 form.username_value = ASCIIToUTF16(base::StringPrintf("username%d", index));
201 form.password_value = ASCIIToUTF16(base::StringPrintf("password%d", index)); 201 form.password_value = ASCIIToUTF16(base::StringPrintf("password%d", index));
202 return form; 202 return form;
203 } 203 }
204 204
205 } // namespace passwords_helper 205 } // namespace passwords_helper
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/autofill_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698