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 17 matching lines...) Expand all Loading... |
28 latency->AddLatencyNumberWithTimestamp(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, | 28 latency->AddLatencyNumberWithTimestamp(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, |
29 0, 0, time_stamp, 1); | 29 0, 0, time_stamp, 1); |
30 latency->AddLatencyNumberWithTimestamp( | 30 latency->AddLatencyNumberWithTimestamp( |
31 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, time_stamp, | 31 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, time_stamp, |
32 1); | 32 1); |
33 latency->AddLatencyNumberWithTimestamp( | 33 latency->AddLatencyNumberWithTimestamp( |
34 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, time_stamp, 1); | 34 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, time_stamp, 1); |
35 latency->AddLatencyNumberWithTimestamp( | 35 latency->AddLatencyNumberWithTimestamp( |
36 ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, 0, time_stamp, 1); | 36 ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, 0, time_stamp, 1); |
37 latency->AddLatencyNumberWithTimestamp( | 37 latency->AddLatencyNumberWithTimestamp( |
38 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0, | 38 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, 0, 0, time_stamp, 1); |
39 time_stamp, 1); | |
40 } | 39 } |
41 | 40 |
42 void AddFakeComponents(const RenderWidgetHostLatencyTracker& tracker, | 41 void AddFakeComponents(const RenderWidgetHostLatencyTracker& tracker, |
43 ui::LatencyInfo* latency) { | 42 ui::LatencyInfo* latency) { |
44 latency->AddLatencyNumberWithTimestamp( | 43 latency->AddLatencyNumberWithTimestamp( |
45 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, | 44 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, |
46 tracker.latency_component_id(), 0, base::TimeTicks::Now(), 1); | 45 tracker.latency_component_id(), 0, base::TimeTicks::Now(), 1); |
47 AddFakeComponentsWithTimeStamp(tracker, latency, base::TimeTicks::Now()); | 46 AddFakeComponentsWithTimeStamp(tracker, latency, base::TimeTicks::Now()); |
48 } | 47 } |
49 | 48 |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 | 1077 |
1079 tracker()->OnInputEventAck(wheel_event, &latency, ack_state); | 1078 tracker()->OnInputEventAck(wheel_event, &latency, ack_state); |
1080 } | 1079 } |
1081 | 1080 |
1082 EXPECT_THAT(histogram_tester().GetAllSamples( | 1081 EXPECT_THAT(histogram_tester().GetAllSamples( |
1083 "Event.Latency.QueueingTime.MouseWheelDefaultAllowed"), | 1082 "Event.Latency.QueueingTime.MouseWheelDefaultAllowed"), |
1084 ElementsAre(Bucket(14, 1))); | 1083 ElementsAre(Bucket(14, 1))); |
1085 } | 1084 } |
1086 | 1085 |
1087 } // namespace content | 1086 } // namespace content |
OLD | NEW |