| 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 <Carbon/Carbon.h> |
| 10 |
| 9 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 11 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 16 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 15 #import "chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.h" | 17 #import "chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.h" |
| 16 #import "chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.h" | 18 #import "chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.h" |
| 17 #import "chrome/browser/ui/cocoa/passwords/credential_item_button.h" | 19 #import "chrome/browser/ui/cocoa/passwords/credential_item_button.h" |
| 18 #include "chrome/browser/ui/passwords/password_dialog_controller.h" | 20 #include "chrome/browser/ui/passwords/password_dialog_controller.h" |
| 19 #include "components/autofill/core/common/password_form.h" | 21 #include "components/autofill/core/common/password_form.h" |
| 20 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include "testing/gtest_mac.h" | 24 #include "testing/gtest_mac.h" |
| 25 #import "ui/events/test/cocoa_test_event_utils.h" |
| 23 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 24 #include "url/origin.h" | 27 #include "url/origin.h" |
| 25 | 28 |
| 26 @interface AccountAvatarFetcherTestManager : AccountAvatarFetcherManager { | 29 @interface AccountAvatarFetcherTestManager : AccountAvatarFetcherManager { |
| 27 std::vector<GURL> fetchedAvatars_; | 30 std::vector<GURL> fetchedAvatars_; |
| 28 } | 31 } |
| 29 @property(nonatomic, readonly) const std::vector<GURL>& fetchedAvatars; | 32 @property(nonatomic, readonly) const std::vector<GURL>& fetchedAvatars; |
| 30 @end | 33 @end |
| 31 | 34 |
| 32 @implementation AccountAvatarFetcherTestManager | 35 @implementation AccountAvatarFetcherTestManager |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 PasswordDialogController::FormsVector local_forms; | 227 PasswordDialogController::FormsVector local_forms; |
| 225 local_forms.push_back(Credential("pizza")); | 228 local_forms.push_back(Credential("pizza")); |
| 226 SetUpAccountChooser(&local_forms); | 229 SetUpAccountChooser(&local_forms); |
| 227 [view_controller() setBridge:nil]; | 230 [view_controller() setBridge:nil]; |
| 228 [view_controller().titleView clickedOnLink:@"" atIndex:0]; | 231 [view_controller().titleView clickedOnLink:@"" atIndex:0]; |
| 229 [base::mac::ObjCCastStrict<CredentialItemButton>( | 232 [base::mac::ObjCCastStrict<CredentialItemButton>( |
| 230 [view_controller().credentialButtons objectAtIndex:0]) performClick:nil]; | 233 [view_controller().credentialButtons objectAtIndex:0]) performClick:nil]; |
| 231 [view_controller().cancelButton performClick:nil]; | 234 [view_controller().cancelButton performClick:nil]; |
| 232 } | 235 } |
| 233 | 236 |
| 237 TEST_F(AccountChooserViewControllerTest, CloseOnEsc) { |
| 238 PasswordDialogController::FormsVector local_forms; |
| 239 local_forms.push_back(Credential("pizza")); |
| 240 SetUpAccountChooser(&local_forms); |
| 241 EXPECT_CALL(*this, OnPerformClose()); |
| 242 [[view_controller() view] |
| 243 performKeyEquivalent:cocoa_test_event_utils::KeyEventWithKeyCode( |
| 244 kVK_Escape, '\e', NSKeyDown, 0)]; |
| 245 } |
| 246 |
| 234 } // namespace | 247 } // namespace |
| OLD | NEW |