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

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

Issue 1971273002: Touch Action could cause wheel gestures to be filtered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make test separate Created 4 years, 7 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/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 "Event.Latency.ScrollUpdate.RendererSwapToBrowserNotified", 1)); 163 "Event.Latency.ScrollUpdate.RendererSwapToBrowserNotified", 1));
164 EXPECT_TRUE(HistogramSizeEq( 164 EXPECT_TRUE(HistogramSizeEq(
165 "Event.Latency.ScrollUpdate.BrowserNotifiedToBeforeGpuSwap", 1)); 165 "Event.Latency.ScrollUpdate.BrowserNotifiedToBeforeGpuSwap", 1));
166 EXPECT_TRUE(HistogramSizeEq("Event.Latency.ScrollUpdate.GpuSwap", 1)); 166 EXPECT_TRUE(HistogramSizeEq("Event.Latency.ScrollUpdate.GpuSwap", 1));
167 } 167 }
168 } 168 }
169 169
170 TEST_F(RenderWidgetHostLatencyTrackerTest, 170 TEST_F(RenderWidgetHostLatencyTrackerTest,
171 LatencyTerminatedOnAckIfRenderingNotScheduled) { 171 LatencyTerminatedOnAckIfRenderingNotScheduled) {
172 { 172 {
173 auto scroll = SyntheticWebGestureEventBuilder::BuildScrollBegin(5.f, -5.f); 173 auto scroll = SyntheticWebGestureEventBuilder::BuildScrollBegin(
174 5.f, -5.f, blink::WebGestureDeviceTouchscreen);
174 ui::LatencyInfo scroll_latency; 175 ui::LatencyInfo scroll_latency;
175 AddFakeComponents(*tracker(), &scroll_latency); 176 AddFakeComponents(*tracker(), &scroll_latency);
176 // Don't include the rendering schedule component, since we're testing the 177 // Don't include the rendering schedule component, since we're testing the
177 // case where rendering isn't scheduled. 178 // case where rendering isn't scheduled.
178 tracker()->OnInputEvent(scroll, &scroll_latency); 179 tracker()->OnInputEvent(scroll, &scroll_latency);
179 tracker()->OnInputEventAck(scroll, &scroll_latency); 180 tracker()->OnInputEventAck(scroll, &scroll_latency);
180 EXPECT_TRUE(scroll_latency.FindLatency( 181 EXPECT_TRUE(scroll_latency.FindLatency(
181 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, nullptr)); 182 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, nullptr));
182 EXPECT_TRUE(scroll_latency.terminated()); 183 EXPECT_TRUE(scroll_latency.terminated());
183 } 184 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 { 307 {
307 NativeWebKeyboardEvent event; 308 NativeWebKeyboardEvent event;
308 event.type = blink::WebKeyboardEvent::KeyDown; 309 event.type = blink::WebKeyboardEvent::KeyDown;
309 ui::LatencyInfo latency_info; 310 ui::LatencyInfo latency_info;
310 tracker()->OnInputEvent(event, &latency_info); 311 tracker()->OnInputEvent(event, &latency_info);
311 EXPECT_EQ(0u, latency_info.input_coordinates_size()); 312 EXPECT_EQ(0u, latency_info.input_coordinates_size());
312 } 313 }
313 } 314 }
314 315
315 TEST_F(RenderWidgetHostLatencyTrackerTest, ScrollLatency) { 316 TEST_F(RenderWidgetHostLatencyTrackerTest, ScrollLatency) {
316 auto scroll_begin = SyntheticWebGestureEventBuilder::BuildScrollBegin(5, -5); 317 auto scroll_begin = SyntheticWebGestureEventBuilder::BuildScrollBegin(
318 5, -5, blink::WebGestureDeviceTouchscreen);
317 ui::LatencyInfo scroll_latency; 319 ui::LatencyInfo scroll_latency;
318 scroll_latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 320 scroll_latency.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0,
319 0); 321 0);
320 tracker()->OnInputEvent(scroll_begin, &scroll_latency); 322 tracker()->OnInputEvent(scroll_begin, &scroll_latency);
321 EXPECT_TRUE( 323 EXPECT_TRUE(
322 scroll_latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 324 scroll_latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
323 tracker()->latency_component_id(), nullptr)); 325 tracker()->latency_component_id(), nullptr));
324 EXPECT_EQ(2U, scroll_latency.latency_components().size()); 326 EXPECT_EQ(2U, scroll_latency.latency_components().size());
325 327
326 // The first GestureScrollUpdate should be provided with 328 // The first GestureScrollUpdate should be provided with
(...skipping 29 matching lines...) Expand all
356 EXPECT_FALSE(scroll_latency.FindLatency( 358 EXPECT_FALSE(scroll_latency.FindLatency(
357 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, 359 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
358 tracker()->latency_component_id(), nullptr)); 360 tracker()->latency_component_id(), nullptr));
359 EXPECT_TRUE(scroll_latency.FindLatency( 361 EXPECT_TRUE(scroll_latency.FindLatency(
360 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, 362 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT,
361 tracker()->latency_component_id(), nullptr)); 363 tracker()->latency_component_id(), nullptr));
362 EXPECT_EQ(3U, scroll_latency.latency_components().size()); 364 EXPECT_EQ(3U, scroll_latency.latency_components().size());
363 } 365 }
364 366
365 } // namespace content 367 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698