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

Side by Side Diff: chrome/browser/ui/passwords/password_manager_presenter_unittest.cc

Issue 1846623002: Remove password-manager-reauthentication flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just rebased Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/passwords/password_manager_presenter.h" 5 #include "chrome/browser/ui/passwords/password_manager_presenter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 18 matching lines...) Expand all
29 : profile_(profile), password_manager_presenter_(this) { 29 : profile_(profile), password_manager_presenter_(this) {
30 password_manager_presenter_.Initialize(); 30 password_manager_presenter_.Initialize();
31 } 31 }
32 ~MockPasswordUIView() override {} 32 ~MockPasswordUIView() override {}
33 Profile* GetProfile() override; 33 Profile* GetProfile() override;
34 #if !defined(OS_ANDROID) 34 #if !defined(OS_ANDROID)
35 gfx::NativeWindow GetNativeWindow() const override; 35 gfx::NativeWindow GetNativeWindow() const override;
36 #endif 36 #endif
37 MOCK_METHOD4(ShowPassword, void( 37 MOCK_METHOD4(ShowPassword, void(
38 size_t, const std::string&, const std::string&, const base::string16&)); 38 size_t, const std::string&, const std::string&, const base::string16&));
39 MOCK_METHOD2(SetPasswordList, 39 MOCK_METHOD1(SetPasswordList,
40 void(const std::vector<scoped_ptr<autofill::PasswordForm>>&, 40 void(const std::vector<scoped_ptr<autofill::PasswordForm>>&));
41 bool));
42 MOCK_METHOD1(SetPasswordExceptionList, 41 MOCK_METHOD1(SetPasswordExceptionList,
43 void(const std::vector<scoped_ptr<autofill::PasswordForm>>&)); 42 void(const std::vector<scoped_ptr<autofill::PasswordForm>>&));
44 PasswordManagerPresenter* GetPasswordManagerPresenter() { 43 PasswordManagerPresenter* GetPasswordManagerPresenter() {
45 return &password_manager_presenter_; 44 return &password_manager_presenter_;
46 } 45 }
47 46
48 private: 47 private:
49 Profile* profile_; 48 Profile* profile_;
50 PasswordManagerPresenter password_manager_presenter_; 49 PasswordManagerPresenter password_manager_presenter_;
51 50
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 void PasswordManagerPresenterTest::UpdateLists() { 107 void PasswordManagerPresenterTest::UpdateLists() {
109 mock_controller_->GetPasswordManagerPresenter()->SetPasswordList(); 108 mock_controller_->GetPasswordManagerPresenter()->SetPasswordList();
110 mock_controller_->GetPasswordManagerPresenter()->SetPasswordExceptionList(); 109 mock_controller_->GetPasswordManagerPresenter()->SetPasswordExceptionList();
111 } 110 }
112 111
113 namespace { 112 namespace {
114 113
115 TEST_F(PasswordManagerPresenterTest, UIControllerIsCalled) { 114 TEST_F(PasswordManagerPresenterTest, UIControllerIsCalled) {
116 EXPECT_CALL( 115 EXPECT_CALL(
117 *GetUIController(), 116 *GetUIController(),
118 SetPasswordList( 117 SetPasswordList(Property(
119 Property(&std::vector<scoped_ptr<autofill::PasswordForm>>::size, 118 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u))));
120 Eq(0u)),
121 testing::_));
122 EXPECT_CALL( 119 EXPECT_CALL(
123 *GetUIController(), 120 *GetUIController(),
124 SetPasswordExceptionList(Property( 121 SetPasswordExceptionList(Property(
125 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u)))); 122 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u))));
126 UpdateLists(); 123 UpdateLists();
127 GURL pass_origin("http://abc1.com"); 124 GURL pass_origin("http://abc1.com");
128 AddPasswordEntry(pass_origin, "test@gmail.com", "test"); 125 AddPasswordEntry(pass_origin, "test@gmail.com", "test");
129 EXPECT_CALL( 126 EXPECT_CALL(
130 *GetUIController(), 127 *GetUIController(),
131 SetPasswordList( 128 SetPasswordList(Property(
132 Property(&std::vector<scoped_ptr<autofill::PasswordForm>>::size, 129 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
133 Eq(1u)),
134 testing::_));
135 EXPECT_CALL( 130 EXPECT_CALL(
136 *GetUIController(), 131 *GetUIController(),
137 SetPasswordExceptionList(Property( 132 SetPasswordExceptionList(Property(
138 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u)))); 133 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(0u))));
139 UpdateLists(); 134 UpdateLists();
140 GURL except_origin("http://abc2.com"); 135 GURL except_origin("http://abc2.com");
141 AddPasswordException(except_origin); 136 AddPasswordException(except_origin);
142 EXPECT_CALL( 137 EXPECT_CALL(
143 *GetUIController(), 138 *GetUIController(),
144 SetPasswordList( 139 SetPasswordList(Property(
145 Property(&std::vector<scoped_ptr<autofill::PasswordForm>>::size, 140 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
146 Eq(1u)),
147 testing::_));
148 EXPECT_CALL( 141 EXPECT_CALL(
149 *GetUIController(), 142 *GetUIController(),
150 SetPasswordExceptionList(Property( 143 SetPasswordExceptionList(Property(
151 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u)))); 144 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
152 UpdateLists(); 145 UpdateLists();
153 GURL pass_origin2("http://example.com"); 146 GURL pass_origin2("http://example.com");
154 AddPasswordEntry(pass_origin2, "test@gmail.com", "test"); 147 AddPasswordEntry(pass_origin2, "test@gmail.com", "test");
155 EXPECT_CALL( 148 EXPECT_CALL(
156 *GetUIController(), 149 *GetUIController(),
157 SetPasswordList( 150 SetPasswordList(Property(
158 Property(&std::vector<scoped_ptr<autofill::PasswordForm>>::size, 151 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(2u))));
159 Eq(2u)),
160 testing::_));
161 EXPECT_CALL( 152 EXPECT_CALL(
162 *GetUIController(), 153 *GetUIController(),
163 SetPasswordExceptionList(Property( 154 SetPasswordExceptionList(Property(
164 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u)))); 155 &std::vector<scoped_ptr<autofill::PasswordForm>>::size, Eq(1u))));
165 UpdateLists(); 156 UpdateLists();
166 } 157 }
167 158
168 } // namespace 159 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698