| OLD | NEW |
| 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 Loading... |
| 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.position.x = 100; |
| 675 event.y = 200; | 675 event.position.y = 200; |
| 676 ui::LatencyInfo latency_info; | 676 ui::LatencyInfo latency_info; |
| 677 tracker()->OnInputEvent(event, &latency_info); | 677 tracker()->OnInputEvent(event, &latency_info); |
| 678 EXPECT_EQ(1u, latency_info.input_coordinates_size()); | 678 EXPECT_EQ(1u, latency_info.input_coordinates_size()); |
| 679 EXPECT_EQ(100, latency_info.input_coordinates()[0].x()); | 679 EXPECT_EQ(100, latency_info.input_coordinates()[0].x()); |
| 680 EXPECT_EQ(200, latency_info.input_coordinates()[0].y()); | 680 EXPECT_EQ(200, latency_info.input_coordinates()[0].y()); |
| 681 } | 681 } |
| 682 | 682 |
| 683 { | 683 { |
| 684 auto event = SyntheticWebMouseEventBuilder::Build(WebInputEvent::MouseMove); | 684 auto event = SyntheticWebMouseEventBuilder::Build(WebInputEvent::MouseMove); |
| 685 event.x = 300; | 685 event.position.x = 300; |
| 686 event.y = 400; | 686 event.position.y = 400; |
| 687 ui::LatencyInfo latency_info; | 687 ui::LatencyInfo latency_info; |
| 688 tracker()->OnInputEvent(event, &latency_info); | 688 tracker()->OnInputEvent(event, &latency_info); |
| 689 EXPECT_EQ(1u, latency_info.input_coordinates_size()); | 689 EXPECT_EQ(1u, latency_info.input_coordinates_size()); |
| 690 EXPECT_EQ(300, latency_info.input_coordinates()[0].x()); | 690 EXPECT_EQ(300, latency_info.input_coordinates()[0].x()); |
| 691 EXPECT_EQ(400, latency_info.input_coordinates()[0].y()); | 691 EXPECT_EQ(400, latency_info.input_coordinates()[0].y()); |
| 692 } | 692 } |
| 693 | 693 |
| 694 { | 694 { |
| 695 auto event = SyntheticWebGestureEventBuilder::Build( | 695 auto event = SyntheticWebGestureEventBuilder::Build( |
| 696 WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchscreen); | 696 WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchscreen); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"), | 960 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"), |
| 961 ElementsAre(Bucket( | 961 ElementsAre(Bucket( |
| 962 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); | 962 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); |
| 963 EXPECT_THAT(histogram_tester().GetAllSamples( | 963 EXPECT_THAT(histogram_tester().GetAllSamples( |
| 964 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"), | 964 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"), |
| 965 ElementsAre(Bucket( | 965 ElementsAre(Bucket( |
| 966 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); | 966 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); |
| 967 } | 967 } |
| 968 | 968 |
| 969 } // namespace content | 969 } // namespace content |
| OLD | NEW |