Chromium Code Reviews

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

Issue 2800031: AutoFill "me" card integration defaults to enabled on Mac (Closed)
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_manager.cc » ('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 (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 482 matching lines...)
493 493
494 // Sizes should match be different. New size should be 0. 494 // Sizes should match be different. New size should be 0.
495 ASSERT_NE(observer_.credit_cards_.size(), credit_cards().size()); 495 ASSERT_NE(observer_.credit_cards_.size(), credit_cards().size());
496 ASSERT_EQ(observer_.credit_cards_.size(), 1UL); 496 ASSERT_EQ(observer_.credit_cards_.size(), 1UL);
497 497
498 // First credit card should match. 498 // First credit card should match.
499 credit_cards()[0]->set_unique_id(observer_.credit_cards_[0].unique_id()); 499 credit_cards()[0]->set_unique_id(observer_.credit_cards_[0].unique_id());
500 ASSERT_EQ(observer_.credit_cards_[0], credit_card); 500 ASSERT_EQ(observer_.credit_cards_[0], credit_card);
501 } 501 }
502 502
503 TEST_F(AutoFillDialogControllerTest, AuxiliaryProfilesFalse) { 503 // Auxilliary profiles are enabled by default.
504 TEST_F(AutoFillDialogControllerTest, AuxiliaryProfilesTrue) {
504 LoadDialog(); 505 LoadDialog();
505 [controller_ save:nil]; 506 [controller_ save:nil];
506 507
507 // Should hit our observer. 508 // Should hit our observer.
508 ASSERT_TRUE(observer_.hit_); 509 ASSERT_TRUE(observer_.hit_);
509 510
510 // Auxiliary profiles setting should be unchanged. 511 // Auxiliary profiles setting should be unchanged.
511 ASSERT_FALSE(helper_.profile()->GetPrefs()->GetBoolean( 512 ASSERT_TRUE(helper_.profile()->GetPrefs()->GetBoolean(
512 prefs::kAutoFillAuxiliaryProfilesEnabled)); 513 prefs::kAutoFillAuxiliaryProfilesEnabled));
513 } 514 }
514 515
515 TEST_F(AutoFillDialogControllerTest, AuxiliaryProfilesTrue) { 516 TEST_F(AutoFillDialogControllerTest, AuxiliaryProfilesFalse) {
516 helper_.profile()->GetPrefs()->SetBoolean( 517 helper_.profile()->GetPrefs()->SetBoolean(
517 prefs::kAutoFillAuxiliaryProfilesEnabled, true); 518 prefs::kAutoFillAuxiliaryProfilesEnabled, false);
518 LoadDialog(); 519 LoadDialog();
519 [controller_ save:nil]; 520 [controller_ save:nil];
520 521
521 // Should hit our observer. 522 // Should hit our observer.
522 ASSERT_TRUE(observer_.hit_); 523 ASSERT_TRUE(observer_.hit_);
523 524
524 // Auxiliary profiles setting should be unchanged. 525 // Auxiliary profiles setting should be unchanged.
525 ASSERT_TRUE(helper_.profile()->GetPrefs()->GetBoolean( 526 ASSERT_FALSE(helper_.profile()->GetPrefs()->GetBoolean(
526 prefs::kAutoFillAuxiliaryProfilesEnabled)); 527 prefs::kAutoFillAuxiliaryProfilesEnabled));
527 } 528 }
528 529
529 TEST_F(AutoFillDialogControllerTest, AuxiliaryProfilesChanged) { 530 TEST_F(AutoFillDialogControllerTest, AuxiliaryProfilesChanged) {
530 helper_.profile()->GetPrefs()->SetBoolean( 531 helper_.profile()->GetPrefs()->SetBoolean(
531 prefs::kAutoFillAuxiliaryProfilesEnabled, false); 532 prefs::kAutoFillAuxiliaryProfilesEnabled, false);
532 LoadDialog(); 533 LoadDialog();
533 [controller_ setAuxiliaryEnabled:YES]; 534 [controller_ setAuxiliaryEnabled:YES];
534 [controller_ save:nil]; 535 [controller_ save:nil];
535 536
(...skipping 55 matching lines...)
591 // Sizes should match. 592 // Sizes should match.
592 ASSERT_EQ(1UL, observer_.profiles_.size()); 593 ASSERT_EQ(1UL, observer_.profiles_.size());
593 ASSERT_EQ(1UL, observer_.credit_cards_.size()); 594 ASSERT_EQ(1UL, observer_.credit_cards_.size());
594 595
595 // Contents should match. 596 // Contents should match.
596 ASSERT_EQ(observer_.profiles_[0], profile); 597 ASSERT_EQ(observer_.profiles_[0], profile);
597 ASSERT_EQ(observer_.credit_cards_[0], credit_card); 598 ASSERT_EQ(observer_.credit_cards_[0], credit_card);
598 } 599 }
599 600
600 } // namespace 601 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine