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 "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/location.h" |
8 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" |
9 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
10 #include "base/test/test_timeouts.h" | 12 #include "base/test/test_timeouts.h" |
| 13 #include "base/thread_task_runner_handle.h" |
11 #include "base/values.h" | 14 #include "base/values.h" |
12 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
13 #include "base/win/windows_version.h" | 16 #include "base/win/windows_version.h" |
14 #endif | 17 #endif |
15 #include "content/browser/frame_host/navigation_controller_impl.h" | 18 #include "content/browser/frame_host/navigation_controller_impl.h" |
16 #include "content/browser/frame_host/navigation_entry_impl.h" | 19 #include "content/browser/frame_host/navigation_entry_impl.h" |
17 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" | 20 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" |
18 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 21 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
19 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
20 #include "content/browser/web_contents/web_contents_view.h" | 23 #include "content/browser/web_contents/web_contents_view.h" |
(...skipping 18 matching lines...) Expand all Loading... |
39 #include "ui/events/event_switches.h" | 42 #include "ui/events/event_switches.h" |
40 #include "ui/events/event_utils.h" | 43 #include "ui/events/event_utils.h" |
41 #include "ui/events/test/event_generator.h" | 44 #include "ui/events/test/event_generator.h" |
42 | 45 |
43 namespace { | 46 namespace { |
44 | 47 |
45 // TODO(tdresser): Find a way to avoid sleeping like this. See crbug.com/405282 | 48 // TODO(tdresser): Find a way to avoid sleeping like this. See crbug.com/405282 |
46 // for details. | 49 // for details. |
47 void GiveItSomeTime() { | 50 void GiveItSomeTime() { |
48 base::RunLoop run_loop; | 51 base::RunLoop run_loop; |
49 base::MessageLoop::current()->PostDelayedTask( | 52 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
50 FROM_HERE, | 53 FROM_HERE, run_loop.QuitClosure(), |
51 run_loop.QuitClosure(), | |
52 base::TimeDelta::FromMillisecondsD(10)); | 54 base::TimeDelta::FromMillisecondsD(10)); |
53 run_loop.Run(); | 55 run_loop.Run(); |
54 } | 56 } |
55 | 57 |
56 // WebContentsDelegate which tracks vertical overscroll updates. | 58 // WebContentsDelegate which tracks vertical overscroll updates. |
57 class VerticalOverscrollTracker : public content::WebContentsDelegate { | 59 class VerticalOverscrollTracker : public content::WebContentsDelegate { |
58 public: | 60 public: |
59 VerticalOverscrollTracker() : count_(0), completed_(false) {} | 61 VerticalOverscrollTracker() : count_(0), completed_(false) {} |
60 ~VerticalOverscrollTracker() override {} | 62 ~VerticalOverscrollTracker() override {} |
61 | 63 |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 details = dispatcher->OnEventFromSource(&release); | 1140 details = dispatcher->OnEventFromSource(&release); |
1139 ASSERT_FALSE(details.dispatcher_destroyed); | 1141 ASSERT_FALSE(details.dispatcher_destroyed); |
1140 WaitAFrame(); | 1142 WaitAFrame(); |
1141 | 1143 |
1142 EXPECT_LT(0, tracker.num_overscroll_updates()); | 1144 EXPECT_LT(0, tracker.num_overscroll_updates()); |
1143 EXPECT_FALSE(tracker.overscroll_completed()); | 1145 EXPECT_FALSE(tracker.overscroll_completed()); |
1144 } | 1146 } |
1145 } | 1147 } |
1146 | 1148 |
1147 } // namespace content | 1149 } // namespace content |
OLD | NEW |