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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 EXPECT_EQ(0, scrollbar_->GetPosition()); | 149 EXPECT_EQ(0, scrollbar_->GetPosition()); |
150 EXPECT_EQ(99, scrollbar_->GetMaxPosition()); | 150 EXPECT_EQ(99, scrollbar_->GetMaxPosition()); |
151 EXPECT_EQ(0, scrollbar_->GetMinPosition()); | 151 EXPECT_EQ(0, scrollbar_->GetMinPosition()); |
152 | 152 |
153 scrollbar_->Update(100, 199, 99); | 153 scrollbar_->Update(100, 199, 99); |
154 EXPECT_EQ( | 154 EXPECT_EQ( |
155 scrollbar_->GetTrackBounds().width() - scrollbar_->GetThumbSizeForTest(), | 155 scrollbar_->GetTrackBounds().width() - scrollbar_->GetThumbSizeForTest(), |
156 scrollbar_->GetPosition()); | 156 scrollbar_->GetPosition()); |
157 } | 157 } |
158 | 158 |
| 159 TEST_F(NativeScrollBarTest, ScrollToEndAfterShrinkAndExpand) { |
| 160 // Scroll to the end of the content. |
| 161 scrollbar_->Update(100, 101, 0); |
| 162 EXPECT_TRUE(scrollbar_->ScrollByContentsOffset(-1)); |
| 163 // Shrink and then re-exapnd the content. |
| 164 scrollbar_->Update(100, 100, 0); |
| 165 scrollbar_->Update(100, 101, 0); |
| 166 // Ensure the scrollbar allows scrolling to the end. |
| 167 EXPECT_TRUE(scrollbar_->ScrollByContentsOffset(-1)); |
| 168 } |
| 169 |
159 } // namespace views | 170 } // namespace views |
OLD | NEW |