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

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: Re-upload - CQ is capricious 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
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..76ff9e20bd7a9910f5efad84a78d5cd658c1250a 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) {
@@ -53,6 +54,9 @@ TEST_F(AutofillMainContainerTest, SubViews) {
[[subviews objectAtIndex:0] isKindOfClass:
[AutofillSectionView class]]) {
hasDetailsContainer = true;
+ } else if ([view isKindOfClass:[NSButton class]] &&
+ view == [container_ saveInChromeCheckboxForTesting]) {
Robert Sesek 2013/07/16 18:40:38 nit: align with [
groby-ooo-7-16 2013/07/16 19:55:39 I blame my editor! ;) (Done, and so is the branch
+ 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]);
}

Powered by Google App Engine
This is Rietveld 408576698