1 // Copyright 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.
5 #import "chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.h"
7 #include "base/mac/scoped_nsobject.h"
8 #include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/gtest_mac.h"
12 #import "ui/base/test/ui_cocoa_test_helper.h"
16 class AutofillOverlayControllerTest : public ui::CocoaTest {
18 virtual void SetUp() {
21 [[AutofillOverlayController alloc] initWithDelegate:&delegate_]);
22 [[test_window() contentView] addSubview:[controller_ view]];
26 base::scoped_nsobject<AutofillOverlayController> controller_;
27 testing::NiceMock<autofill::MockAutofillDialogViewDelegate> delegate_;
32 TEST_VIEW(AutofillOverlayControllerTest, [controller_ view])
34 TEST_F(AutofillOverlayControllerTest, Subviews) {
35 NSView* view = [controller_ view];
36 ASSERT_EQ(2U, [[view subviews] count]);
38 [[[view subviews] objectAtIndex:0] isKindOfClass:[NSView class]]);
40 [[[view subviews] objectAtIndex:0] conformsToProtocol:
41 @protocol(AutofillLayout)]);
43 [[[view subviews] objectAtIndex:1] isMemberOfClass:[NSImageView class]]);