| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/time.h" | 7 #include "base/time.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 8 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 9 #include "content/browser/renderer_host/smooth_scroll_gesture_controller.h" | 9 #include "content/browser/renderer_host/smooth_scroll_gesture_controller.h" |
| 10 #include "content/browser/renderer_host/test_render_view_host.h" | 10 #include "content/browser/renderer_host/test_render_view_host.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return rwh_; | 84 return rwh_; |
| 85 } | 85 } |
| 86 | 86 |
| 87 MockSmoothScrollGesture* mock_gesture_; | 87 MockSmoothScrollGesture* mock_gesture_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 class SmoothScrollGestureControllerTest : public testing::Test { | 90 class SmoothScrollGestureControllerTest : public testing::Test { |
| 91 public: | 91 public: |
| 92 SmoothScrollGestureControllerTest() : process_(NULL) { | 92 SmoothScrollGestureControllerTest() : process_(NULL) { |
| 93 } | 93 } |
| 94 ~SmoothScrollGestureControllerTest() { | 94 virtual ~SmoothScrollGestureControllerTest() {} |
| 95 } | |
| 96 | 95 |
| 97 protected: | 96 protected: |
| 98 // testing::Test implementation: | 97 // testing::Test implementation: |
| 99 virtual void SetUp() OVERRIDE { | 98 virtual void SetUp() OVERRIDE { |
| 100 browser_context_.reset(new TestBrowserContext()); | 99 browser_context_.reset(new TestBrowserContext()); |
| 101 delegate_.reset(new MockRenderWidgetHostDelegate()); | 100 delegate_.reset(new MockRenderWidgetHostDelegate()); |
| 102 process_ = new MockRenderProcessHost(browser_context_.get()); | 101 process_ = new MockRenderProcessHost(browser_context_.get()); |
| 103 #if defined(USE_AURA) | 102 #if defined(USE_AURA) |
| 104 screen_.reset(aura::TestScreen::Create()); | 103 screen_.reset(aura::TestScreen::Create()); |
| 105 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); | 104 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 EXPECT_EQ(original_gesture, view_->mock_gesture_); | 174 EXPECT_EQ(original_gesture, view_->mock_gesture_); |
| 176 | 175 |
| 177 // Ensure the smooth scroll is ticked. | 176 // Ensure the smooth scroll is ticked. |
| 178 PostQuitMessageAndRun(); | 177 PostQuitMessageAndRun(); |
| 179 EXPECT_LT(current_ticks, view_->mock_gesture_->called_); | 178 EXPECT_LT(current_ticks, view_->mock_gesture_->called_); |
| 180 } | 179 } |
| 181 | 180 |
| 182 } // namespace | 181 } // namespace |
| 183 | 182 |
| 184 } // namespace content | 183 } // namespace content |
| OLD | NEW |