| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" |
| 6 |
| 7 #include "base/memory/scoped_nsobject.h" |
| 8 #include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h" |
| 9 #import "chrome/browser/ui/cocoa/autofill/autofill_layout_view.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "testing/platform_test.h" |
| 12 #import "ui/base/test/ui_cocoa_test_helper.h" |
| 13 |
| 14 namespace { |
| 15 |
| 16 class AutofillSectionContainerTest : public ui::CocoaTest { |
| 17 public: |
| 18 virtual void SetUp() { |
| 19 CocoaTest::SetUp(); |
| 20 container_.reset( |
| 21 [[AutofillSectionContainer alloc] |
| 22 initWithController:&controller_ |
| 23 forSection:autofill::SECTION_CC]); |
| 24 [[test_window() contentView] addSubview:[container_ view]]; |
| 25 } |
| 26 |
| 27 protected: |
| 28 scoped_nsobject<AutofillSectionContainer> container_; |
| 29 testing::NiceMock<autofill::MockAutofillDialogController> controller_; |
| 30 }; |
| 31 |
| 32 } // namespace |
| 33 |
| 34 TEST_VIEW(AutofillSectionContainerTest, [container_ view]) |
| 35 |
| 36 TEST_F(AutofillSectionContainerTest, HasSubviews) { |
| 37 ASSERT_EQ(2U, [[[container_ view] subviews] count]); |
| 38 |
| 39 bool hasLayoutView = false; |
| 40 bool hasTextField = false; |
| 41 for (NSView* view in [[container_ view] subviews]) { |
| 42 if ([view isKindOfClass:[NSTextField class]]) { |
| 43 hasTextField = true; |
| 44 } else if ([view isKindOfClass:[AutofillLayoutView class]]) { |
| 45 hasLayoutView = true; |
| 46 } |
| 47 } |
| 48 |
| 49 EXPECT_TRUE(hasLayoutView); |
| 50 EXPECT_TRUE(hasTextField); |
| 51 } |
| OLD | NEW |