Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: chrome/browser/ui/cocoa/passwords/autosignin_prompt_view_controller_unittest.mm

Issue 1992633003: Add "Sign In" button to the account chooser on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 8
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
12 #import "chrome/browser/ui/cocoa/passwords/autosignin_prompt_view_controller.h" 12 #import "chrome/browser/ui/cocoa/passwords/autosignin_prompt_view_controller.h"
13 #include "chrome/browser/ui/passwords/password_dialog_controller.h" 13 #include "chrome/browser/ui/passwords/password_dialog_controller_mock.h"
14 #include "components/autofill/core/common/password_form.h" 14 #include "components/autofill/core/common/password_form.h"
15 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #import "ui/events/test/cocoa_test_event_utils.h" 17 #import "ui/events/test/cocoa_test_event_utils.h"
18 18
19 19
20 namespace { 20 namespace {
21 21
22 constexpr char kDialogTitle[] = "Auto signin"; 22 constexpr char kDialogTitle[] = "Auto signin";
23 constexpr char kDialogText[] = "bla bla"; 23 constexpr char kDialogText[] = "bla bla";
24 24
25 class PasswordDialogControllerMock : public PasswordDialogController {
26 public:
27 MOCK_CONST_METHOD0(GetLocalForms, const FormsVector&());
28 MOCK_CONST_METHOD0(GetFederationsForms, const FormsVector&());
29 MOCK_CONST_METHOD0(GetAccoutChooserTitle,
30 std::pair<base::string16, gfx::Range>());
31 MOCK_CONST_METHOD0(GetAutoSigninPromoTitle, base::string16());
32 MOCK_CONST_METHOD0(GetAutoSigninText,
33 std::pair<base::string16, gfx::Range>());
34 MOCK_METHOD0(OnSmartLockLinkClicked, void());
35 MOCK_METHOD2(OnChooseCredentials, void(
36 const autofill::PasswordForm& password_form,
37 password_manager::CredentialType credential_type));
38 MOCK_METHOD0(OnAutoSigninOK, void());
39 MOCK_METHOD0(OnAutoSigninTurnOff, void());
40 MOCK_METHOD0(OnCloseDialog, void());
41 };
42
43 // Tests for the autosignin dialog view. 25 // Tests for the autosignin dialog view.
44 class AutoSigninPromptViewControllerTest : public PasswordPromptBridgeInterface, 26 class AutoSigninPromptViewControllerTest : public PasswordPromptBridgeInterface,
45 public CocoaTest { 27 public CocoaTest {
46 public: 28 public:
47 PasswordDialogControllerMock& dialog_controller() { 29 PasswordDialogControllerMock& dialog_controller() {
48 return dialog_controller_; 30 return dialog_controller_;
49 } 31 }
50 32
51 AutoSigninPromptViewController* view_controller() { 33 AutoSigninPromptViewController* view_controller() {
52 return view_controller_.get(); 34 return view_controller_.get();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 107
126 TEST_F(AutoSigninPromptViewControllerTest, CloseOnEsc) { 108 TEST_F(AutoSigninPromptViewControllerTest, CloseOnEsc) {
127 SetUpAutosigninFirstRun(); 109 SetUpAutosigninFirstRun();
128 EXPECT_CALL(*this, OnPerformClose()); 110 EXPECT_CALL(*this, OnPerformClose());
129 [[view_controller() view] 111 [[view_controller() view]
130 performKeyEquivalent:cocoa_test_event_utils::KeyEventWithKeyCode( 112 performKeyEquivalent:cocoa_test_event_utils::KeyEventWithKeyCode(
131 kVK_Escape, '\e', NSKeyDown, 0)]; 113 kVK_Escape, '\e', NSKeyDown, 0)];
132 } 114 }
133 115
134 } // namespace 116 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698