| 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; | 71 std::vector<std::unique_ptr<autofill::PasswordForm>> forms; |
| 72 EXPECT_CALL(*mock, GetCurrentForms()).WillOnce(ReturnRef(forms)); | 72 EXPECT_CALL(*mock, GetCurrentForms()).WillOnce(ReturnRef(forms)); |
| 73 GURL origin; | 73 GURL origin; |
| 74 EXPECT_CALL(*mock, GetOrigin()).WillOnce(ReturnRef(origin)); | 74 EXPECT_CALL(*mock, GetOrigin()).WillOnce(ReturnRef(origin)); |
| 75 EXPECT_CALL(*mock, GetState()) | 75 EXPECT_CALL(*mock, GetState()) |
| 76 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_STATE)); | 76 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_STATE)); |
| 77 | 77 |
| 78 TabDialogs::FromWebContents(test_web_contents_) | 78 TabDialogs::FromWebContents(test_web_contents_) |
| 79 ->ShowManagePasswordsBubble(user_action); | 79 ->ShowManagePasswordsBubble(user_action); |
| 80 if (ManagePasswordsBubbleCocoa::instance()) { | 80 if (ManagePasswordsBubbleCocoa::instance()) { |
| 81 // Disable animations so that closing happens immediately. | 81 // Disable animations so that closing happens immediately. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 EXPECT_FALSE([controller() shouldOpenAsKeyWindow]); | 194 EXPECT_FALSE([controller() shouldOpenAsKeyWindow]); |
| 195 EXPECT_FALSE([bubbleWindow() defaultButtonCell]); | 195 EXPECT_FALSE([bubbleWindow() defaultButtonCell]); |
| 196 } | 196 } |
| 197 | 197 |
| 198 TEST_F(ManagePasswordsBubbleCocoaTest, OpenWithFocus) { | 198 TEST_F(ManagePasswordsBubbleCocoaTest, OpenWithFocus) { |
| 199 ShowBubble(true); | 199 ShowBubble(true); |
| 200 EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance()); | 200 EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance()); |
| 201 EXPECT_TRUE([controller() shouldOpenAsKeyWindow]); | 201 EXPECT_TRUE([controller() shouldOpenAsKeyWindow]); |
| 202 EXPECT_TRUE([bubbleWindow() defaultButtonCell]); | 202 EXPECT_TRUE([bubbleWindow() defaultButtonCell]); |
| 203 } | 203 } |
| OLD | NEW |