| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
| 8 #include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h" | 8 #include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h" |
| 9 #import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h" | 9 #import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 scoped_nsobject<AutofillMainContainer> container_; | 26 scoped_nsobject<AutofillMainContainer> container_; |
| 27 testing::NiceMock<autofill::MockAutofillDialogController> controller_; | 27 testing::NiceMock<autofill::MockAutofillDialogController> controller_; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 TEST_VIEW(AutofillMainContainerTest, [container_ view]) | 32 TEST_VIEW(AutofillMainContainerTest, [container_ view]) |
| 33 | 33 |
| 34 TEST_F(AutofillMainContainerTest, SubViews) { | 34 TEST_F(AutofillMainContainerTest, SubViews) { |
| 35 bool hasAccountChooser = false; | 35 bool hasAccountChooser = false; |
| 36 bool hasButtons = false; |
| 36 | 37 |
| 38 // Should have account chooser, button strip, and details section. |
| 39 EXPECT_EQ(3U, [[[container_ view] subviews] count]); |
| 37 for (NSView* view in [[container_ view] subviews]) { | 40 for (NSView* view in [[container_ view] subviews]) { |
| 38 if ([view isKindOfClass:[AutofillAccountChooser class]]) { | 41 if ([view isKindOfClass:[AutofillAccountChooser class]]) { |
| 39 hasAccountChooser = true; | 42 hasAccountChooser = true; |
| 40 } else { | 43 } else { |
| 41 NSArray* subviews = [view subviews]; | 44 NSArray* subviews = [view subviews]; |
| 42 EXPECT_EQ(2U, [subviews count]); | 45 if ([subviews count] == 2) { |
| 43 EXPECT_TRUE([[subviews objectAtIndex:0] isKindOfClass:[NSButton class]]); | 46 EXPECT_TRUE( |
| 44 EXPECT_TRUE([[subviews objectAtIndex:1] isKindOfClass:[NSButton class]]); | 47 [[subviews objectAtIndex:0] isKindOfClass:[NSButton class]]); |
| 48 EXPECT_TRUE( |
| 49 [[subviews objectAtIndex:1] isKindOfClass:[NSButton class]]); |
| 50 hasButtons = true; |
| 51 } |
| 45 } | 52 } |
| 46 } | 53 } |
| 47 | 54 |
| 48 EXPECT_TRUE(hasAccountChooser); | 55 EXPECT_TRUE(hasAccountChooser && hasButtons); |
| 49 } | 56 } |
| OLD | NEW |