| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" | 8 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" |
| 9 #include "ui/views/test/views_test_base.h" | 9 #include "ui/views/test/views_test_base.h" |
| 10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
| 11 #include "ui/views/widget/widget_delegate.h" | 11 #include "ui/views/widget/widget_delegate.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 | 14 |
| 15 // A view for testing that takes a fixed preferred size upon construction. | 15 // A view for testing that takes a fixed preferred size upon construction. |
| 16 class FixedSizeView : public View { | 16 class FixedSizeView : public View { |
| 17 public: | 17 public: |
| 18 FixedSizeView(const gfx::Size& size) | 18 explicit FixedSizeView(const gfx::Size& size) |
| 19 : size_(size) {} | 19 : size_(size) {} |
| 20 | 20 |
| 21 virtual gfx::Size GetPreferredSize() { | 21 // Overridden from View: |
| 22 virtual gfx::Size GetPreferredSize() OVERRIDE { |
| 22 return size_; | 23 return size_; |
| 23 } | 24 } |
| 24 | 25 |
| 25 private: | 26 private: |
| 26 const gfx::Size size_; | 27 const gfx::Size size_; |
| 27 | 28 |
| 28 DISALLOW_COPY_AND_ASSIGN(FixedSizeView); | 29 DISALLOW_COPY_AND_ASSIGN(FixedSizeView); |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 class TabbedPaneTest : public ViewsTestBase, | 32 class TabbedPaneTest : public ViewsTestBase, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // Now change the selected tab. | 127 // Now change the selected tab. |
| 127 tabbed_pane_->SelectTabAt(1); | 128 tabbed_pane_->SelectTabAt(1); |
| 128 EXPECT_EQ(1, tabbed_pane_->GetSelectedTabIndex()); | 129 EXPECT_EQ(1, tabbed_pane_->GetSelectedTabIndex()); |
| 129 | 130 |
| 130 // Remove the first one. | 131 // Remove the first one. |
| 131 delete tabbed_pane_->RemoveTabAtIndex(0); | 132 delete tabbed_pane_->RemoveTabAtIndex(0); |
| 132 EXPECT_EQ(0, tabbed_pane_->GetSelectedTabIndex()); | 133 EXPECT_EQ(0, tabbed_pane_->GetSelectedTabIndex()); |
| 133 } | 134 } |
| 134 | 135 |
| 135 } // namespace views | 136 } // namespace views |
| OLD | NEW |