| 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 "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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 EXPECT_TRUE(wheel_latency.FindLatency( | 114 EXPECT_TRUE(wheel_latency.FindLatency( |
| 115 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr)); | 115 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr)); |
| 116 EXPECT_EQ(1U, wheel_latency.input_coordinates_size()); | 116 EXPECT_EQ(1U, wheel_latency.input_coordinates_size()); |
| 117 tracker()->OnInputEventAck(wheel, &wheel_latency, | 117 tracker()->OnInputEventAck(wheel, &wheel_latency, |
| 118 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 118 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 119 tracker()->OnFrameSwapped(wheel_latency, | 119 tracker()->OnFrameSwapped(wheel_latency, |
| 120 is_running_navigation_hint_task); | 120 is_running_navigation_hint_task); |
| 121 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelUI", 1)); | 121 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelUI", 1)); |
| 122 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1)); | 122 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1)); |
| 123 | 123 |
| 124 EXPECT_TRUE(HistogramSizeEq( | 124 EXPECT_TRUE( |
| 125 "Event.Latency.Wheel.TimeToFirstScrollUpdateSwapBegin2", 1)); | 125 HistogramSizeEq("Event.Latency.ScrollUpdate.Wheel." |
| 126 "TimeToFirstScrollUpdateSwapBegin2", |
| 127 1)); |
| 126 | 128 |
| 127 EXPECT_TRUE(HistogramSizeEq( | 129 EXPECT_TRUE(HistogramSizeEq( |
| 128 "Event.Latency.ScrollUpdate.Wheel.TimeToHandled2_Main", | 130 "Event.Latency.ScrollUpdate.Wheel.TimeToHandled2_Main", |
| 129 rendering_on_main ? 1 : 0)); | 131 rendering_on_main ? 1 : 0)); |
| 130 EXPECT_TRUE(HistogramSizeEq( | 132 EXPECT_TRUE(HistogramSizeEq( |
| 131 "Event.Latency.ScrollUpdate.Wheel.TimeToHandled2_Impl", | 133 "Event.Latency.ScrollUpdate.Wheel.TimeToHandled2_Impl", |
| 132 rendering_on_main ? 0 : 1)); | 134 rendering_on_main ? 0 : 1)); |
| 133 EXPECT_TRUE(HistogramSizeEq( | 135 EXPECT_TRUE(HistogramSizeEq( |
| 134 "Event.Latency.ScrollUpdate.Wheel.HandledToRendererSwap2_Main", | 136 "Event.Latency.ScrollUpdate.Wheel.HandledToRendererSwap2_Main", |
| 135 rendering_on_main ? 1 : 0)); | 137 rendering_on_main ? 1 : 0)); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 rendering_on_main ? 1 : 0)); | 220 rendering_on_main ? 1 : 0)); |
| 219 EXPECT_TRUE(HistogramSizeEq( | 221 EXPECT_TRUE(HistogramSizeEq( |
| 220 "Event.Latency.ScrollUpdate.HandledToRendererSwap_Impl", | 222 "Event.Latency.ScrollUpdate.HandledToRendererSwap_Impl", |
| 221 rendering_on_main ? 0 : 1)); | 223 rendering_on_main ? 0 : 1)); |
| 222 EXPECT_TRUE(HistogramSizeEq( | 224 EXPECT_TRUE(HistogramSizeEq( |
| 223 "Event.Latency.ScrollUpdate.RendererSwapToBrowserNotified", 1)); | 225 "Event.Latency.ScrollUpdate.RendererSwapToBrowserNotified", 1)); |
| 224 EXPECT_TRUE(HistogramSizeEq( | 226 EXPECT_TRUE(HistogramSizeEq( |
| 225 "Event.Latency.ScrollUpdate.BrowserNotifiedToBeforeGpuSwap", 1)); | 227 "Event.Latency.ScrollUpdate.BrowserNotifiedToBeforeGpuSwap", 1)); |
| 226 EXPECT_TRUE(HistogramSizeEq("Event.Latency.ScrollUpdate.GpuSwap", 1)); | 228 EXPECT_TRUE(HistogramSizeEq("Event.Latency.ScrollUpdate.GpuSwap", 1)); |
| 227 EXPECT_TRUE(HistogramSizeEq( | 229 EXPECT_TRUE(HistogramSizeEq( |
| 228 "Event.Latency.Touch.TimeToFirstScrollUpdateSwapBegin2", 1)); | 230 "Event.Latency.ScrollUpdate.Touch.TimeToFirstScrollUpdateSwapBegin2", |
| 231 1)); |
| 229 | 232 |
| 230 EXPECT_TRUE(HistogramSizeEq( | 233 EXPECT_TRUE(HistogramSizeEq( |
| 231 "Event.Latency.Touch.TimeToScrollUpdateSwapBegin2", 0)); | 234 "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2", 0)); |
| 232 | 235 |
| 233 EXPECT_TRUE(HistogramSizeEq( | 236 EXPECT_TRUE(HistogramSizeEq( |
| 234 "Event.Latency.ScrollUpdate.Touch.TimeToHandled2_Main", | 237 "Event.Latency.ScrollUpdate.Touch.TimeToHandled2_Main", |
| 235 rendering_on_main ? 1 : 0)); | 238 rendering_on_main ? 1 : 0)); |
| 236 EXPECT_TRUE(HistogramSizeEq( | 239 EXPECT_TRUE(HistogramSizeEq( |
| 237 "Event.Latency.ScrollUpdate.Touch.TimeToHandled2_Impl", | 240 "Event.Latency.ScrollUpdate.Touch.TimeToHandled2_Impl", |
| 238 rendering_on_main ? 0 : 1)); | 241 rendering_on_main ? 0 : 1)); |
| 239 EXPECT_TRUE(HistogramSizeEq( | 242 EXPECT_TRUE(HistogramSizeEq( |
| 240 "Event.Latency.ScrollUpdate.Touch.HandledToRendererSwap2_Main", | 243 "Event.Latency.ScrollUpdate.Touch.HandledToRendererSwap2_Main", |
| 241 rendering_on_main ? 1 : 0)); | 244 rendering_on_main ? 1 : 0)); |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"), | 641 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"), |
| 639 ElementsAre(Bucket( | 642 ElementsAre(Bucket( |
| 640 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); | 643 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); |
| 641 EXPECT_THAT(histogram_tester().GetAllSamples( | 644 EXPECT_THAT(histogram_tester().GetAllSamples( |
| 642 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"), | 645 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"), |
| 643 ElementsAre(Bucket( | 646 ElementsAre(Bucket( |
| 644 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); | 647 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); |
| 645 } | 648 } |
| 646 | 649 |
| 647 } // namespace content | 650 } // namespace content |
| OLD | NEW |