| 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 "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 void SetUp() override { | 104 void SetUp() override { |
| 105 test_web_contents_.reset( | 105 test_web_contents_.reset( |
| 106 content::WebContentsTester::CreateTestWebContents(&profile_, nullptr)); | 106 content::WebContentsTester::CreateTestWebContents(&profile_, nullptr)); |
| 107 mock_delegate_.reset(new testing::StrictMock<PasswordsModelDelegateMock>); | 107 mock_delegate_.reset(new testing::StrictMock<PasswordsModelDelegateMock>); |
| 108 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( | 108 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( |
| 109 profile(), | 109 profile(), |
| 110 password_manager::BuildPasswordStore< | 110 password_manager::BuildPasswordStore< |
| 111 content::BrowserContext, | 111 content::BrowserContext, |
| 112 testing::StrictMock<password_manager::MockPasswordStore>>); | 112 testing::StrictMock<password_manager::MockPasswordStore>>); |
| 113 #if !defined(OS_MACOSX) | |
| 114 // TODO(crbug.com/668155): Remove conditional compilation when | |
| 115 // PasswordReuseDetector initialization will be implemented for Mac. | |
| 116 // The call of FillAutofillableLogins is caused by a posted task for an | |
| 117 // initialization of PasswordReuseDetector in the call of | |
| 118 // BuildPasswordStore() in the previous code. There is no thread race since | |
| 119 // unit tests run in one thread, and any post task will be executed after | |
| 120 // finishing the current function. | |
| 121 EXPECT_CALL(*GetStore(), FillAutofillableLogins(_)); | 113 EXPECT_CALL(*GetStore(), FillAutofillableLogins(_)); |
| 122 #endif | |
| 123 } | 114 } |
| 124 | 115 |
| 125 void TearDown() override { | 116 void TearDown() override { |
| 126 // Reset the delegate first. It can happen if the user closes the tab. | 117 // Reset the delegate first. It can happen if the user closes the tab. |
| 127 mock_delegate_.reset(); | 118 mock_delegate_.reset(); |
| 128 model_.reset(); | 119 model_.reset(); |
| 129 } | 120 } |
| 130 | 121 |
| 131 PrefService* prefs() { return profile_.GetPrefs(); } | 122 PrefService* prefs() { return profile_.GetPrefs(); } |
| 132 | 123 |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 467 |
| 477 EXPECT_CALL(*controller(), NavigateToPasswordManagerSettingsPage()); | 468 EXPECT_CALL(*controller(), NavigateToPasswordManagerSettingsPage()); |
| 478 | 469 |
| 479 model()->OnManageLinkClicked(); | 470 model()->OnManageLinkClicked(); |
| 480 } | 471 } |
| 481 | 472 |
| 482 INSTANTIATE_TEST_CASE_P(Default, | 473 INSTANTIATE_TEST_CASE_P(Default, |
| 483 ManagePasswordsBubbleModelManageLinkTest, | 474 ManagePasswordsBubbleModelManageLinkTest, |
| 484 ::testing::Values(TestSyncService::SyncedTypes::ALL, | 475 ::testing::Values(TestSyncService::SyncedTypes::ALL, |
| 485 TestSyncService::SyncedTypes::NONE)); | 476 TestSyncService::SyncedTypes::NONE)); |
| OLD | NEW |