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

Side by Side Diff: content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc

Issue 2341413002: New scroll latency metrics added for touch and wheel. (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/test/histogram_tester.h" 5 #include "base/test/histogram_tester.h"
6 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h" 6 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h"
7 #include "content/common/input/synthetic_web_input_event_builders.h" 7 #include "content/common/input/synthetic_web_input_event_builders.h"
8 #include "content/public/browser/native_web_keyboard_event.h" 8 #include "content/public/browser/native_web_keyboard_event.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 using base::Bucket; 12 using base::Bucket;
13 using blink::WebInputEvent; 13 using blink::WebInputEvent;
14 using testing::ElementsAre; 14 using testing::ElementsAre;
15 15
16 namespace content { 16 namespace content {
17 namespace { 17 namespace {
18 18
19 void AddFakeComponentsWithTimeStamp(
20 const RenderWidgetHostLatencyTracker& tracker,
21 ui::LatencyInfo* latency,
22 base::TimeTicks time_stamp) {
23 latency->AddLatencyNumberWithTimestamp(ui::INPUT_EVENT_LATENCY_UI_COMPONENT,
24 0, 0, time_stamp, 1);
25 latency->AddLatencyNumberWithTimestamp(
26 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, time_stamp,
27 1);
28 latency->AddLatencyNumberWithTimestamp(
29 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, time_stamp, 1);
30 latency->AddLatencyNumberWithTimestamp(
31 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
32 tracker.latency_component_id(), 0, time_stamp, 1);
33 latency->AddLatencyNumberWithTimestamp(
34 ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, 0, time_stamp, 1);
35 latency->AddLatencyNumberWithTimestamp(
36 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0,
37 time_stamp, 1);
38 }
39
19 void AddFakeComponents(const RenderWidgetHostLatencyTracker& tracker, 40 void AddFakeComponents(const RenderWidgetHostLatencyTracker& tracker,
20 ui::LatencyInfo* latency) { 41 ui::LatencyInfo* latency) {
21 latency->AddLatencyNumberWithTimestamp( 42 AddFakeComponentsWithTimeStamp(tracker, latency, base::TimeTicks::Now());
22 ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0, base::TimeTicks::Now(), 1);
23 latency->AddLatencyNumberWithTimestamp(
24 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0,
25 base::TimeTicks::Now(), 1);
26 latency->AddLatencyNumberWithTimestamp(
27 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0,
28 base::TimeTicks::Now(), 1);
29 latency->AddLatencyNumberWithTimestamp(
30 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
31 tracker.latency_component_id(), 0, base::TimeTicks::Now(), 1);
32 latency->AddLatencyNumberWithTimestamp(
33 ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, 0,
34 base::TimeTicks::Now(), 1);
35 latency->AddLatencyNumberWithTimestamp(
36 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0,
37 base::TimeTicks::Now(), 1);
38 } 43 }
39 44
40 void AddRenderingScheduledComponent(ui::LatencyInfo* latency, bool main) { 45 void AddRenderingScheduledComponent(ui::LatencyInfo* latency,
46 bool main,
47 base::TimeTicks time_stamp) {
41 if (main) { 48 if (main) {
42 latency->AddLatencyNumberWithTimestamp( 49 latency->AddLatencyNumberWithTimestamp(
43 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0, 0, 50 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0, 0,
44 base::TimeTicks::Now(), 1); 51 time_stamp, 1);
45 52
46 } else { 53 } else {
47 latency->AddLatencyNumberWithTimestamp( 54 latency->AddLatencyNumberWithTimestamp(
48 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, 0, 55 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, 0,
49 base::TimeTicks::Now(), 1); 56 time_stamp, 1);
50 } 57 }
51 } 58 }
52 59
53 } // namespace 60 } // namespace
54 61
55 class RenderWidgetHostLatencyTrackerTest : public testing::Test { 62 class RenderWidgetHostLatencyTrackerTest : public testing::Test {
56 public: 63 public:
57 RenderWidgetHostLatencyTrackerTest() { 64 RenderWidgetHostLatencyTrackerTest() {
58 tracker_.Initialize(kTestRoutingId, kTestProcessId); 65 tracker_.Initialize(kTestRoutingId, kTestProcessId);
59 ResetHistograms(); 66 ResetHistograms();
(...skipping 22 matching lines...) Expand all
82 } 89 }
83 90
84 private: 91 private:
85 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTrackerTest); 92 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTrackerTest);
86 const int kTestRoutingId = 3; 93 const int kTestRoutingId = 3;
87 const int kTestProcessId = 1; 94 const int kTestProcessId = 1;
88 std::unique_ptr<base::HistogramTester> histogram_tester_; 95 std::unique_ptr<base::HistogramTester> histogram_tester_;
89 RenderWidgetHostLatencyTracker tracker_; 96 RenderWidgetHostLatencyTracker tracker_;
90 }; 97 };
91 98
92 TEST_F(RenderWidgetHostLatencyTrackerTest, TestHistograms) { 99 TEST_F(RenderWidgetHostLatencyTrackerTest, WheelTestHistograms) {
93 for (bool rendering_on_main : { false, true }) { 100 for (bool rendering_on_main : {false, true}) {
101 for (bool is_running_navigation_hint_task : {false, true}) {
102 ResetHistograms();
103 {
104 auto wheel = SyntheticWebMouseWheelEventBuilder::Build(
105 blink::WebMouseWheelEvent::PhaseChanged);
106 base::TimeTicks now = base::TimeTicks::Now();
107 wheel.timeStampSeconds = (now - base::TimeTicks()).InSecondsF();
108 ui::LatencyInfo wheel_latency(ui::SourceEventType::WHEEL);
109 AddFakeComponentsWithTimeStamp(*tracker(), &wheel_latency, now);
110 AddRenderingScheduledComponent(&wheel_latency, rendering_on_main, now);
111 tracker()->OnInputEvent(wheel, &wheel_latency);
112 EXPECT_TRUE(wheel_latency.FindLatency(
113 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
114 tracker()->latency_component_id(), nullptr));
115 EXPECT_TRUE(wheel_latency.FindLatency(
116 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr));
117 EXPECT_EQ(1U, wheel_latency.input_coordinates_size());
118 tracker()->OnInputEventAck(wheel, &wheel_latency,
119 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
120 tracker()->OnFrameSwapped(wheel_latency,
121 is_running_navigation_hint_task);
122 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelUI", 1));
123 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1));
124
125 EXPECT_TRUE(HistogramSizeEq(
126 "Event.Latency.Wheel.ToFirstScrollUpdateSwapBegin", 1));
127
128 EXPECT_TRUE(
129 HistogramSizeEq("Event.Latency.ScrollUpdate.Wheel.ToHandled_Main",
130 rendering_on_main ? 1 : 0));
131 EXPECT_TRUE(
132 HistogramSizeEq("Event.Latency.ScrollUpdate.Wheel.ToHandled_Impl",
133 rendering_on_main ? 0 : 1));
134 EXPECT_TRUE(HistogramSizeEq(
135 "Event.Latency.ScrollUpdate.Wheel.HandledToRendererSwap_Main",
136 rendering_on_main ? 1 : 0));
137 EXPECT_TRUE(HistogramSizeEq(
138 "Event.Latency.ScrollUpdate.Wheel.HandledToRendererSwap_Impl",
139 rendering_on_main ? 0 : 1));
140 EXPECT_TRUE(HistogramSizeEq(
141 "Event.Latency.ScrollUpdate.Wheel.RendererSwapToBrowserNotified",
142 1));
143 EXPECT_TRUE(HistogramSizeEq(
144 "Event.Latency.ScrollUpdate.Wheel.BrowserNotifiedToBeforeGpuSwap",
145 1));
146 EXPECT_TRUE(
147 HistogramSizeEq("Event.Latency.ScrollUpdate.Wheel.GpuSwap", 1));
148 }
149 }
150 }
151 }
152
153 TEST_F(RenderWidgetHostLatencyTrackerTest, TouchTestHistograms) {
154 for (bool rendering_on_main : {false, true}) {
94 for (bool is_running_navigation_hint_task : {false, true}) { 155 for (bool is_running_navigation_hint_task : {false, true}) {
95 ResetHistograms(); 156 ResetHistograms();
96 { 157 {
97 auto scroll = SyntheticWebGestureEventBuilder::BuildScrollUpdate( 158 auto scroll = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
98 5.f, -5.f, 0, blink::WebGestureDeviceTouchscreen); 159 5.f, -5.f, 0, blink::WebGestureDeviceTouchscreen);
99 scroll.timeStampSeconds = 160 base::TimeTicks now = base::TimeTicks::Now();
100 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); 161 scroll.timeStampSeconds = (now - base::TimeTicks()).InSecondsF();
101 ui::LatencyInfo scroll_latency; 162 ui::LatencyInfo scroll_latency;
102 AddFakeComponents(*tracker(), &scroll_latency); 163 AddFakeComponentsWithTimeStamp(*tracker(), &scroll_latency, now);
103 AddRenderingScheduledComponent(&scroll_latency, rendering_on_main); 164 AddRenderingScheduledComponent(&scroll_latency, rendering_on_main, now);
104 tracker()->OnInputEvent(scroll, &scroll_latency); 165 tracker()->OnInputEvent(scroll, &scroll_latency);
105 EXPECT_TRUE(scroll_latency.FindLatency( 166 EXPECT_TRUE(scroll_latency.FindLatency(
106 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 167 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
107 tracker()->latency_component_id(), nullptr)); 168 tracker()->latency_component_id(), nullptr));
108 EXPECT_TRUE(scroll_latency.FindLatency( 169 EXPECT_TRUE(scroll_latency.FindLatency(
109 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr)); 170 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr));
110 EXPECT_EQ(1U, scroll_latency.input_coordinates_size()); 171 EXPECT_EQ(1U, scroll_latency.input_coordinates_size());
111 tracker()->OnInputEventAck(scroll, &scroll_latency, 172 tracker()->OnInputEventAck(scroll, &scroll_latency,
112 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 173 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
113 } 174 }
114 175
115 { 176 {
116 auto wheel = SyntheticWebMouseWheelEventBuilder::Build(
117 blink::WebMouseWheelEvent::PhaseChanged);
118 wheel.timeStampSeconds =
119 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
120 ui::LatencyInfo wheel_latency;
121 AddFakeComponents(*tracker(), &wheel_latency);
122 AddRenderingScheduledComponent(&wheel_latency, rendering_on_main);
123 tracker()->OnInputEvent(wheel, &wheel_latency);
124 EXPECT_TRUE(wheel_latency.FindLatency(
125 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
126 tracker()->latency_component_id(), nullptr));
127 EXPECT_TRUE(wheel_latency.FindLatency(
128 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr));
129 EXPECT_EQ(1U, wheel_latency.input_coordinates_size());
130 tracker()->OnInputEventAck(wheel, &wheel_latency,
131 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
132 }
133
134 {
135 SyntheticWebTouchEvent touch; 177 SyntheticWebTouchEvent touch;
136 touch.PressPoint(0, 0); 178 touch.PressPoint(0, 0);
137 touch.PressPoint(1, 1); 179 touch.PressPoint(1, 1);
138 ui::LatencyInfo touch_latency; 180 ui::LatencyInfo touch_latency(ui::SourceEventType::TOUCH);
139 AddFakeComponents(*tracker(), &touch_latency); 181 base::TimeTicks now = base::TimeTicks::Now();
140 AddRenderingScheduledComponent(&touch_latency, rendering_on_main); 182 AddFakeComponentsWithTimeStamp(*tracker(), &touch_latency, now);
183 AddRenderingScheduledComponent(&touch_latency, rendering_on_main, now);
141 tracker()->OnInputEvent(touch, &touch_latency); 184 tracker()->OnInputEvent(touch, &touch_latency);
142 EXPECT_TRUE(touch_latency.FindLatency( 185 EXPECT_TRUE(touch_latency.FindLatency(
143 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 186 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
144 tracker()->latency_component_id(), nullptr)); 187 tracker()->latency_component_id(), nullptr));
145 EXPECT_TRUE(touch_latency.FindLatency( 188 EXPECT_TRUE(touch_latency.FindLatency(
146 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr)); 189 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr));
147 EXPECT_EQ(2U, touch_latency.input_coordinates_size()); 190 EXPECT_EQ(2U, touch_latency.input_coordinates_size());
148 tracker()->OnInputEventAck(touch, &touch_latency, 191 tracker()->OnInputEventAck(touch, &touch_latency,
149 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 192 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
150 tracker()->OnFrameSwapped(touch_latency, 193 tracker()->OnFrameSwapped(touch_latency,
151 is_running_navigation_hint_task); 194 is_running_navigation_hint_task);
152 } 195 }
153 196
154 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelUI", 1));
155 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.TouchUI", 1)); 197 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.TouchUI", 1));
156 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1));
157 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.TouchAcked", 1)); 198 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.TouchAcked", 1));
199
158 EXPECT_TRUE(HistogramSizeEq( 200 EXPECT_TRUE(HistogramSizeEq(
159 "Event.Latency.TouchToFirstScrollUpdateSwapBegin", 1)); 201 "Event.Latency.TouchToFirstScrollUpdateSwapBegin", 1));
160 EXPECT_TRUE( 202 EXPECT_TRUE(
161 HistogramSizeEq("Event.Latency.TouchToFirstScrollUpdateSwapBegin_" 203 HistogramSizeEq("Event.Latency.TouchToFirstScrollUpdateSwapBegin_"
162 "IsRunningNavigationHintTask", 204 "IsRunningNavigationHintTask",
163 is_running_navigation_hint_task ? 1 : 0)); 205 is_running_navigation_hint_task ? 1 : 0));
164 EXPECT_TRUE( 206 EXPECT_TRUE(
165 HistogramSizeEq("Event.Latency.TouchToScrollUpdateSwapBegin", 1)); 207 HistogramSizeEq("Event.Latency.TouchToScrollUpdateSwapBegin", 1));
166 EXPECT_TRUE( 208 EXPECT_TRUE(
167 HistogramSizeEq("Event.Latency.TouchToScrollUpdateSwapBegin_" 209 HistogramSizeEq("Event.Latency.TouchToScrollUpdateSwapBegin_"
168 "IsRunningNavigationHintTask", 210 "IsRunningNavigationHintTask",
169 is_running_navigation_hint_task ? 1 : 0)); 211 is_running_navigation_hint_task ? 1 : 0));
170 EXPECT_TRUE( 212 EXPECT_TRUE(
171 HistogramSizeEq("Event.Latency.ScrollUpdate.TouchToHandled_Main", 213 HistogramSizeEq("Event.Latency.ScrollUpdate.TouchToHandled_Main",
172 rendering_on_main ? 1 : 0)); 214 rendering_on_main ? 1 : 0));
173 EXPECT_TRUE( 215 EXPECT_TRUE(
174 HistogramSizeEq("Event.Latency.ScrollUpdate.TouchToHandled_Impl", 216 HistogramSizeEq("Event.Latency.ScrollUpdate.TouchToHandled_Impl",
175 rendering_on_main ? 0 : 1)); 217 rendering_on_main ? 0 : 1));
176 EXPECT_TRUE(HistogramSizeEq( 218 EXPECT_TRUE(HistogramSizeEq(
177 "Event.Latency.ScrollUpdate.HandledToRendererSwap_Main", 219 "Event.Latency.ScrollUpdate.HandledToRendererSwap_Main",
178 rendering_on_main ? 1 : 0)); 220 rendering_on_main ? 1 : 0));
179 EXPECT_TRUE(HistogramSizeEq( 221 EXPECT_TRUE(HistogramSizeEq(
180 "Event.Latency.ScrollUpdate.HandledToRendererSwap_Impl", 222 "Event.Latency.ScrollUpdate.HandledToRendererSwap_Impl",
181 rendering_on_main ? 0 : 1)); 223 rendering_on_main ? 0 : 1));
182 EXPECT_TRUE(HistogramSizeEq( 224 EXPECT_TRUE(HistogramSizeEq(
183 "Event.Latency.ScrollUpdate.RendererSwapToBrowserNotified", 1)); 225 "Event.Latency.ScrollUpdate.RendererSwapToBrowserNotified", 1));
184 EXPECT_TRUE(HistogramSizeEq( 226 EXPECT_TRUE(HistogramSizeEq(
185 "Event.Latency.ScrollUpdate.BrowserNotifiedToBeforeGpuSwap", 1)); 227 "Event.Latency.ScrollUpdate.BrowserNotifiedToBeforeGpuSwap", 1));
186 EXPECT_TRUE(HistogramSizeEq("Event.Latency.ScrollUpdate.GpuSwap", 1)); 228 EXPECT_TRUE(HistogramSizeEq("Event.Latency.ScrollUpdate.GpuSwap", 1));
229
230 EXPECT_TRUE(HistogramSizeEq(
231 "Event.Latency.Touch.ToFirstScrollUpdateSwapBegin", 1));
232 EXPECT_TRUE(
233 HistogramSizeEq("Event.Latency.Touch.ToScrollUpdateSwapBegin", 1));
234
235 EXPECT_TRUE(
236 HistogramSizeEq("Event.Latency.ScrollUpdate.Touch.ToHandled_Main",
237 rendering_on_main ? 1 : 0));
238 EXPECT_TRUE(
239 HistogramSizeEq("Event.Latency.ScrollUpdate.Touch.ToHandled_Impl",
240 rendering_on_main ? 0 : 1));
241 EXPECT_TRUE(HistogramSizeEq(
242 "Event.Latency.ScrollUpdate.Touch.HandledToRendererSwap_Main",
243 rendering_on_main ? 1 : 0));
244 EXPECT_TRUE(HistogramSizeEq(
245 "Event.Latency.ScrollUpdate.Touch.HandledToRendererSwap_Impl",
246 rendering_on_main ? 0 : 1));
247 EXPECT_TRUE(HistogramSizeEq(
248 "Event.Latency.ScrollUpdate.Touch.RendererSwapToBrowserNotified", 1));
249 EXPECT_TRUE(HistogramSizeEq(
250 "Event.Latency.ScrollUpdate.Touch.BrowserNotifiedToBeforeGpuSwap",
251 1));
252 EXPECT_TRUE(
253 HistogramSizeEq("Event.Latency.ScrollUpdate.Touch.GpuSwap", 1));
187 } 254 }
188 } 255 }
189 } 256 }
190 257
191 TEST_F(RenderWidgetHostLatencyTrackerTest, 258 TEST_F(RenderWidgetHostLatencyTrackerTest,
192 LatencyTerminatedOnAckIfRenderingNotScheduled) { 259 LatencyTerminatedOnAckIfRenderingNotScheduled) {
193 { 260 {
194 auto scroll = SyntheticWebGestureEventBuilder::BuildScrollBegin( 261 auto scroll = SyntheticWebGestureEventBuilder::BuildScrollBegin(
195 5.f, -5.f, blink::WebGestureDeviceTouchscreen); 262 5.f, -5.f, blink::WebGestureDeviceTouchscreen);
196 ui::LatencyInfo scroll_latency; 263 ui::LatencyInfo scroll_latency;
197 AddFakeComponents(*tracker(), &scroll_latency); 264 AddFakeComponents(*tracker(), &scroll_latency);
198 // Don't include the rendering schedule component, since we're testing the 265 // Don't include the rendering schedule component, since we're testing
199 // case where rendering isn't scheduled. 266 // the case where rendering isn't scheduled.
200 tracker()->OnInputEvent(scroll, &scroll_latency); 267 tracker()->OnInputEvent(scroll, &scroll_latency);
201 tracker()->OnInputEventAck(scroll, &scroll_latency, 268 tracker()->OnInputEventAck(scroll, &scroll_latency,
202 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 269 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
203 EXPECT_TRUE(scroll_latency.FindLatency( 270 EXPECT_TRUE(scroll_latency.FindLatency(
204 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, nullptr)); 271 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, nullptr));
205 EXPECT_TRUE(scroll_latency.terminated()); 272 EXPECT_TRUE(scroll_latency.terminated());
206 } 273 }
207 274
208 { 275 {
209 auto wheel = SyntheticWebMouseWheelEventBuilder::Build( 276 auto wheel = SyntheticWebMouseWheelEventBuilder::Build(
(...skipping 16 matching lines...) Expand all
226 tracker()->OnInputEvent(touch, &touch_latency); 293 tracker()->OnInputEvent(touch, &touch_latency);
227 tracker()->OnInputEventAck(touch, &touch_latency, 294 tracker()->OnInputEventAck(touch, &touch_latency,
228 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 295 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
229 EXPECT_TRUE(touch_latency.FindLatency( 296 EXPECT_TRUE(touch_latency.FindLatency(
230 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, nullptr)); 297 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, nullptr));
231 EXPECT_TRUE(touch_latency.terminated()); 298 EXPECT_TRUE(touch_latency.terminated());
232 tracker()->OnFrameSwapped(touch_latency, false); 299 tracker()->OnFrameSwapped(touch_latency, false);
233 } 300 }
234 301
235 { 302 {
236 auto mouse_move = SyntheticWebMouseEventBuilder::Build( 303 auto mouse_move =
237 blink::WebMouseEvent::MouseMove); 304 SyntheticWebMouseEventBuilder::Build(blink::WebMouseEvent::MouseMove);
238 ui::LatencyInfo mouse_latency; 305 ui::LatencyInfo mouse_latency;
239 AddFakeComponents(*tracker(), &mouse_latency); 306 AddFakeComponents(*tracker(), &mouse_latency);
240 tracker()->OnInputEvent(mouse_move, &mouse_latency); 307 tracker()->OnInputEvent(mouse_move, &mouse_latency);
241 tracker()->OnInputEventAck(mouse_move, &mouse_latency, 308 tracker()->OnInputEventAck(mouse_move, &mouse_latency,
242 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 309 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
243 EXPECT_TRUE(mouse_latency.FindLatency( 310 EXPECT_TRUE(mouse_latency.FindLatency(
244 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, nullptr)); 311 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, nullptr));
245 EXPECT_TRUE(mouse_latency.terminated()); 312 EXPECT_TRUE(mouse_latency.terminated());
246 } 313 }
247 314
248 { 315 {
249 auto key_event = SyntheticWebKeyboardEventBuilder::Build( 316 auto key_event =
250 blink::WebKeyboardEvent::Char); 317 SyntheticWebKeyboardEventBuilder::Build(blink::WebKeyboardEvent::Char);
251 ui::LatencyInfo key_latency; 318 ui::LatencyInfo key_latency;
252 AddFakeComponents(*tracker(), &key_latency); 319 AddFakeComponents(*tracker(), &key_latency);
253 tracker()->OnInputEvent(key_event, &key_latency); 320 tracker()->OnInputEvent(key_event, &key_latency);
254 tracker()->OnInputEventAck(key_event, &key_latency, 321 tracker()->OnInputEventAck(key_event, &key_latency,
255 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 322 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
256 EXPECT_TRUE(key_latency.FindLatency( 323 EXPECT_TRUE(key_latency.FindLatency(
257 ui::INPUT_EVENT_LATENCY_TERMINATED_KEYBOARD_COMPONENT, 0, nullptr)); 324 ui::INPUT_EVENT_LATENCY_TERMINATED_KEYBOARD_COMPONENT, 0, nullptr));
258 EXPECT_TRUE(key_latency.terminated()); 325 EXPECT_TRUE(key_latency.terminated());
259 } 326 }
260 327
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"), 639 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"),
573 ElementsAre(Bucket( 640 ElementsAre(Bucket(
574 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); 641 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1)));
575 EXPECT_THAT(histogram_tester().GetAllSamples( 642 EXPECT_THAT(histogram_tester().GetAllSamples(
576 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"), 643 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"),
577 ElementsAre(Bucket( 644 ElementsAre(Bucket(
578 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); 645 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1)));
579 } 646 }
580 647
581 } // namespace content 648 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698