| 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 // Note: This test focuses on functionality implemented in AffiliationService | 5 // Note: This test focuses on functionality implemented in AffiliationService |
| 6 // itself. More thorough The AffiliationBackend is tested in-depth separarately. | 6 // itself. More thorough The AffiliationBackend is tested in-depth separarately. |
| 7 | 7 |
| 8 #include "components/password_manager/core/browser/affiliation_service.h" | 8 #include "components/password_manager/core/browser/affiliation_service.h" |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ScopedFakeAffiliationAPI* fake_affiliation_api() { | 63 ScopedFakeAffiliationAPI* fake_affiliation_api() { |
| 64 return &fake_affiliation_api_; | 64 return &fake_affiliation_api_; |
| 65 } | 65 } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 // testing::Test: | 68 // testing::Test: |
| 69 void SetUp() override { | 69 void SetUp() override { |
| 70 base::FilePath database_path; | 70 base::FilePath database_path; |
| 71 ASSERT_TRUE(CreateTemporaryFile(&database_path)); | 71 ASSERT_TRUE(CreateTemporaryFile(&database_path)); |
| 72 service_.reset(new AffiliationService(background_task_runner())); | 72 service_.reset(new AffiliationService(background_task_runner())); |
| 73 service_->Initialize(NULL, database_path); | 73 service_->Initialize(nullptr, database_path); |
| 74 // Note: the background task runner is purposely not pumped here, so that | 74 // Note: the background task runner is purposely not pumped here, so that |
| 75 // the tests also verify that the service can be used synchronously right | 75 // the tests also verify that the service can be used synchronously right |
| 76 // away after having been constructed. | 76 // away after having been constructed. |
| 77 fake_affiliation_api_.AddTestEquivalenceClass( | 77 fake_affiliation_api_.AddTestEquivalenceClass( |
| 78 GetTestEquivalenceClassAlpha()); | 78 GetTestEquivalenceClassAlpha()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void TearDown() override { | 81 void TearDown() override { |
| 82 // The service uses DeleteSoon to asynchronously destroy its backend. Pump | 82 // The service uses DeleteSoon to asynchronously destroy its backend. Pump |
| 83 // the background thread to make sure destruction actually takes place. | 83 // the background thread to make sure destruction actually takes place. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 background_task_runner()->RunUntilIdle(); | 145 background_task_runner()->RunUntilIdle(); |
| 146 ASSERT_TRUE(fake_affiliation_api()->HasPendingRequest()); | 146 ASSERT_TRUE(fake_affiliation_api()->HasPendingRequest()); |
| 147 fake_affiliation_api()->IgnoreNextRequest(); | 147 fake_affiliation_api()->IgnoreNextRequest(); |
| 148 | 148 |
| 149 mock_consumer()->ExpectFailure(); | 149 mock_consumer()->ExpectFailure(); |
| 150 main_task_runner()->RunUntilIdle(); | 150 main_task_runner()->RunUntilIdle(); |
| 151 testing::Mock::VerifyAndClearExpectations(mock_consumer()); | 151 testing::Mock::VerifyAndClearExpectations(mock_consumer()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace password_manager | 154 } // namespace password_manager |
| OLD | NEW |