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

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

Issue 9665007: Profile refactoring: Remove all PasswordStore code from the Profile interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add to factory list Created 8 years, 9 months 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
OLDNEW
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"
11 #include "chrome/browser/password_manager/password_form_data.h" 11 #include "chrome/browser/password_manager/password_form_data.h"
12 #include "chrome/browser/password_manager/password_store.h" 12 #include "chrome/browser/password_manager/password_store.h"
13 #include "chrome/browser/password_manager/password_store_consumer.h" 13 #include "chrome/browser/password_manager/password_store_consumer.h"
14 #include "chrome/browser/password_manager/password_store_factory.h"
14 #include "chrome/browser/sync/profile_sync_service.h" 15 #include "chrome/browser/sync/profile_sync_service.h"
15 #include "chrome/browser/sync/profile_sync_service_factory.h" 16 #include "chrome/browser/sync/profile_sync_service_factory.h"
16 #include "chrome/browser/sync/profile_sync_service_harness.h" 17 #include "chrome/browser/sync/profile_sync_service_harness.h"
17 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" 18 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
18 #include "chrome/test/base/ui_test_utils.h" 19 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 21
21 using webkit::forms::PasswordForm; 22 using webkit::forms::PasswordForm;
22 using sync_datatype_helper::test; 23 using sync_datatype_helper::test;
23 24
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 110
110 void SetPassphrase(int index, const std::string& passphrase) { 111 void SetPassphrase(int index, const std::string& passphrase) {
111 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 112 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
112 test()->GetProfile(index))->SetPassphrase( 113 test()->GetProfile(index))->SetPassphrase(
113 passphrase, 114 passphrase,
114 ProfileSyncService::EXPLICIT, 115 ProfileSyncService::EXPLICIT,
115 ProfileSyncService::USER_PROVIDED); 116 ProfileSyncService::USER_PROVIDED);
116 } 117 }
117 118
118 PasswordStore* GetPasswordStore(int index) { 119 PasswordStore* GetPasswordStore(int index) {
119 return test()->GetProfile(index)->GetPasswordStore(Profile::IMPLICIT_ACCESS); 120 return PasswordStoreFactory::GetForProfile(test()->GetProfile(index),
121 Profile::IMPLICIT_ACCESS);
120 } 122 }
121 123
122 PasswordStore* GetVerifierPasswordStore() { 124 PasswordStore* GetVerifierPasswordStore() {
123 return test()->verifier()->GetPasswordStore(Profile::IMPLICIT_ACCESS); 125 return PasswordStoreFactory::GetForProfile(test()->verifier(),
126 Profile::IMPLICIT_ACCESS);
124 } 127 }
125 128
126 bool ProfileContainsSamePasswordFormsAsVerifier(int index) { 129 bool ProfileContainsSamePasswordFormsAsVerifier(int index) {
127 std::vector<PasswordForm> verifier_forms; 130 std::vector<PasswordForm> verifier_forms;
128 std::vector<PasswordForm> forms; 131 std::vector<PasswordForm> forms;
129 GetLogins(GetVerifierPasswordStore(), verifier_forms); 132 GetLogins(GetVerifierPasswordStore(), verifier_forms);
130 GetLogins(GetPasswordStore(index), forms); 133 GetLogins(GetPasswordStore(index), forms);
131 bool result = ContainsSamePasswordForms(verifier_forms, forms); 134 bool result = ContainsSamePasswordForms(verifier_forms, forms);
132 if (!result) { 135 if (!result) {
133 LOG(ERROR) << "Password forms in Verifier Profile:"; 136 LOG(ERROR) << "Password forms in Verifier Profile:";
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 PasswordForm form; 206 PasswordForm form;
204 form.signon_realm = kFakeSignonRealm; 207 form.signon_realm = kFakeSignonRealm;
205 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index)); 208 form.origin = GURL(base::StringPrintf(kIndexedFakeOrigin, index));
206 form.username_value = ASCIIToUTF16(base::StringPrintf("username%d", index)); 209 form.username_value = ASCIIToUTF16(base::StringPrintf("username%d", index));
207 form.password_value = ASCIIToUTF16(base::StringPrintf("password%d", index)); 210 form.password_value = ASCIIToUTF16(base::StringPrintf("password%d", index));
208 form.date_created = base::Time::Now(); 211 form.date_created = base::Time::Now();
209 return form; 212 return form;
210 } 213 }
211 214
212 } // namespace passwords_helper 215 } // namespace passwords_helper
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_typed_url_unittest.cc ('k') | chrome/browser/sync/test_profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698