| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/affiliated_match_helper.h" | 5 #include "components/password_manager/core/browser/affiliated_match_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 13 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/test/test_simple_task_runner.h" | 16 #include "base/test/test_simple_task_runner.h" |
| 16 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
| 17 #include "components/password_manager/core/browser/affiliation_service.h" | 18 #include "components/password_manager/core/browser/affiliation_service.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } | 286 } |
| 286 | 287 |
| 287 // testing::Test: | 288 // testing::Test: |
| 288 void SetUp() override { | 289 void SetUp() override { |
| 289 scoped_ptr<MockAffiliationService> service(new MockAffiliationService()); | 290 scoped_ptr<MockAffiliationService> service(new MockAffiliationService()); |
| 290 mock_affiliation_service_ = service.get(); | 291 mock_affiliation_service_ = service.get(); |
| 291 | 292 |
| 292 password_store_ = new TestPasswordStore; | 293 password_store_ = new TestPasswordStore; |
| 293 | 294 |
| 294 match_helper_.reset( | 295 match_helper_.reset( |
| 295 new AffiliatedMatchHelper(password_store_.get(), service.Pass())); | 296 new AffiliatedMatchHelper(password_store_.get(), std::move(service))); |
| 296 match_helper_->SetTaskRunnerUsedForWaitingForTesting(waiting_task_runner_); | 297 match_helper_->SetTaskRunnerUsedForWaitingForTesting(waiting_task_runner_); |
| 297 } | 298 } |
| 298 | 299 |
| 299 void TearDown() override { | 300 void TearDown() override { |
| 300 match_helper_.reset(); | 301 match_helper_.reset(); |
| 301 password_store_->ShutdownOnUIThread(); | 302 password_store_->ShutdownOnUIThread(); |
| 302 password_store_ = nullptr; | 303 password_store_ = nullptr; |
| 303 } | 304 } |
| 304 | 305 |
| 305 scoped_refptr<base::TestSimpleTaskRunner> waiting_task_runner_; | 306 scoped_refptr<base::TestSimpleTaskRunner> waiting_task_runner_; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 560 } |
| 560 | 561 |
| 561 TEST_F(AffiliatedMatchHelperTest, DestroyBeforeDeferredInitialization) { | 562 TEST_F(AffiliatedMatchHelperTest, DestroyBeforeDeferredInitialization) { |
| 562 match_helper()->Initialize(); | 563 match_helper()->Initialize(); |
| 563 base::RunLoop().RunUntilIdle(); | 564 base::RunLoop().RunUntilIdle(); |
| 564 DestroyMatchHelper(); | 565 DestroyMatchHelper(); |
| 565 ASSERT_NO_FATAL_FAILURE(RunDeferredInitialization()); | 566 ASSERT_NO_FATAL_FAILURE(RunDeferredInitialization()); |
| 566 } | 567 } |
| 567 | 568 |
| 568 } // namespace password_manager | 569 } // namespace password_manager |
| OLD | NEW |