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

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

Issue 2201413002: Show 3 rows in the account chooser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update a unit test Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/manage_passwords_view_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <utility> 7 #include <utility>
8 8
9 #include <Carbon/Carbon.h> 9 #include <Carbon/Carbon.h>
10 10
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 EXPECT_NSEQ(@"pizza", [base::mac::ObjCCastStrict<CredentialItemButton>( 138 EXPECT_NSEQ(@"pizza", [base::mac::ObjCCastStrict<CredentialItemButton>(
139 [buttons objectAtIndex:0]) title]); 139 [buttons objectAtIndex:0]) title]);
140 EXPECT_NSEQ(@"taco", [base::mac::ObjCCastStrict<CredentialItemButton>( 140 EXPECT_NSEQ(@"taco", [base::mac::ObjCCastStrict<CredentialItemButton>(
141 [buttons objectAtIndex:1]) title]); 141 [buttons objectAtIndex:1]) title]);
142 EXPECT_TRUE(avatar_manager().fetchedAvatars.empty()); 142 EXPECT_TRUE(avatar_manager().fetchedAvatars.empty());
143 } 143 }
144 144
145 TEST_F(AccountChooserViewControllerTest, ConfiguresFederatedCredential) { 145 TEST_F(AccountChooserViewControllerTest, ConfiguresFederatedCredential) {
146 const char federation[] = "https://google.com/idp"; 146 const char federation[] = "https://google.com/idp";
147 const char name[] = "Peter the Great"; 147 const char name[] = "Peter the Great";
148 const char username[] = "pete";
149
148 PasswordDialogController::FormsVector local_forms; 150 PasswordDialogController::FormsVector local_forms;
149 local_forms.push_back(Credential("pizza")); 151 local_forms.push_back(Credential(username));
150 local_forms.back()->federation_origin = url::Origin(GURL(federation)); 152 local_forms.back()->federation_origin = url::Origin(GURL(federation));
151 local_forms.back()->display_name = base::ASCIIToUTF16(name); 153 local_forms.back()->display_name = base::ASCIIToUTF16(name);
152 SetUpAccountChooser(&local_forms); 154 SetUpAccountChooser(&local_forms);
153 155
154 NSArray* buttons = view_controller().credentialButtons; 156 NSArray* buttons = view_controller().credentialButtons;
155 ASSERT_NSNE(nil, buttons); 157 ASSERT_NSNE(nil, buttons);
156 ASSERT_EQ(1u, buttons.count); 158 ASSERT_EQ(1u, buttons.count);
157 std::string title = 159 std::string title =
158 base::SysNSStringToUTF8([base::mac::ObjCCastStrict<CredentialItemButton>( 160 base::SysNSStringToUTF8([base::mac::ObjCCastStrict<CredentialItemButton>(
159 [buttons objectAtIndex:0]) title]); 161 [buttons objectAtIndex:0]) title]);
160 EXPECT_THAT(title, testing::HasSubstr(name)); 162 EXPECT_THAT(title, testing::HasSubstr(name));
163 EXPECT_THAT(title, testing::HasSubstr(username));
161 EXPECT_THAT(title, testing::HasSubstr(GURL(federation).host())); 164 EXPECT_THAT(title, testing::HasSubstr(GURL(federation).host()));
162 } 165 }
163 166
164 TEST_F(AccountChooserViewControllerTest, ForwardsAvatarFetchToManager) { 167 TEST_F(AccountChooserViewControllerTest, ForwardsAvatarFetchToManager) {
165 PasswordDialogController::FormsVector local_forms; 168 PasswordDialogController::FormsVector local_forms;
166 std::unique_ptr<autofill::PasswordForm> form = Credential("taco"); 169 std::unique_ptr<autofill::PasswordForm> form = Credential("taco");
167 form->icon_url = GURL("http://foo.com"); 170 form->icon_url = GURL("http://foo.com");
168 local_forms.push_back(std::move(form)); 171 local_forms.push_back(std::move(form));
169 SetUpAccountChooser(&local_forms); 172 SetUpAccountChooser(&local_forms);
170 EXPECT_FALSE(avatar_manager().fetchedAvatars.empty()); 173 EXPECT_FALSE(avatar_manager().fetchedAvatars.empty());
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 PasswordDialogController::FormsVector local_forms; 236 PasswordDialogController::FormsVector local_forms;
234 local_forms.push_back(Credential("pizza")); 237 local_forms.push_back(Credential("pizza"));
235 SetUpAccountChooser(&local_forms); 238 SetUpAccountChooser(&local_forms);
236 EXPECT_CALL(*this, OnPerformClose()); 239 EXPECT_CALL(*this, OnPerformClose());
237 [[view_controller() view] 240 [[view_controller() view]
238 performKeyEquivalent:cocoa_test_event_utils::KeyEventWithKeyCode( 241 performKeyEquivalent:cocoa_test_event_utils::KeyEventWithKeyCode(
239 kVK_Escape, '\e', NSKeyDown, 0)]; 242 kVK_Escape, '\e', NSKeyDown, 0)];
240 } 243 }
241 244
242 } // namespace 245 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/manage_passwords_view_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698