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

Unified Diff: chrome/browser/ui/cocoa/autofill/autofill_main_container_unittest.mm

Issue 19287006: [rAC, OSX] "Save In Chrome" checkbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 7 years, 5 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
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_main_container.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/autofill/autofill_main_container_unittest.mm
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_main_container_unittest.mm b/chrome/browser/ui/cocoa/autofill/autofill_main_container_unittest.mm
index 5eeaf1d95e2d4a807103a695d08aa40cee464361..66ca163e8cc466af987223258be16252486ceea4 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_main_container_unittest.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_main_container_unittest.mm
@@ -35,10 +35,11 @@ TEST_F(AutofillMainContainerTest, SubViews) {
bool hasButtons = false;
bool hasTextView = false;
bool hasDetailsContainer = false;
+ bool hasCheckbox = false;
int hasNotificationContainer = false;
// Should have account chooser, button strip, and details section.
- EXPECT_EQ(4U, [[[container_ view] subviews] count]);
+ EXPECT_EQ(5U, [[[container_ view] subviews] count]);
for (NSView* view in [[container_ view] subviews]) {
NSArray* subviews = [view subviews];
if ([subviews count] == 2) {
@@ -50,9 +51,12 @@ TEST_F(AutofillMainContainerTest, SubViews) {
} else if ([view isKindOfClass:[NSTextView class]]) {
hasTextView = true;
} else if ([subviews count] > 0 &&
- [[subviews objectAtIndex:0] isKindOfClass:
- [AutofillSectionView class]]) {
+ [[subviews objectAtIndex:0] isKindOfClass:
+ [AutofillSectionView class]]) {
hasDetailsContainer = true;
+ } else if ([view isKindOfClass:[NSButton class]] &&
+ view == [container_ saveInChromeCheckboxForTesting]) {
+ hasCheckbox = true;
} else {
// Assume by default this is the notification area view.
// There is no way to easily verify that with more detail.
@@ -64,4 +68,27 @@ TEST_F(AutofillMainContainerTest, SubViews) {
EXPECT_TRUE(hasTextView);
EXPECT_TRUE(hasDetailsContainer);
EXPECT_TRUE(hasNotificationContainer);
+ EXPECT_TRUE(hasCheckbox);
+}
+
+TEST_F(AutofillMainContainerTest, SaveDetailsLocallyDefaultsToTrue) {
+ EXPECT_TRUE([container_ saveDetailsLocally]);
+}
+
+TEST_F(AutofillMainContainerTest, SaveInChromeCheckboxVisibility) {
+ using namespace testing;
+
+ // Tests that the checkbox is only visible if the controller allows it.
+ EXPECT_CALL(controller_, ShouldOfferToSaveInChrome()).Times(2)
+ .WillOnce(Return(false))
+ .WillOnce(Return(true));
+
+ NSButton* checkbox = [container_ saveInChromeCheckboxForTesting];
+ ASSERT_TRUE(checkbox);
+
+ EXPECT_FALSE([checkbox isHidden]);
+ [container_ modelChanged];
+ EXPECT_TRUE([checkbox isHidden]);
+ [container_ modelChanged];
+ EXPECT_FALSE([checkbox isHidden]);
}
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_main_container.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698