OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 #include "views/controls/tabbed_pane/tabbed_pane.h" | 7 #include "views/controls/tabbed_pane/tabbed_pane.h" |
8 #include "views/widget/widget.h" | 8 #include "views/widget/widget.h" |
9 #include "views/widget/widget_delegate.h" | 9 #include "views/widget/widget_delegate.h" |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 public: | 31 public: |
32 TabbedPaneTest() {} | 32 TabbedPaneTest() {} |
33 | 33 |
34 TabbedPane* tabbed_pane_; | 34 TabbedPane* tabbed_pane_; |
35 | 35 |
36 void RunAllPending() { | 36 void RunAllPending() { |
37 message_loop_.RunAllPending(); | 37 message_loop_.RunAllPending(); |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 virtual void SetUp() { | 41 virtual void SetUp() OVERRIDE { |
42 tabbed_pane_ = new TabbedPane(); | 42 tabbed_pane_ = new TabbedPane(); |
43 window_ = Widget::CreateWindowWithBounds(this, gfx::Rect(0, 0, 100, 100)); | 43 window_ = Widget::CreateWindowWithBounds(this, gfx::Rect(0, 0, 100, 100)); |
44 window_->Show(); | 44 window_->Show(); |
45 } | 45 } |
46 | 46 |
47 virtual void TearDown() { | 47 virtual void TearDown() OVERRIDE { |
48 window_->Close(); | 48 window_->Close(); |
49 message_loop_.RunAllPending(); | 49 message_loop_.RunAllPending(); |
50 } | 50 } |
51 | 51 |
52 virtual views::View* GetContentsView() { | 52 virtual views::View* GetContentsView() OVERRIDE { |
53 return tabbed_pane_; | 53 return tabbed_pane_; |
54 } | 54 } |
| 55 virtual views::Widget* GetWidget() OVERRIDE { |
| 56 return tabbed_pane_->GetWidget(); |
| 57 } |
| 58 virtual const views::Widget* GetWidget() const OVERRIDE { |
| 59 return tabbed_pane_->GetWidget(); |
| 60 } |
55 | 61 |
56 MessageLoopForUI message_loop_; | 62 MessageLoopForUI message_loop_; |
57 Widget* window_; | 63 Widget* window_; |
58 | 64 |
59 DISALLOW_COPY_AND_ASSIGN(TabbedPaneTest); | 65 DISALLOW_COPY_AND_ASSIGN(TabbedPaneTest); |
60 }; | 66 }; |
61 | 67 |
62 // Tests that TabbedPane::GetPreferredSize() and TabbedPane::Layout(). | 68 // Tests that TabbedPane::GetPreferredSize() and TabbedPane::Layout(). |
63 TEST_F(TabbedPaneTest, SizeAndLayout) { | 69 TEST_F(TabbedPaneTest, SizeAndLayout) { |
64 View* child1 = new FixedSizeView(gfx::Size(20, 10)); | 70 View* child1 = new FixedSizeView(gfx::Size(20, 10)); |
(...skipping 15 matching lines...) Expand all Loading... |
80 EXPECT_LT(bounds.width(), 100); | 86 EXPECT_LT(bounds.width(), 100); |
81 EXPECT_GT(bounds.height(), 0); | 87 EXPECT_GT(bounds.height(), 0); |
82 EXPECT_LT(bounds.height(), 200); | 88 EXPECT_LT(bounds.height(), 200); |
83 | 89 |
84 // If we switch to the other tab, it should get assigned the same bounds. | 90 // If we switch to the other tab, it should get assigned the same bounds. |
85 tabbed_pane_->SelectTabAt(1); | 91 tabbed_pane_->SelectTabAt(1); |
86 EXPECT_EQ(bounds, child2->bounds()); | 92 EXPECT_EQ(bounds, child2->bounds()); |
87 } | 93 } |
88 | 94 |
89 } // namespace views | 95 } // namespace views |
OLD | NEW |