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

Side by Side Diff: chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm

Issue 2873002: AutoFill Mac UI : Validation, CVC Removal, Credit Card year list. (Closed)
Patch Set: Sync with ToT Created 10 years, 6 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 | « chrome/browser/autofill/autofill_dialog_controller_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/ref_counted.h" 5 #include "base/ref_counted.h"
6 #import "chrome/browser/autofill/autofill_address_model_mac.h" 6 #import "chrome/browser/autofill/autofill_address_model_mac.h"
7 #import "chrome/browser/autofill/autofill_address_sheet_controller_mac.h" 7 #import "chrome/browser/autofill/autofill_address_sheet_controller_mac.h"
8 #import "chrome/browser/autofill/autofill_credit_card_model_mac.h" 8 #import "chrome/browser/autofill/autofill_credit_card_model_mac.h"
9 #import "chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h" 9 #import "chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h"
10 #import "chrome/browser/autofill/autofill_dialog_controller_mac.h" 10 #import "chrome/browser/autofill/autofill_dialog_controller_mac.h"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 291
292 TEST_F(AutoFillDialogControllerTest, CreditCardDataMutation) { 292 TEST_F(AutoFillDialogControllerTest, CreditCardDataMutation) {
293 CreditCard credit_card(ASCIIToUTF16("myCC"), 345); 293 CreditCard credit_card(ASCIIToUTF16("myCC"), 345);
294 credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("DCH")); 294 credit_card.SetInfo(AutoFillType(CREDIT_CARD_NAME), ASCIIToUTF16("DCH"));
295 credit_card.SetInfo( 295 credit_card.SetInfo(
296 AutoFillType(CREDIT_CARD_NUMBER), ASCIIToUTF16("1234 5678 9101 1121")); 296 AutoFillType(CREDIT_CARD_NUMBER), ASCIIToUTF16("1234 5678 9101 1121"));
297 credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01")); 297 credit_card.SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("01"));
298 credit_card.SetInfo( 298 credit_card.SetInfo(
299 AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), ASCIIToUTF16("2012")); 299 AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), ASCIIToUTF16("2012"));
300 credit_card.SetInfo(
301 AutoFillType(CREDIT_CARD_VERIFICATION_CODE), ASCIIToUTF16("222"));
302 credit_cards().push_back(&credit_card); 300 credit_cards().push_back(&credit_card);
303 301
304 LoadDialog(); 302 LoadDialog();
305 [controller_ selectCreditCardAtIndex:0]; 303 [controller_ selectCreditCardAtIndex:0];
306 [controller_ editSelection:nil]; 304 [controller_ editSelection:nil];
307 305
308 AutoFillCreditCardSheetController* sheet = 306 AutoFillCreditCardSheetController* sheet =
309 [controller_ creditCardSheetController]; 307 [controller_ creditCardSheetController];
310 ASSERT_TRUE(sheet != nil); 308 ASSERT_TRUE(sheet != nil);
311 AutoFillCreditCardModel* cm = [sheet creditCardModel]; 309 AutoFillCreditCardModel* cm = [sheet creditCardModel];
312 EXPECT_TRUE([[cm label] isEqualToString:@"myCC"]); 310 EXPECT_TRUE([[cm label] isEqualToString:@"myCC"]);
313 EXPECT_TRUE([[cm nameOnCard] isEqualToString:@"DCH"]); 311 EXPECT_TRUE([[cm nameOnCard] isEqualToString:@"DCH"]);
314 EXPECT_TRUE([[cm creditCardNumber] isEqualToString:@"1234 5678 9101 1121"]); 312 EXPECT_TRUE([[cm creditCardNumber] isEqualToString:@"1234 5678 9101 1121"]);
315 EXPECT_TRUE([[cm expirationMonth] isEqualToString:@"01"]); 313 EXPECT_TRUE([[cm expirationMonth] isEqualToString:@"01"]);
316 EXPECT_TRUE([[cm expirationYear] isEqualToString:@"2012"]); 314 EXPECT_TRUE([[cm expirationYear] isEqualToString:@"2012"]);
317 EXPECT_TRUE([[cm cvcCode] isEqualToString:@"222"]);
318 315
319 [sheet save:nil]; 316 [sheet save:nil];
320 [controller_ save:nil]; 317 [controller_ save:nil];
321 318
322 ASSERT_TRUE(observer_.hit_); 319 ASSERT_TRUE(observer_.hit_);
323 ASSERT_TRUE(observer_.credit_cards_.size() == 1); 320 ASSERT_TRUE(observer_.credit_cards_.size() == 1);
324 321
325 credit_cards()[0]->set_unique_id(observer_.credit_cards_[0].unique_id()); 322 credit_cards()[0]->set_unique_id(observer_.credit_cards_[0].unique_id());
326 ASSERT_EQ(observer_.credit_cards_[0], *credit_cards()[0]); 323 ASSERT_EQ(observer_.credit_cards_[0], *credit_cards()[0]);
327 } 324 }
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // Sizes should match. 591 // Sizes should match.
595 ASSERT_EQ(1UL, observer_.profiles_.size()); 592 ASSERT_EQ(1UL, observer_.profiles_.size());
596 ASSERT_EQ(1UL, observer_.credit_cards_.size()); 593 ASSERT_EQ(1UL, observer_.credit_cards_.size());
597 594
598 // Contents should match. 595 // Contents should match.
599 ASSERT_EQ(observer_.profiles_[0], profile); 596 ASSERT_EQ(observer_.profiles_[0], profile);
600 ASSERT_EQ(observer_.credit_cards_[0], credit_card); 597 ASSERT_EQ(observer_.credit_cards_[0], credit_card);
601 } 598 }
602 599
603 } // namespace 600 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_dialog_controller_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698