| 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]);
|
| }
|
|
|