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

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

Issue 2039853004: Replace ui::LatencyInfo::InputCoordinate with gfx::PointF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing gyp dep Created 4 years, 6 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"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 TEST_F(RenderWidgetHostLatencyTrackerTest, InputCoordinatesPopulated) { 272 TEST_F(RenderWidgetHostLatencyTrackerTest, InputCoordinatesPopulated) {
273 { 273 {
274 auto event = 274 auto event =
275 SyntheticWebMouseWheelEventBuilder::Build(0, 0, -5, 0, 0, true); 275 SyntheticWebMouseWheelEventBuilder::Build(0, 0, -5, 0, 0, true);
276 event.x = 100; 276 event.x = 100;
277 event.y = 200; 277 event.y = 200;
278 ui::LatencyInfo latency_info; 278 ui::LatencyInfo latency_info;
279 tracker()->OnInputEvent(event, &latency_info); 279 tracker()->OnInputEvent(event, &latency_info);
280 EXPECT_EQ(1u, latency_info.input_coordinates_size()); 280 EXPECT_EQ(1u, latency_info.input_coordinates_size());
281 EXPECT_EQ(100, latency_info.input_coordinates()[0].x); 281 EXPECT_EQ(100, latency_info.input_coordinates()[0].x());
282 EXPECT_EQ(200, latency_info.input_coordinates()[0].y); 282 EXPECT_EQ(200, latency_info.input_coordinates()[0].y());
283 } 283 }
284 284
285 { 285 {
286 auto event = SyntheticWebMouseEventBuilder::Build(WebInputEvent::MouseMove); 286 auto event = SyntheticWebMouseEventBuilder::Build(WebInputEvent::MouseMove);
287 event.x = 300; 287 event.x = 300;
288 event.y = 400; 288 event.y = 400;
289 ui::LatencyInfo latency_info; 289 ui::LatencyInfo latency_info;
290 tracker()->OnInputEvent(event, &latency_info); 290 tracker()->OnInputEvent(event, &latency_info);
291 EXPECT_EQ(1u, latency_info.input_coordinates_size()); 291 EXPECT_EQ(1u, latency_info.input_coordinates_size());
292 EXPECT_EQ(300, latency_info.input_coordinates()[0].x); 292 EXPECT_EQ(300, latency_info.input_coordinates()[0].x());
293 EXPECT_EQ(400, latency_info.input_coordinates()[0].y); 293 EXPECT_EQ(400, latency_info.input_coordinates()[0].y());
294 } 294 }
295 295
296 { 296 {
297 auto event = SyntheticWebGestureEventBuilder::Build( 297 auto event = SyntheticWebGestureEventBuilder::Build(
298 WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchscreen); 298 WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchscreen);
299 event.x = 500; 299 event.x = 500;
300 event.y = 600; 300 event.y = 600;
301 ui::LatencyInfo latency_info; 301 ui::LatencyInfo latency_info;
302 tracker()->OnInputEvent(event, &latency_info); 302 tracker()->OnInputEvent(event, &latency_info);
303 EXPECT_EQ(1u, latency_info.input_coordinates_size()); 303 EXPECT_EQ(1u, latency_info.input_coordinates_size());
304 EXPECT_EQ(500, latency_info.input_coordinates()[0].x); 304 EXPECT_EQ(500, latency_info.input_coordinates()[0].x());
305 EXPECT_EQ(600, latency_info.input_coordinates()[0].y); 305 EXPECT_EQ(600, latency_info.input_coordinates()[0].y());
306 } 306 }
307 307
308 { 308 {
309 SyntheticWebTouchEvent event; 309 SyntheticWebTouchEvent event;
310 event.PressPoint(700, 800); 310 event.PressPoint(700, 800);
311 event.PressPoint(900, 1000); 311 event.PressPoint(900, 1000);
312 event.PressPoint(1100, 1200); // LatencyInfo only holds two coordinates. 312 event.PressPoint(1100, 1200); // LatencyInfo only holds two coordinates.
313 ui::LatencyInfo latency_info; 313 ui::LatencyInfo latency_info;
314 tracker()->OnInputEvent(event, &latency_info); 314 tracker()->OnInputEvent(event, &latency_info);
315 EXPECT_EQ(2u, latency_info.input_coordinates_size()); 315 EXPECT_EQ(2u, latency_info.input_coordinates_size());
316 EXPECT_EQ(700, latency_info.input_coordinates()[0].x); 316 EXPECT_EQ(700, latency_info.input_coordinates()[0].x());
317 EXPECT_EQ(800, latency_info.input_coordinates()[0].y); 317 EXPECT_EQ(800, latency_info.input_coordinates()[0].y());
318 EXPECT_EQ(900, latency_info.input_coordinates()[1].x); 318 EXPECT_EQ(900, latency_info.input_coordinates()[1].x());
319 EXPECT_EQ(1000, latency_info.input_coordinates()[1].y); 319 EXPECT_EQ(1000, latency_info.input_coordinates()[1].y());
320 } 320 }
321 321
322 { 322 {
323 NativeWebKeyboardEvent event; 323 NativeWebKeyboardEvent event;
324 event.type = blink::WebKeyboardEvent::KeyDown; 324 event.type = blink::WebKeyboardEvent::KeyDown;
325 ui::LatencyInfo latency_info; 325 ui::LatencyInfo latency_info;
326 tracker()->OnInputEvent(event, &latency_info); 326 tracker()->OnInputEvent(event, &latency_info);
327 EXPECT_EQ(0u, latency_info.input_coordinates_size()); 327 EXPECT_EQ(0u, latency_info.input_coordinates_size());
328 } 328 }
329 } 329 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 ElementsAre(Bucket(4, 1))); 431 ElementsAre(Bucket(4, 1)));
432 EXPECT_THAT(histogram_tester().GetAllSamples( 432 EXPECT_THAT(histogram_tester().GetAllSamples(
433 "Event.Latency.BlockingTime.TouchMoveDefaultPrevented"), 433 "Event.Latency.BlockingTime.TouchMoveDefaultPrevented"),
434 ElementsAre(Bucket(7, 1))); 434 ElementsAre(Bucket(7, 1)));
435 EXPECT_THAT(histogram_tester().GetAllSamples( 435 EXPECT_THAT(histogram_tester().GetAllSamples(
436 "Event.Latency.BlockingTime.TouchMoveDefaultAllowed"), 436 "Event.Latency.BlockingTime.TouchMoveDefaultAllowed"),
437 ElementsAre(Bucket(7, 1))); 437 ElementsAre(Bucket(7, 1)));
438 } 438 }
439 439
440 } // namespace content 440 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/render_widget_host_latency_tracker.cc ('k') | tools/ipc_fuzzer/fuzzer/fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698