| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "views/controls/tabbed_pane/tabbed_pane.h" | 8 #include "views/controls/tabbed_pane/tabbed_pane.h" |
| 9 #include "views/widget/widget.h" | 9 #include "views/widget/widget.h" |
| 10 #include "views/widget/widget_delegate.h" | 10 #include "views/widget/widget_delegate.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 virtual const views::Widget* GetWidget() const OVERRIDE { | 59 virtual const views::Widget* GetWidget() const OVERRIDE { |
| 60 return tabbed_pane_->GetWidget(); | 60 return tabbed_pane_->GetWidget(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 MessageLoopForUI message_loop_; | 63 MessageLoopForUI message_loop_; |
| 64 Widget* window_; | 64 Widget* window_; |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(TabbedPaneTest); | 66 DISALLOW_COPY_AND_ASSIGN(TabbedPaneTest); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 #if defined(OS_WIN) |
| 70 // This test is failing and crashes on Win7. See http://crbug.com/104067 |
| 71 #define MAYBE_SizeAndLayout DISABLED_SizeAndLayout |
| 72 #else |
| 73 #define MAYBE_SizeAndLayout SizeAndLayout |
| 74 #endif |
| 75 |
| 69 // Tests that TabbedPane::GetPreferredSize() and TabbedPane::Layout(). | 76 // Tests that TabbedPane::GetPreferredSize() and TabbedPane::Layout(). |
| 70 TEST_F(TabbedPaneTest, SizeAndLayout) { | 77 TEST_F(TabbedPaneTest, MAYBE_SizeAndLayout) { |
| 71 View* child1 = new FixedSizeView(gfx::Size(20, 10)); | 78 View* child1 = new FixedSizeView(gfx::Size(20, 10)); |
| 72 tabbed_pane_->AddTab(ASCIIToUTF16("tab1"), child1); | 79 tabbed_pane_->AddTab(ASCIIToUTF16("tab1"), child1); |
| 73 View* child2 = new FixedSizeView(gfx::Size(5, 5)); | 80 View* child2 = new FixedSizeView(gfx::Size(5, 5)); |
| 74 tabbed_pane_->AddTab(ASCIIToUTF16("tab2"), child2); | 81 tabbed_pane_->AddTab(ASCIIToUTF16("tab2"), child2); |
| 75 tabbed_pane_->SelectTabAt(0); | 82 tabbed_pane_->SelectTabAt(0); |
| 76 | 83 |
| 77 // Check that the preferred size is larger than the largest child. | 84 // Check that the preferred size is larger than the largest child. |
| 78 gfx::Size pref(tabbed_pane_->GetPreferredSize()); | 85 gfx::Size pref(tabbed_pane_->GetPreferredSize()); |
| 79 EXPECT_GT(pref.width(), 20); | 86 EXPECT_GT(pref.width(), 20); |
| 80 EXPECT_GT(pref.height(), 10); | 87 EXPECT_GT(pref.height(), 10); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Now change the selected tab. | 136 // Now change the selected tab. |
| 130 tabbed_pane_->SelectTabAt(1); | 137 tabbed_pane_->SelectTabAt(1); |
| 131 EXPECT_EQ(1, tabbed_pane_->GetSelectedTabIndex()); | 138 EXPECT_EQ(1, tabbed_pane_->GetSelectedTabIndex()); |
| 132 | 139 |
| 133 // Remove the first one. | 140 // Remove the first one. |
| 134 delete tabbed_pane_->RemoveTabAtIndex(0); | 141 delete tabbed_pane_->RemoveTabAtIndex(0); |
| 135 EXPECT_EQ(0, tabbed_pane_->GetSelectedTabIndex()); | 142 EXPECT_EQ(0, tabbed_pane_->GetSelectedTabIndex()); |
| 136 } | 143 } |
| 137 | 144 |
| 138 } // namespace views | 145 } // namespace views |
| OLD | NEW |