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/layout_view.h" | 5 #import "chrome/browser/ui/cocoa/autofill/layout_view.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "chrome/browser/ui/cocoa/autofill/simple_grid_layout.h" | 8 #include "chrome/browser/ui/cocoa/autofill/simple_grid_layout.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "testing/platform_test.h" | 10 #include "testing/platform_test.h" |
11 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 11 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 class LayoutViewTest : public ui::CocoaTest { | 15 class LayoutViewTest : public ui::CocoaTest { |
16 public: | 16 public: |
17 LayoutViewTest() { | 17 LayoutViewTest() { |
18 CocoaTest::SetUp(); | 18 CocoaTest::SetUp(); |
19 view_.reset([[LayoutView alloc] initWithFrame:NSZeroRect]); | 19 view_.reset([[LayoutView alloc] initWithFrame:NSZeroRect]); |
20 [view_ setLayoutManager: | 20 [view_ setLayoutManager:std::unique_ptr<SimpleGridLayout>( |
21 scoped_ptr<SimpleGridLayout>(new SimpleGridLayout(view_))]; | 21 new SimpleGridLayout(view_))]; |
22 layout_ = [view_ layoutManager]; | 22 layout_ = [view_ layoutManager]; |
23 [[test_window() contentView] addSubview:view_]; | 23 [[test_window() contentView] addSubview:view_]; |
24 } | 24 } |
25 | 25 |
26 protected: | 26 protected: |
27 base::scoped_nsobject<LayoutView> view_; | 27 base::scoped_nsobject<LayoutView> view_; |
28 SimpleGridLayout* layout_; // weak, owned by view_. | 28 SimpleGridLayout* layout_; // weak, owned by view_. |
29 }; | 29 }; |
30 | 30 |
31 } // namespace | 31 } // namespace |
(...skipping 24 matching lines...) Expand all Loading... |
56 EXPECT_FLOAT_EQ(60, NSHeight([view_ frame])); | 56 EXPECT_FLOAT_EQ(60, NSHeight([view_ frame])); |
57 | 57 |
58 NSView* subview = [[view_ subviews] objectAtIndex:0]; | 58 NSView* subview = [[view_ subviews] objectAtIndex:0]; |
59 EXPECT_FLOAT_EQ(16, NSWidth([subview frame])); | 59 EXPECT_FLOAT_EQ(16, NSWidth([subview frame])); |
60 EXPECT_FLOAT_EQ(55, NSHeight([subview frame])); | 60 EXPECT_FLOAT_EQ(55, NSHeight([subview frame])); |
61 | 61 |
62 subview = [[view_ subviews] objectAtIndex:1]; | 62 subview = [[view_ subviews] objectAtIndex:1]; |
63 EXPECT_FLOAT_EQ(24, NSWidth([subview frame])); | 63 EXPECT_FLOAT_EQ(24, NSWidth([subview frame])); |
64 EXPECT_FLOAT_EQ(55, NSHeight([subview frame])); | 64 EXPECT_FLOAT_EQ(55, NSHeight([subview frame])); |
65 } | 65 } |
OLD | NEW |