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 "chrome/browser/password_manager/save_password_infobar_delegate.h" | 5 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 ChromeRenderViewHostTestHarness::SetUp(); | 121 ChromeRenderViewHostTestHarness::SetUp(); |
122 } | 122 } |
123 | 123 |
124 void SavePasswordInfoBarDelegateTest::TearDown() { | 124 void SavePasswordInfoBarDelegateTest::TearDown() { |
125 ChromeRenderViewHostTestHarness::TearDown(); | 125 ChromeRenderViewHostTestHarness::TearDown(); |
126 } | 126 } |
127 | 127 |
128 TEST_F(SavePasswordInfoBarDelegateTest, CancelTestCredentialSourceAPI) { | 128 TEST_F(SavePasswordInfoBarDelegateTest, CancelTestCredentialSourceAPI) { |
129 scoped_ptr<MockPasswordFormManager> password_form_manager( | 129 scoped_ptr<MockPasswordFormManager> password_form_manager( |
130 CreateMockFormManager()); | 130 CreateMockFormManager()); |
131 EXPECT_CALL(*password_form_manager.get(), PermanentlyBlacklist()) | 131 EXPECT_CALL(*password_form_manager.get(), PermanentlyBlacklist()); |
132 .Times(testing::Exactly(0)); | |
133 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( | 132 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( |
134 password_form_manager.Pass(), | 133 password_form_manager.Pass(), |
135 password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API, false)); | 134 password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API, false)); |
136 EXPECT_TRUE(infobar->Cancel()); | 135 EXPECT_TRUE(infobar->Cancel()); |
137 } | 136 } |
138 | 137 |
139 TEST_F(SavePasswordInfoBarDelegateTest, | 138 TEST_F(SavePasswordInfoBarDelegateTest, |
140 CancelTestCredentialSourcePasswordManager) { | 139 CancelTestCredentialSourcePasswordManager) { |
141 scoped_ptr<MockPasswordFormManager> password_form_manager( | 140 scoped_ptr<MockPasswordFormManager> password_form_manager( |
142 CreateMockFormManager()); | 141 CreateMockFormManager()); |
143 EXPECT_CALL(*password_form_manager.get(), PermanentlyBlacklist()) | 142 EXPECT_CALL(*password_form_manager.get(), PermanentlyBlacklist()); |
144 .Times(testing::Exactly(1)); | |
145 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( | 143 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( |
146 password_form_manager.Pass(), password_manager::CredentialSourceType:: | 144 password_form_manager.Pass(), password_manager::CredentialSourceType:: |
147 CREDENTIAL_SOURCE_PASSWORD_MANAGER, | 145 CREDENTIAL_SOURCE_PASSWORD_MANAGER, |
148 false)); | 146 false)); |
149 EXPECT_TRUE(infobar->Cancel()); | 147 EXPECT_TRUE(infobar->Cancel()); |
150 } | 148 } |
151 | 149 |
152 TEST_F(SavePasswordInfoBarDelegateTest, | 150 TEST_F(SavePasswordInfoBarDelegateTest, |
153 CheckResetOfPrefAfterFirstRunMessageWasShown) { | 151 CheckResetOfPrefAfterFirstRunMessageWasShown) { |
154 using password_manager::CredentialSourceType; | 152 using password_manager::CredentialSourceType; |
(...skipping 20 matching lines...) Expand all Loading... |
175 CreateMockFormManager()); | 173 CreateMockFormManager()); |
176 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( | 174 scoped_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate( |
177 password_form_manager.Pass(), password_manager::CredentialSourceType:: | 175 password_form_manager.Pass(), password_manager::CredentialSourceType:: |
178 CREDENTIAL_SOURCE_PASSWORD_MANAGER, | 176 CREDENTIAL_SOURCE_PASSWORD_MANAGER, |
179 false)); | 177 false)); |
180 EXPECT_TRUE(infobar->Cancel()); | 178 EXPECT_TRUE(infobar->Cancel()); |
181 infobar.reset(); | 179 infobar.reset(); |
182 EXPECT_FALSE(prefs()->GetBoolean( | 180 EXPECT_FALSE(prefs()->GetBoolean( |
183 password_manager::prefs::kWasSavePrompFirstRunExperienceShown)); | 181 password_manager::prefs::kWasSavePrompFirstRunExperienceShown)); |
184 } | 182 } |
OLD | NEW |