Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: ui/views/controls/scrollbar/scrollbar_unittest.cc

Issue 171423003: Update local BaseScrollBar::contents_scroll_offset_ on Update. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Keep disabled tests disabled. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/scrollbar/native_scroll_bar.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « ui/views/controls/scrollbar/native_scroll_bar.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698