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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 void SetUp() override { | 110 void SetUp() override { |
111 test_web_contents_.reset( | 111 test_web_contents_.reset( |
112 content::WebContentsTester::CreateTestWebContents(&profile_, nullptr)); | 112 content::WebContentsTester::CreateTestWebContents(&profile_, nullptr)); |
113 mock_delegate_.reset(new testing::StrictMock<PasswordsModelDelegateMock>); | 113 mock_delegate_.reset(new testing::StrictMock<PasswordsModelDelegateMock>); |
114 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( | 114 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( |
115 profile(), | 115 profile(), |
116 password_manager::BuildPasswordStore< | 116 password_manager::BuildPasswordStore< |
117 content::BrowserContext, | 117 content::BrowserContext, |
118 testing::StrictMock<password_manager::MockPasswordStore>>); | 118 testing::StrictMock<password_manager::MockPasswordStore>>); |
| 119 #if !defined(OS_MACOSX) |
| 120 // TODO(crbug.com/668155): Remove conditional compilation when |
| 121 // PasswordReuseDetector initialization will be implemented for Mac. |
| 122 // The call of FillAutofillableLogins is caused by a posted task for an |
| 123 // initialization of PasswordReuseDetector in the call of |
| 124 // BuildPasswordStore() in the previous code. There is no thread race since |
| 125 // unit tests run in one thread, and any post task will be executed after |
| 126 // finishing the current function. |
| 127 EXPECT_CALL(*GetStore(), FillAutofillableLogins(_)); |
| 128 #endif |
119 } | 129 } |
120 | 130 |
121 void TearDown() override { | 131 void TearDown() override { |
122 // Reset the delegate first. It can happen if the user closes the tab. | 132 // Reset the delegate first. It can happen if the user closes the tab. |
123 mock_delegate_.reset(); | 133 mock_delegate_.reset(); |
124 model_.reset(); | 134 model_.reset(); |
125 variations::testing::ClearAllVariationIDs(); | 135 variations::testing::ClearAllVariationIDs(); |
126 variations::testing::ClearAllVariationParams(); | 136 variations::testing::ClearAllVariationParams(); |
127 } | 137 } |
128 | 138 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 498 |
489 EXPECT_CALL(*controller(), NavigateToPasswordManagerSettingsPage()); | 499 EXPECT_CALL(*controller(), NavigateToPasswordManagerSettingsPage()); |
490 | 500 |
491 model()->OnManageLinkClicked(); | 501 model()->OnManageLinkClicked(); |
492 } | 502 } |
493 | 503 |
494 INSTANTIATE_TEST_CASE_P(Default, | 504 INSTANTIATE_TEST_CASE_P(Default, |
495 ManagePasswordsBubbleModelManageLinkTest, | 505 ManagePasswordsBubbleModelManageLinkTest, |
496 ::testing::Values(TestSyncService::SyncedTypes::ALL, | 506 ::testing::Values(TestSyncService::SyncedTypes::ALL, |
497 TestSyncService::SyncedTypes::NONE)); | 507 TestSyncService::SyncedTypes::NONE)); |
OLD | NEW |