- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / autofill / autofill_overlay_controller_unittest.mm
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.
4
5 #import "chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.h"
6
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"
13
14 namespace {
15
16 class AutofillOverlayControllerTest : public ui::CocoaTest {
17  public:
18   virtual void SetUp() {
19     CocoaTest::SetUp();
20     controller_.reset(
21         [[AutofillOverlayController alloc] initWithDelegate:&delegate_]);
22     [[test_window() contentView] addSubview:[controller_ view]];
23   }
24
25  protected:
26   base::scoped_nsobject<AutofillOverlayController> controller_;
27   testing::NiceMock<autofill::MockAutofillDialogViewDelegate> delegate_;
28 };
29
30 }  // namespace
31
32 TEST_VIEW(AutofillOverlayControllerTest, [controller_ view])
33
34 TEST_F(AutofillOverlayControllerTest, Subviews) {
35   NSView* view = [controller_ view];
36   ASSERT_EQ(1U, [[view subviews] count]);
37
38   EXPECT_TRUE([view isKindOfClass:[NSBox class]]);
39   EXPECT_TRUE([[[view subviews] objectAtIndex:0] isMemberOfClass:
40           [NSView class]]);
41 }