OLD | NEW |
1 // Copyright (c) 2012 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 "ui/views/controls/scrollbar/native_scroll_bar.h" | 5 #include "ui/views/controls/scrollbar/native_scroll_bar.h" |
6 #include "ui/views/controls/scrollbar/native_scroll_bar_views.h" | 6 #include "ui/views/controls/scrollbar/native_scroll_bar_views.h" |
7 #include "ui/views/controls/scrollbar/scroll_bar.h" | 7 #include "ui/views/controls/scrollbar/scroll_bar.h" |
8 #include "ui/views/test/views_test_base.h" | 8 #include "ui/views/test/views_test_base.h" |
9 #include "ui/views/widget/widget.h" | 9 #include "ui/views/widget/widget.h" |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 bool last_is_page; | 41 bool last_is_page; |
42 int last_position; | 42 int last_position; |
43 }; | 43 }; |
44 | 44 |
45 } // namespace | 45 } // namespace |
46 | 46 |
47 namespace views { | 47 namespace views { |
48 | 48 |
49 class NativeScrollBarTest : public ViewsTestBase { | 49 class NativeScrollBarTest : public ViewsTestBase { |
50 public: | 50 public: |
51 NativeScrollBarTest() | 51 NativeScrollBarTest() : widget_(NULL), scrollbar_(NULL) {} |
52 : widget_(NULL), | |
53 scrollbar_(NULL), | |
54 controller_(NULL) { | |
55 } | |
56 | 52 |
57 virtual void SetUp() { | 53 virtual void SetUp() { |
58 ViewsTestBase::SetUp(); | 54 ViewsTestBase::SetUp(); |
59 controller_.reset(new TestScrollBarController()); | 55 controller_.reset(new TestScrollBarController()); |
60 | 56 |
61 ASSERT_FALSE(scrollbar_); | 57 ASSERT_FALSE(scrollbar_); |
62 native_scrollbar_ = new NativeScrollBar(true); | 58 native_scrollbar_ = new NativeScrollBar(true); |
63 native_scrollbar_->SetBounds(0, 0, 100, 100); | 59 native_scrollbar_->SetBounds(0, 0, 100, 100); |
64 native_scrollbar_->set_controller(controller_.get()); | 60 native_scrollbar_->set_controller(controller_.get()); |
65 | 61 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 EXPECT_EQ(99, scrollbar_->GetMaxPosition()); | 150 EXPECT_EQ(99, scrollbar_->GetMaxPosition()); |
155 EXPECT_EQ(0, scrollbar_->GetMinPosition()); | 151 EXPECT_EQ(0, scrollbar_->GetMinPosition()); |
156 | 152 |
157 scrollbar_->Update(100, 199, 99); | 153 scrollbar_->Update(100, 199, 99); |
158 EXPECT_EQ( | 154 EXPECT_EQ( |
159 scrollbar_->GetTrackBounds().width() - scrollbar_->GetThumbSizeForTest(), | 155 scrollbar_->GetTrackBounds().width() - scrollbar_->GetThumbSizeForTest(), |
160 scrollbar_->GetPosition()); | 156 scrollbar_->GetPosition()); |
161 } | 157 } |
162 | 158 |
163 } // namespace views | 159 } // namespace views |
OLD | NEW |