| 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/mac/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" |
| 11 #include "testing/platform_test.h" | 11 #include "testing/platform_test.h" |
| 12 #import "ui/base/test/ui_cocoa_test_helper.h" | 12 #import "ui/base/test/ui_cocoa_test_helper.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class AutofillMainContainerTest : public ui::CocoaTest { | 16 class AutofillMainContainerTest : public ui::CocoaTest { |
| 17 public: | 17 public: |
| 18 virtual void SetUp() { | 18 virtual void SetUp() { |
| 19 CocoaTest::SetUp(); | 19 CocoaTest::SetUp(); |
| 20 container_.reset([[AutofillMainContainer alloc] initWithController: | 20 container_.reset([[AutofillMainContainer alloc] initWithController: |
| 21 &controller_]); | 21 &controller_]); |
| 22 [[test_window() contentView] addSubview:[container_ view]]; | 22 [[test_window() contentView] addSubview:[container_ view]]; |
| 23 } | 23 } |
| 24 | 24 |
| 25 protected: | 25 protected: |
| 26 scoped_nsobject<AutofillMainContainer> container_; | 26 base::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 hasButtons = false; | 35 bool hasButtons = false; |
| 36 | 36 |
| 37 // Should have account chooser, button strip, and details section. | 37 // Should have account chooser, button strip, and details section. |
| 38 EXPECT_EQ(2U, [[[container_ view] subviews] count]); | 38 EXPECT_EQ(2U, [[[container_ view] subviews] count]); |
| 39 for (NSView* view in [[container_ view] subviews]) { | 39 for (NSView* view in [[container_ view] subviews]) { |
| 40 NSArray* subviews = [view subviews]; | 40 NSArray* subviews = [view subviews]; |
| 41 if ([subviews count] == 2) { | 41 if ([subviews count] == 2) { |
| 42 EXPECT_TRUE( | 42 EXPECT_TRUE( |
| 43 [[subviews objectAtIndex:0] isKindOfClass:[NSButton class]]); | 43 [[subviews objectAtIndex:0] isKindOfClass:[NSButton class]]); |
| 44 EXPECT_TRUE( | 44 EXPECT_TRUE( |
| 45 [[subviews objectAtIndex:1] isKindOfClass:[NSButton class]]); | 45 [[subviews objectAtIndex:1] isKindOfClass:[NSButton class]]); |
| 46 hasButtons = true; | 46 hasButtons = true; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 EXPECT_TRUE(hasButtons); | 50 EXPECT_TRUE(hasButtons); |
| 51 } | 51 } |
| OLD | NEW |