| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 virtual void SetUp() { | 57 virtual void SetUp() { |
| 58 ViewsTestBase::SetUp(); | 58 ViewsTestBase::SetUp(); |
| 59 controller_.reset(new TestScrollBarController()); | 59 controller_.reset(new TestScrollBarController()); |
| 60 | 60 |
| 61 ASSERT_FALSE(scrollbar_); | 61 ASSERT_FALSE(scrollbar_); |
| 62 native_scrollbar_ = new NativeScrollBar(true); | 62 native_scrollbar_ = new NativeScrollBar(true); |
| 63 native_scrollbar_->SetBounds(0, 0, 100, 100); | 63 native_scrollbar_->SetBounds(0, 0, 100, 100); |
| 64 native_scrollbar_->set_controller(controller_.get()); | 64 native_scrollbar_->set_controller(controller_.get()); |
| 65 | 65 |
| 66 widget_ = new Widget; | 66 widget_ = new Widget; |
| 67 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); | 67 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); |
| 68 params.bounds = gfx::Rect(0, 0, 100, 100); | 68 params.bounds = gfx::Rect(0, 0, 100, 100); |
| 69 widget_->Init(params); | 69 widget_->Init(params); |
| 70 View* container = new View(); | 70 View* container = new View(); |
| 71 widget_->SetContentsView(container); | 71 widget_->SetContentsView(container); |
| 72 container->AddChildView(native_scrollbar_); | 72 container->AddChildView(native_scrollbar_); |
| 73 | 73 |
| 74 scrollbar_ = | 74 scrollbar_ = |
| 75 static_cast<NativeScrollBarViews*>(native_scrollbar_->native_wrapper_); | 75 static_cast<NativeScrollBarViews*>(native_scrollbar_->native_wrapper_); |
| 76 scrollbar_->SetBounds(0, 0, 100, 100); | 76 scrollbar_->SetBounds(0, 0, 100, 100); |
| 77 scrollbar_->Update(100, 200, 0); | 77 scrollbar_->Update(100, 200, 0); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 EXPECT_EQ(controller_->last_position, 0); | 138 EXPECT_EQ(controller_->last_position, 0); |
| 139 | 139 |
| 140 scrollbar_->ScrollByAmount(BaseScrollBar::SCROLL_NEXT_PAGE); | 140 scrollbar_->ScrollByAmount(BaseScrollBar::SCROLL_NEXT_PAGE); |
| 141 EXPECT_EQ(controller_->last_position, 20); | 141 EXPECT_EQ(controller_->last_position, 20); |
| 142 | 142 |
| 143 scrollbar_->ScrollByAmount(BaseScrollBar::SCROLL_PREV_PAGE); | 143 scrollbar_->ScrollByAmount(BaseScrollBar::SCROLL_PREV_PAGE); |
| 144 EXPECT_EQ(controller_->last_position, 0); | 144 EXPECT_EQ(controller_->last_position, 0); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace views | 147 } // namespace views |
| OLD | NEW |