| 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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   853  |   853  | 
|   854       fake_latency.AddLatencyNumberWithTimestamp( |   854       fake_latency.AddLatencyNumberWithTimestamp( | 
|   855           ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0, |   855           ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0, | 
|   856           base::TimeTicks() + |   856           base::TimeTicks() + | 
|   857               base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2]), |   857               base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2]), | 
|   858           1); |   858           1); | 
|   859  |   859  | 
|   860       // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck |   860       // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck | 
|   861       // overwriting components. |   861       // overwriting components. | 
|   862       tracker()->ComputeInputLatencyHistograms( |   862       tracker()->ComputeInputLatencyHistograms( | 
|   863           event.type, tracker()->latency_component_id(), fake_latency, |   863           event.type(), tracker()->latency_component_id(), fake_latency, | 
|   864           blocking); |   864           blocking); | 
|   865  |   865  | 
|   866       tracker()->OnInputEventAck(event, &latency, |   866       tracker()->OnInputEventAck(event, &latency, | 
|   867                                  INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |   867                                  INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 
|   868     } |   868     } | 
|   869  |   869  | 
|   870     { |   870     { | 
|   871       // Touch move. |   871       // Touch move. | 
|   872       ui::LatencyInfo latency; |   872       ui::LatencyInfo latency; | 
|   873       event.MovePoint(0, 20, 20); |   873       event.MovePoint(0, 20, 20); | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
|   897  |   897  | 
|   898       fake_latency.AddLatencyNumberWithTimestamp( |   898       fake_latency.AddLatencyNumberWithTimestamp( | 
|   899           ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0, |   899           ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0, | 
|   900           base::TimeTicks() + |   900           base::TimeTicks() + | 
|   901               base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[2]), |   901               base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[2]), | 
|   902           1); |   902           1); | 
|   903  |   903  | 
|   904       // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck |   904       // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck | 
|   905       // overwriting components. |   905       // overwriting components. | 
|   906       tracker()->ComputeInputLatencyHistograms( |   906       tracker()->ComputeInputLatencyHistograms( | 
|   907           event.type, tracker()->latency_component_id(), fake_latency, |   907           event.type(), tracker()->latency_component_id(), fake_latency, | 
|   908           blocking); |   908           blocking); | 
|   909     } |   909     } | 
|   910  |   910  | 
|   911     { |   911     { | 
|   912       // Touch end. |   912       // Touch end. | 
|   913       ui::LatencyInfo latency; |   913       ui::LatencyInfo latency; | 
|   914       event.ReleasePoint(0); |   914       event.ReleasePoint(0); | 
|   915       tracker()->OnInputEvent(event, &latency); |   915       tracker()->OnInputEvent(event, &latency); | 
|   916  |   916  | 
|   917       EXPECT_TRUE(latency.FindLatency( |   917       EXPECT_TRUE(latency.FindLatency( | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
|   938  |   938  | 
|   939       fake_latency.AddLatencyNumberWithTimestamp( |   939       fake_latency.AddLatencyNumberWithTimestamp( | 
|   940           ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0, |   940           ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0, | 
|   941           base::TimeTicks() + |   941           base::TimeTicks() + | 
|   942               base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[2]), |   942               base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[2]), | 
|   943           1); |   943           1); | 
|   944  |   944  | 
|   945       // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck |   945       // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck | 
|   946       // overwriting components. |   946       // overwriting components. | 
|   947       tracker()->ComputeInputLatencyHistograms( |   947       tracker()->ComputeInputLatencyHistograms( | 
|   948           event.type, tracker()->latency_component_id(), fake_latency, |   948           event.type(), tracker()->latency_component_id(), fake_latency, | 
|   949           blocking); |   949           blocking); | 
|   950     } |   950     } | 
|   951   } |   951   } | 
|   952  |   952  | 
|   953   // Touch start. |   953   // Touch start. | 
|   954   EXPECT_THAT( |   954   EXPECT_THAT( | 
|   955       histogram_tester().GetAllSamples( |   955       histogram_tester().GetAllSamples( | 
|   956           "Event.Latency.QueueingTime.TouchStartDefaultPrevented"), |   956           "Event.Latency.QueueingTime.TouchStartDefaultPrevented"), | 
|   957       ElementsAre(Bucket( |   957       ElementsAre(Bucket( | 
|   958           touchstart_timestamps_ms[1] - touchstart_timestamps_ms[0], 1))); |   958           touchstart_timestamps_ms[1] - touchstart_timestamps_ms[0], 1))); | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1003                   "Event.Latency.BlockingTime.TouchEndDefaultPrevented"), |  1003                   "Event.Latency.BlockingTime.TouchEndDefaultPrevented"), | 
|  1004               ElementsAre(Bucket( |  1004               ElementsAre(Bucket( | 
|  1005                   touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); |  1005                   touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); | 
|  1006   EXPECT_THAT(histogram_tester().GetAllSamples( |  1006   EXPECT_THAT(histogram_tester().GetAllSamples( | 
|  1007                   "Event.Latency.BlockingTime.TouchEndDefaultAllowed"), |  1007                   "Event.Latency.BlockingTime.TouchEndDefaultAllowed"), | 
|  1008               ElementsAre(Bucket( |  1008               ElementsAre(Bucket( | 
|  1009                   touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); |  1009                   touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); | 
|  1010 } |  1010 } | 
|  1011  |  1011  | 
|  1012 }  // namespace content |  1012 }  // namespace content | 
| OLD | NEW |