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/base_passwords_controller_test.h" | 5 #include "chrome/browser/ui/cocoa/passwords/base_passwords_controller_test.h" |
6 | 6 |
7 #include "chrome/browser/password_manager/password_store_factory.h" | 7 #include "chrome/browser/password_manager/password_store_factory.h" |
8 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" | 8 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" |
9 #include "components/password_manager/core/browser/mock_password_store.h" | 9 #include "components/password_manager/core/browser/mock_password_store.h" |
10 #include "components/password_manager/core/browser/password_manager_test_utils.h
" | 10 #include "components/password_manager/core/browser/password_manager_test_utils.h
" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 ManagePasswordsBubbleModel* | 42 ManagePasswordsBubbleModel* |
43 ManagePasswordsControllerTest::GetModelAndCreateIfNull() { | 43 ManagePasswordsControllerTest::GetModelAndCreateIfNull() { |
44 if (!model_) { | 44 if (!model_) { |
45 model_.reset(new ManagePasswordsBubbleModel(test_web_contents_.get(), | 45 model_.reset(new ManagePasswordsBubbleModel(test_web_contents_.get(), |
46 GetDisplayReason())); | 46 GetDisplayReason())); |
47 } | 47 } |
48 return model_.get(); | 48 return model_.get(); |
49 } | 49 } |
50 | 50 |
51 void ManagePasswordsControllerTest::SetUpPendingState() { | 51 void ManagePasswordsControllerTest::SetUpPendingState(bool update) { |
52 autofill::PasswordForm form; | 52 autofill::PasswordForm form; |
53 EXPECT_CALL(*ui_controller_, GetPendingPassword()).WillOnce(ReturnRef(form)); | 53 EXPECT_CALL(*ui_controller_, GetPendingPassword()).WillOnce(ReturnRef(form)); |
54 std::vector<const autofill::PasswordForm*> forms; | 54 std::vector<const autofill::PasswordForm*> forms; |
55 EXPECT_CALL(*ui_controller_, GetCurrentForms()).WillOnce(ReturnRef(forms)); | 55 EXPECT_CALL(*ui_controller_, GetCurrentForms()).WillOnce(ReturnRef(forms)); |
56 GURL origin(kSiteOrigin); | 56 GURL origin(kSiteOrigin); |
57 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin)); | 57 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin)); |
58 EXPECT_CALL(*ui_controller_, GetState()) | 58 EXPECT_CALL(*ui_controller_, GetState()) |
59 .WillOnce(Return(password_manager::ui::PENDING_PASSWORD_STATE)); | 59 .WillOnce(Return(update |
| 60 ? password_manager::ui::PENDING_PASSWORD_UPDATE_STATE |
| 61 : password_manager::ui::PENDING_PASSWORD_STATE)); |
60 GetModelAndCreateIfNull(); | 62 GetModelAndCreateIfNull(); |
61 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_)); | 63 ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(ui_controller_)); |
62 } | 64 } |
63 | 65 |
64 void ManagePasswordsControllerTest::SetUpConfirmationState() { | 66 void ManagePasswordsControllerTest::SetUpConfirmationState() { |
65 GURL origin(kSiteOrigin); | 67 GURL origin(kSiteOrigin); |
66 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin)); | 68 EXPECT_CALL(*ui_controller_, GetOrigin()).WillOnce(ReturnRef(origin)); |
67 EXPECT_CALL(*ui_controller_, GetState()) | 69 EXPECT_CALL(*ui_controller_, GetState()) |
68 .WillOnce(Return(password_manager::ui::CONFIRMATION_STATE)); | 70 .WillOnce(Return(password_manager::ui::CONFIRMATION_STATE)); |
69 GetModelAndCreateIfNull(); | 71 GetModelAndCreateIfNull(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 105 |
104 @implementation ContentViewDelegateMock | 106 @implementation ContentViewDelegateMock |
105 | 107 |
106 @synthesize dismissed = _dismissed; | 108 @synthesize dismissed = _dismissed; |
107 | 109 |
108 - (void)viewShouldDismiss { | 110 - (void)viewShouldDismiss { |
109 _dismissed = YES; | 111 _dismissed = YES; |
110 } | 112 } |
111 | 113 |
112 @end | 114 @end |
OLD | NEW |