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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 | 591 |
592 // Sizes should match. | 592 // Sizes should match. |
593 ASSERT_EQ(1UL, observer_.profiles_.size()); | 593 ASSERT_EQ(1UL, observer_.profiles_.size()); |
594 ASSERT_EQ(1UL, observer_.credit_cards_.size()); | 594 ASSERT_EQ(1UL, observer_.credit_cards_.size()); |
595 | 595 |
596 // Contents should match. | 596 // Contents should match. |
597 ASSERT_EQ(observer_.profiles_[0], profile); | 597 ASSERT_EQ(observer_.profiles_[0], profile); |
598 ASSERT_EQ(observer_.credit_cards_[0], credit_card); | 598 ASSERT_EQ(observer_.credit_cards_[0], credit_card); |
599 } | 599 } |
600 | 600 |
| 601 // AutoFill is enabled by default. |
| 602 TEST_F(AutoFillDialogControllerTest, AutoFillEnabledTrue) { |
| 603 LoadDialog(); |
| 604 [controller_ save:nil]; |
| 605 |
| 606 // Should hit our observer. |
| 607 ASSERT_TRUE(observer_.hit_); |
| 608 |
| 609 // AutoFill enabled setting should be unchanged. |
| 610 ASSERT_TRUE(helper_.profile()->GetPrefs()->GetBoolean( |
| 611 prefs::kAutoFillEnabled)); |
| 612 } |
| 613 |
| 614 TEST_F(AutoFillDialogControllerTest, AutoFillEnabledFalse) { |
| 615 helper_.profile()->GetPrefs()->SetBoolean(prefs::kAutoFillEnabled, false); |
| 616 LoadDialog(); |
| 617 [controller_ save:nil]; |
| 618 |
| 619 // Should hit our observer. |
| 620 ASSERT_TRUE(observer_.hit_); |
| 621 |
| 622 // AutoFill enabled setting should be unchanged. |
| 623 ASSERT_FALSE(helper_.profile()->GetPrefs()->GetBoolean( |
| 624 prefs::kAutoFillEnabled)); |
| 625 } |
| 626 |
| 627 TEST_F(AutoFillDialogControllerTest, AutoFillEnabledChanged) { |
| 628 helper_.profile()->GetPrefs()->SetBoolean( |
| 629 prefs::kAutoFillAuxiliaryProfilesEnabled, false); |
| 630 LoadDialog(); |
| 631 [controller_ setAutoFillEnabled:YES]; |
| 632 [controller_ save:nil]; |
| 633 |
| 634 // Should hit our observer. |
| 635 ASSERT_TRUE(observer_.hit_); |
| 636 |
| 637 // Auxiliary profiles setting should be unchanged. |
| 638 ASSERT_TRUE(helper_.profile()->GetPrefs()->GetBoolean( |
| 639 prefs::kAutoFillEnabled)); |
| 640 } |
| 641 |
601 } // namespace | 642 } // namespace |
OLD | NEW |