Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / autofill / autofill_overlay_controller_unittest.mm
blobf5f72b6849b1a57693bb85f933423b6437595e81
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"
14 namespace {
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   }
25  protected:
26   base::scoped_nsobject<AutofillOverlayController> controller_;
27   testing::NiceMock<autofill::MockAutofillDialogViewDelegate> delegate_;
30 }  // namespace
32 TEST_VIEW(AutofillOverlayControllerTest, [controller_ view])
34 TEST_F(AutofillOverlayControllerTest, Subviews) {
35   NSView* view = [controller_ view];
36   ASSERT_EQ(2U, [[view subviews] count]);
37   EXPECT_TRUE(
38       [[[view subviews] objectAtIndex:0] isKindOfClass:[NSView class]]);
39   EXPECT_TRUE(
40       [[[view subviews] objectAtIndex:0] conformsToProtocol:
41           @protocol(AutofillLayout)]);
42   EXPECT_TRUE(
43       [[[view subviews] objectAtIndex:1] isMemberOfClass:[NSImageView class]]);