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 #import "chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.h" | 5 #import "chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 TEST_F(AccountChooserViewControllerTest, ClickTitleLink) { | 205 TEST_F(AccountChooserViewControllerTest, ClickTitleLink) { |
206 PasswordDialogController::FormsVector local_forms; | 206 PasswordDialogController::FormsVector local_forms; |
207 local_forms.push_back(Credential("pizza")); | 207 local_forms.push_back(Credential("pizza")); |
208 SetUpAccountChooser(std::move(local_forms), | 208 SetUpAccountChooser(std::move(local_forms), |
209 PasswordDialogController::FormsVector()); | 209 PasswordDialogController::FormsVector()); |
210 EXPECT_CALL(dialog_controller(), OnSmartLockLinkClicked()); | 210 EXPECT_CALL(dialog_controller(), OnSmartLockLinkClicked()); |
211 [view_controller().titleView clickedOnLink:@"" | 211 [view_controller().titleView clickedOnLink:@"" |
212 atIndex:0]; | 212 atIndex:0]; |
213 } | 213 } |
214 | 214 |
| 215 TEST_F(AccountChooserViewControllerTest, ClosePromptAndHandleClick) { |
| 216 // A user may press mouse down, some navigation closes the dialog, mouse up |
| 217 // still sends the action. The view should not crash. |
| 218 PasswordDialogController::FormsVector local_forms; |
| 219 local_forms.push_back(Credential("pizza")); |
| 220 SetUpAccountChooser(std::move(local_forms), |
| 221 PasswordDialogController::FormsVector()); |
| 222 [view_controller() setBridge:nil]; |
| 223 [view_controller().titleView clickedOnLink:@"" atIndex:0]; |
| 224 [view_controller().credentialsView |
| 225 selectRowIndexes:[NSIndexSet indexSetWithIndex:0] |
| 226 byExtendingSelection:NO]; |
| 227 [view_controller().cancelButton performClick:nil]; |
| 228 } |
| 229 |
215 } // namespace | 230 } // namespace |
OLD | NEW |