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

Unified Diff: chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm

Issue 668171: AutoFill Mac preference for enabling Address Book "me" card usage.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm
===================================================================
--- chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm (revision 40742)
+++ chrome/browser/autofill/autofill_dialog_controller_mac_unittest.mm (working copy)
@@ -10,13 +10,16 @@
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
+#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
+#include "chrome/common/pref_names.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
class AutoFillDialogObserverTester : public AutoFillDialogObserver {
public:
- AutoFillDialogObserverTester() : hit_(false) {}
+ AutoFillDialogObserverTester()
+ : hit_(false) {}
virtual ~AutoFillDialogObserverTester() {}
virtual void OnAutoFillDialogApply(
@@ -51,7 +54,8 @@
controller_ = [AutoFillDialogController
controllerWithObserver:&observer_
autoFillProfiles:profiles_
- creditCards:credit_cards_];
+ creditCards:credit_cards_
+ profile:helper_.profile()];
[controller_ window];
}
@@ -388,5 +392,45 @@
ASSERT_EQ(observer_.credit_cards_[0], credit_card);
}
+TEST_F(AutoFillDialogControllerTest, AuxiliaryProfilesFalse) {
+ LoadDialog();
+ [controller_ save:nil];
+ // Should hit our observer.
+ ASSERT_TRUE(observer_.hit_);
+
+ // Auxiliary profiles setting should be unchanged.
+ ASSERT_FALSE(helper_.profile()->GetPrefs()->GetBoolean(
+ prefs::kAutoFillAuxiliaryProfilesEnabled));
}
+
+TEST_F(AutoFillDialogControllerTest, AuxiliaryProfilesTrue) {
+ helper_.profile()->GetPrefs()->SetBoolean(
+ prefs::kAutoFillAuxiliaryProfilesEnabled, true);
+ LoadDialog();
+ [controller_ save:nil];
+
+ // Should hit our observer.
+ ASSERT_TRUE(observer_.hit_);
+
+ // Auxiliary profiles setting should be unchanged.
+ ASSERT_TRUE(helper_.profile()->GetPrefs()->GetBoolean(
+ prefs::kAutoFillAuxiliaryProfilesEnabled));
+}
+
+TEST_F(AutoFillDialogControllerTest, AuxiliaryProfilesChanged) {
+ helper_.profile()->GetPrefs()->SetBoolean(
+ prefs::kAutoFillAuxiliaryProfilesEnabled, false);
+ LoadDialog();
+ [controller_ setAuxiliaryEnabled:YES];
+ [controller_ save:nil];
+
+ // Should hit our observer.
+ ASSERT_TRUE(observer_.hit_);
+
+ // Auxiliary profiles setting should be unchanged.
+ ASSERT_TRUE(helper_.profile()->GetPrefs()->GetBoolean(
+ prefs::kAutoFillAuxiliaryProfilesEnabled));
+}
+
+}
« no previous file with comments | « chrome/browser/autofill/autofill_dialog_controller_mac.mm ('k') | chrome/browser/autofill/autofill_dialog_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698