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

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

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm Created 3 years, 8 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 "components/rappor/public/rappor_utils.h" 6 #include "components/rappor/public/rappor_utils.h"
7 #include "components/rappor/test_rappor_service.h" 7 #include "components/rappor/test_rappor_service.h"
8 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h" 8 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h"
9 #include "content/common/input/synthetic_web_input_event_builders.h" 9 #include "content/common/input/synthetic_web_input_event_builders.h"
10 #include "content/public/browser/native_web_keyboard_event.h" 10 #include "content/public/browser/native_web_keyboard_event.h"
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 "Event.Latency.ScrollUpdate.RendererSwapToBrowserNotified", 0)); 664 "Event.Latency.ScrollUpdate.RendererSwapToBrowserNotified", 0));
665 EXPECT_TRUE(HistogramSizeEq( 665 EXPECT_TRUE(HistogramSizeEq(
666 "Event.Latency.ScrollUpdate.BrowserNotifiedToBeforeGpuSwap", 0)); 666 "Event.Latency.ScrollUpdate.BrowserNotifiedToBeforeGpuSwap", 0));
667 EXPECT_TRUE(HistogramSizeEq("Event.Latency.ScrollUpdate.GpuSwap", 0)); 667 EXPECT_TRUE(HistogramSizeEq("Event.Latency.ScrollUpdate.GpuSwap", 0));
668 } 668 }
669 669
670 TEST_F(RenderWidgetHostLatencyTrackerTest, InputCoordinatesPopulated) { 670 TEST_F(RenderWidgetHostLatencyTrackerTest, InputCoordinatesPopulated) {
671 { 671 {
672 auto event = 672 auto event =
673 SyntheticWebMouseWheelEventBuilder::Build(0, 0, -5, 0, 0, true); 673 SyntheticWebMouseWheelEventBuilder::Build(0, 0, -5, 0, 0, true);
674 event.x = 100; 674 event.setPositionInWidget(100, 200);
675 event.y = 200;
676 ui::LatencyInfo latency_info; 675 ui::LatencyInfo latency_info;
677 tracker()->OnInputEvent(event, &latency_info); 676 tracker()->OnInputEvent(event, &latency_info);
678 EXPECT_EQ(1u, latency_info.input_coordinates_size()); 677 EXPECT_EQ(1u, latency_info.input_coordinates_size());
679 EXPECT_EQ(100, latency_info.input_coordinates()[0].x()); 678 EXPECT_EQ(100, latency_info.input_coordinates()[0].x());
680 EXPECT_EQ(200, latency_info.input_coordinates()[0].y()); 679 EXPECT_EQ(200, latency_info.input_coordinates()[0].y());
681 } 680 }
682 681
683 { 682 {
684 auto event = SyntheticWebMouseEventBuilder::Build(WebInputEvent::MouseMove); 683 auto event = SyntheticWebMouseEventBuilder::Build(WebInputEvent::MouseMove);
685 event.x = 300; 684 event.setPositionInWidget(300, 400);
686 event.y = 400;
687 ui::LatencyInfo latency_info; 685 ui::LatencyInfo latency_info;
688 tracker()->OnInputEvent(event, &latency_info); 686 tracker()->OnInputEvent(event, &latency_info);
689 EXPECT_EQ(1u, latency_info.input_coordinates_size()); 687 EXPECT_EQ(1u, latency_info.input_coordinates_size());
690 EXPECT_EQ(300, latency_info.input_coordinates()[0].x()); 688 EXPECT_EQ(300, latency_info.input_coordinates()[0].x());
691 EXPECT_EQ(400, latency_info.input_coordinates()[0].y()); 689 EXPECT_EQ(400, latency_info.input_coordinates()[0].y());
692 } 690 }
693 691
694 { 692 {
695 auto event = SyntheticWebGestureEventBuilder::Build( 693 auto event = SyntheticWebGestureEventBuilder::Build(
696 WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchscreen); 694 WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchscreen);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"), 958 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"),
961 ElementsAre(Bucket( 959 ElementsAre(Bucket(
962 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); 960 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1)));
963 EXPECT_THAT(histogram_tester().GetAllSamples( 961 EXPECT_THAT(histogram_tester().GetAllSamples(
964 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"), 962 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"),
965 ElementsAre(Bucket( 963 ElementsAre(Bucket(
966 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); 964 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1)));
967 } 965 }
968 966
969 } // namespace content 967 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698