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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 delegate_.reset(); | 116 delegate_.reset(); |
117 process_ = NULL; | 117 process_ = NULL; |
118 browser_context_.reset(); | 118 browser_context_.reset(); |
119 | 119 |
120 #if defined(USE_AURA) | 120 #if defined(USE_AURA) |
121 aura::Env::DeleteInstance(); | 121 aura::Env::DeleteInstance(); |
122 screen_.reset(); | 122 screen_.reset(); |
123 #endif | 123 #endif |
124 | 124 |
125 // Process all pending tasks to avoid leaks. | 125 // Process all pending tasks to avoid leaks. |
126 MessageLoop::current()->RunUntilIdle(); | 126 base::MessageLoop::current()->RunUntilIdle(); |
127 } | 127 } |
128 | 128 |
129 void PostQuitMessageAndRun() { | 129 void PostQuitMessageAndRun() { |
130 // Allow the message loop to process pending synthetic scrolls, then quit. | 130 // Allow the message loop to process pending synthetic scrolls, then quit. |
131 MessageLoop::current()->PostDelayedTask( | 131 base::MessageLoop::current()->PostDelayedTask( |
132 FROM_HERE, MessageLoop::QuitClosure(), | 132 FROM_HERE, base::MessageLoop::QuitClosure(), |
133 TimeDelta::FromMilliseconds( | 133 TimeDelta::FromMilliseconds( |
134 controller_.GetSyntheticScrollMessageInterval().InMilliseconds() * | 134 controller_.GetSyntheticScrollMessageInterval().InMilliseconds() * |
135 3)); | 135 3)); |
136 MessageLoop::current()->Run(); | 136 base::MessageLoop::current()->Run(); |
137 } | 137 } |
138 | 138 |
139 MessageLoopForUI message_loop_; | 139 base::MessageLoopForUI message_loop_; |
140 | 140 |
141 scoped_ptr<TestBrowserContext> browser_context_; | 141 scoped_ptr<TestBrowserContext> browser_context_; |
142 MockRenderProcessHost* process_; // Deleted automatically by the widget. | 142 MockRenderProcessHost* process_; // Deleted automatically by the widget. |
143 scoped_ptr<MockRenderWidgetHostDelegate> delegate_; | 143 scoped_ptr<MockRenderWidgetHostDelegate> delegate_; |
144 scoped_ptr<MockRenderWidgetHost> host_; | 144 scoped_ptr<MockRenderWidgetHost> host_; |
145 scoped_ptr<TestView> view_; | 145 scoped_ptr<TestView> view_; |
146 #if defined(USE_AURA) | 146 #if defined(USE_AURA) |
147 scoped_ptr<gfx::Screen> screen_; | 147 scoped_ptr<gfx::Screen> screen_; |
148 #endif | 148 #endif |
149 | 149 |
(...skipping 24 matching lines...) Expand all Loading... |
174 EXPECT_EQ(original_gesture, view_->mock_gesture_); | 174 EXPECT_EQ(original_gesture, view_->mock_gesture_); |
175 | 175 |
176 // Ensure the smooth scroll is ticked. | 176 // Ensure the smooth scroll is ticked. |
177 PostQuitMessageAndRun(); | 177 PostQuitMessageAndRun(); |
178 EXPECT_LT(current_ticks, view_->mock_gesture_->called_); | 178 EXPECT_LT(current_ticks, view_->mock_gesture_->called_); |
179 } | 179 } |
180 | 180 |
181 } // namespace | 181 } // namespace |
182 | 182 |
183 } // namespace content | 183 } // namespace content |
OLD | NEW |