OLD | NEW |
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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 306 |
307 AutoFillCreditCardSheetController* sheet = | 307 AutoFillCreditCardSheetController* sheet = |
308 [controller_ creditCardSheetController]; | 308 [controller_ creditCardSheetController]; |
309 ASSERT_TRUE(sheet != nil); | 309 ASSERT_TRUE(sheet != nil); |
310 AutoFillCreditCardModel* cm = [sheet creditCardModel]; | 310 AutoFillCreditCardModel* cm = [sheet creditCardModel]; |
311 EXPECT_TRUE([[cm nameOnCard] isEqualToString:@"DCH"]); | 311 EXPECT_TRUE([[cm nameOnCard] isEqualToString:@"DCH"]); |
312 EXPECT_TRUE([[cm creditCardNumber] isEqualToString:@"1234 5678 9101 1121"]); | 312 EXPECT_TRUE([[cm creditCardNumber] isEqualToString:@"1234 5678 9101 1121"]); |
313 EXPECT_TRUE([[cm expirationMonth] isEqualToString:@"01"]); | 313 EXPECT_TRUE([[cm expirationMonth] isEqualToString:@"01"]); |
314 EXPECT_TRUE([[cm expirationYear] isEqualToString:@"2012"]); | 314 EXPECT_TRUE([[cm expirationYear] isEqualToString:@"2012"]); |
315 | 315 |
| 316 // Check that user-visible text is obfuscated. |
| 317 NSTextField* numberField = [sheet creditCardNumberField]; |
| 318 ASSERT_TRUE(numberField != nil); |
| 319 EXPECT_TRUE([[numberField stringValue] isEqualToString:@"************1121"]); |
| 320 |
316 [sheet save:nil]; | 321 [sheet save:nil]; |
317 [controller_ save:nil]; | 322 [controller_ save:nil]; |
318 | 323 |
319 ASSERT_TRUE(observer_.hit_); | 324 ASSERT_TRUE(observer_.hit_); |
320 ASSERT_TRUE(observer_.credit_cards_.size() == 1); | 325 ASSERT_TRUE(observer_.credit_cards_.size() == 1); |
321 | 326 |
| 327 // Don't compare unique ids. |
322 credit_cards()[0]->set_unique_id(observer_.credit_cards_[0].unique_id()); | 328 credit_cards()[0]->set_unique_id(observer_.credit_cards_[0].unique_id()); |
323 ASSERT_EQ(observer_.credit_cards_[0], *credit_cards()[0]); | 329 ASSERT_EQ(observer_.credit_cards_[0], *credit_cards()[0]); |
324 } | 330 } |
325 | 331 |
326 TEST_F(AutoFillDialogControllerTest, TwoProfiles) { | 332 TEST_F(AutoFillDialogControllerTest, TwoProfiles) { |
327 AutoFillProfile profile1(ASCIIToUTF16("One"), 1); | 333 AutoFillProfile profile1(ASCIIToUTF16("One"), 1); |
328 profile1.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Joe")); | 334 profile1.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Joe")); |
329 profiles().push_back(&profile1); | 335 profiles().push_back(&profile1); |
330 AutoFillProfile profile2(ASCIIToUTF16("Two"), 2); | 336 AutoFillProfile profile2(ASCIIToUTF16("Two"), 2); |
331 profile2.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Bob")); | 337 profile2.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Bob")); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 | 760 |
755 // Should hit our observer. | 761 // Should hit our observer. |
756 ASSERT_TRUE(observer_.hit_); | 762 ASSERT_TRUE(observer_.hit_); |
757 | 763 |
758 // Auxiliary profiles setting should be unchanged. | 764 // Auxiliary profiles setting should be unchanged. |
759 ASSERT_TRUE(helper_.profile()->GetPrefs()->GetBoolean( | 765 ASSERT_TRUE(helper_.profile()->GetPrefs()->GetBoolean( |
760 prefs::kAutoFillEnabled)); | 766 prefs::kAutoFillEnabled)); |
761 } | 767 } |
762 | 768 |
763 } // namespace | 769 } // namespace |
OLD | NEW |