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/cocoa/passwords/passwords_bubble_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 content::WebContents* CreateWebContents() { | 61 content::WebContents* CreateWebContents() { |
62 return content::WebContentsTester::CreateTestWebContents( | 62 return content::WebContentsTester::CreateTestWebContents( |
63 profile(), siteInstance_.get()); | 63 profile(), siteInstance_.get()); |
64 } | 64 } |
65 | 65 |
66 void ShowBubble(bool user_action) { | 66 void ShowBubble(bool user_action) { |
67 ManagePasswordsUIControllerMock* mock = UIController(); | 67 ManagePasswordsUIControllerMock* mock = UIController(); |
68 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(mock)); | 68 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(mock)); |
69 autofill::PasswordForm form; | 69 autofill::PasswordForm form; |
70 EXPECT_CALL(*mock, GetPendingPassword()).WillOnce(ReturnRef(form)); | 70 EXPECT_CALL(*mock, GetPendingPassword()).WillOnce(ReturnRef(form)); |
71 std::vector<const autofill::PasswordForm*> forms; | |
72 EXPECT_CALL(*mock, GetCurrentForms()).WillOnce(ReturnRef(forms)); | |
73 GURL origin; | 71 GURL origin; |
74 EXPECT_CALL(*mock, GetOrigin()).WillOnce(ReturnRef(origin)); | 72 EXPECT_CALL(*mock, GetOrigin()).WillOnce(ReturnRef(origin)); |
75 EXPECT_CALL(*mock, GetState()) | 73 EXPECT_CALL(*mock, GetState()) |
76 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_STATE)); | 74 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_STATE)); |
77 | 75 |
78 TabDialogs::FromWebContents(test_web_contents_) | 76 TabDialogs::FromWebContents(test_web_contents_) |
79 ->ShowManagePasswordsBubble(user_action); | 77 ->ShowManagePasswordsBubble(user_action); |
80 if (ManagePasswordsBubbleCocoa::instance()) { | 78 if (ManagePasswordsBubbleCocoa::instance()) { |
81 // Disable animations so that closing happens immediately. | 79 // Disable animations so that closing happens immediately. |
82 InfoBubbleWindow* bubbleWindow = base::mac::ObjCCast<InfoBubbleWindow>( | 80 InfoBubbleWindow* bubbleWindow = base::mac::ObjCCast<InfoBubbleWindow>( |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 EXPECT_FALSE([controller() shouldOpenAsKeyWindow]); | 192 EXPECT_FALSE([controller() shouldOpenAsKeyWindow]); |
195 EXPECT_FALSE([bubbleWindow() defaultButtonCell]); | 193 EXPECT_FALSE([bubbleWindow() defaultButtonCell]); |
196 } | 194 } |
197 | 195 |
198 TEST_F(ManagePasswordsBubbleCocoaTest, OpenWithFocus) { | 196 TEST_F(ManagePasswordsBubbleCocoaTest, OpenWithFocus) { |
199 ShowBubble(true); | 197 ShowBubble(true); |
200 EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance()); | 198 EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance()); |
201 EXPECT_TRUE([controller() shouldOpenAsKeyWindow]); | 199 EXPECT_TRUE([controller() shouldOpenAsKeyWindow]); |
202 EXPECT_TRUE([bubbleWindow() defaultButtonCell]); | 200 EXPECT_TRUE([bubbleWindow() defaultButtonCell]); |
203 } | 201 } |
OLD | NEW |