OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/password_manager/core/browser/password_syncable_service.h" | 5 #include "components/password_manager/core/browser/password_syncable_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 PasswordSyncableServiceWrapper() { | 304 PasswordSyncableServiceWrapper() { |
305 password_store_ = new MockPasswordStore; | 305 password_store_ = new MockPasswordStore; |
306 service_.reset(new MockPasswordSyncableService( | 306 service_.reset(new MockPasswordSyncableService( |
307 password_store_->GetSyncInterface())); | 307 password_store_->GetSyncInterface())); |
308 } | 308 } |
309 | 309 |
310 ~PasswordSyncableServiceWrapper() { | 310 ~PasswordSyncableServiceWrapper() { |
311 password_store_->Shutdown(); | 311 password_store_->Shutdown(); |
312 } | 312 } |
313 | 313 |
314 MockPasswordStore* password_store() { | 314 MockPasswordStore* password_store() { return password_store_.get(); } |
315 return password_store_; | |
316 } | |
317 | 315 |
318 MockPasswordSyncableService* service() { | 316 MockPasswordSyncableService* service() { |
319 return service_.get(); | 317 return service_.get(); |
320 } | 318 } |
321 | 319 |
322 // Returnes the scoped_ptr to |service_| thus NULLing out it. | 320 // Returnes the scoped_ptr to |service_| thus NULLing out it. |
323 scoped_ptr<syncer::SyncChangeProcessor> ReleaseSyncableService() { | 321 scoped_ptr<syncer::SyncChangeProcessor> ReleaseSyncableService() { |
324 return service_.PassAs<syncer::SyncChangeProcessor>(); | 322 return service_.PassAs<syncer::SyncChangeProcessor>(); |
325 } | 323 } |
326 | 324 |
327 PasswordStoreDataVerifier* verifier() { | 325 PasswordStoreDataVerifier* verifier() { |
328 return &verifier_; | 326 return &verifier_; |
329 } | 327 } |
330 | 328 |
331 scoped_ptr<syncer::SyncChangeProcessor> CreateSyncChangeProcessor() { | 329 scoped_ptr<syncer::SyncChangeProcessor> CreateSyncChangeProcessor() { |
332 return make_scoped_ptr<syncer::SyncChangeProcessor>( | 330 return make_scoped_ptr<syncer::SyncChangeProcessor>( |
333 new PasswordStoreDataVerifier::TestSyncChangeProcessor(verifier())); | 331 new PasswordStoreDataVerifier::TestSyncChangeProcessor(verifier())); |
334 } | 332 } |
335 | 333 |
336 // Sets the data that will be returned to the caller accessing password store. | 334 // Sets the data that will be returned to the caller accessing password store. |
337 void SetPasswordStoreData( | 335 void SetPasswordStoreData( |
338 const std::vector<autofill::PasswordForm*>& forms, | 336 const std::vector<autofill::PasswordForm*>& forms, |
339 const std::vector<autofill::PasswordForm*>& blacklist_forms) { | 337 const std::vector<autofill::PasswordForm*>& blacklist_forms) { |
340 EXPECT_CALL(*password_store_, FillAutofillableLogins(_)) | 338 EXPECT_CALL(*password_store_.get(), FillAutofillableLogins(_)) |
341 .WillOnce(Invoke(AppendVector(forms))) | 339 .WillOnce(Invoke(AppendVector(forms))) |
342 .RetiresOnSaturation(); | 340 .RetiresOnSaturation(); |
343 EXPECT_CALL(*password_store_, FillBlacklistLogins(_)) | 341 EXPECT_CALL(*password_store_.get(), FillBlacklistLogins(_)) |
344 .WillOnce(Invoke(AppendVector(blacklist_forms))) | 342 .WillOnce(Invoke(AppendVector(blacklist_forms))) |
345 .RetiresOnSaturation(); | 343 .RetiresOnSaturation(); |
346 } | 344 } |
347 | 345 |
348 protected: | 346 protected: |
349 scoped_refptr<MockPasswordStore> password_store_; | 347 scoped_refptr<MockPasswordStore> password_store_; |
350 scoped_ptr<MockPasswordSyncableService> service_; | 348 scoped_ptr<MockPasswordSyncableService> service_; |
351 PasswordStoreDataVerifier verifier_; | 349 PasswordStoreDataVerifier verifier_; |
352 | 350 |
353 private: | 351 private: |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 service()->InjectStartSyncFlare( | 659 service()->InjectStartSyncFlare( |
662 base::Bind(&MockPasswordSyncableService::StartSyncFlare, | 660 base::Bind(&MockPasswordSyncableService::StartSyncFlare, |
663 base::Unretained(service()))); | 661 base::Unretained(service()))); |
664 EXPECT_CALL(*service(), StartSyncFlare(syncer::PASSWORDS)); | 662 EXPECT_CALL(*service(), StartSyncFlare(syncer::PASSWORDS)); |
665 service()->ActOnPasswordStoreChanges(list); | 663 service()->ActOnPasswordStoreChanges(list); |
666 } | 664 } |
667 | 665 |
668 } // namespace | 666 } // namespace |
669 | 667 |
670 } // namespace password_manager | 668 } // namespace password_manager |
OLD | NEW |