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

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

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Created 4 years 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 "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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 712
713 fake_latency.AddLatencyNumberWithTimestamp( 713 fake_latency.AddLatencyNumberWithTimestamp(
714 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0, 714 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0,
715 base::TimeTicks() + 715 base::TimeTicks() +
716 base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2]), 716 base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2]),
717 1); 717 1);
718 718
719 // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck 719 // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
720 // overwriting components. 720 // overwriting components.
721 tracker()->ComputeInputLatencyHistograms( 721 tracker()->ComputeInputLatencyHistograms(
722 event.type, tracker()->latency_component_id(), fake_latency, 722 event.type(), tracker()->latency_component_id(), fake_latency,
723 blocking); 723 blocking);
724 724
725 tracker()->OnInputEventAck(event, &latency, 725 tracker()->OnInputEventAck(event, &latency,
726 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 726 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
727 } 727 }
728 728
729 { 729 {
730 // Touch move. 730 // Touch move.
731 ui::LatencyInfo latency; 731 ui::LatencyInfo latency;
732 event.MovePoint(0, 20, 20); 732 event.MovePoint(0, 20, 20);
(...skipping 23 matching lines...) Expand all
756 756
757 fake_latency.AddLatencyNumberWithTimestamp( 757 fake_latency.AddLatencyNumberWithTimestamp(
758 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0, 758 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0,
759 base::TimeTicks() + 759 base::TimeTicks() +
760 base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[2]), 760 base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[2]),
761 1); 761 1);
762 762
763 // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck 763 // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
764 // overwriting components. 764 // overwriting components.
765 tracker()->ComputeInputLatencyHistograms( 765 tracker()->ComputeInputLatencyHistograms(
766 event.type, tracker()->latency_component_id(), fake_latency, 766 event.type(), tracker()->latency_component_id(), fake_latency,
767 blocking); 767 blocking);
768 } 768 }
769 769
770 { 770 {
771 // Touch end. 771 // Touch end.
772 ui::LatencyInfo latency; 772 ui::LatencyInfo latency;
773 event.ReleasePoint(0); 773 event.ReleasePoint(0);
774 tracker()->OnInputEvent(event, &latency); 774 tracker()->OnInputEvent(event, &latency);
775 775
776 EXPECT_TRUE(latency.FindLatency( 776 EXPECT_TRUE(latency.FindLatency(
(...skipping 20 matching lines...) Expand all
797 797
798 fake_latency.AddLatencyNumberWithTimestamp( 798 fake_latency.AddLatencyNumberWithTimestamp(
799 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0, 799 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0,
800 base::TimeTicks() + 800 base::TimeTicks() +
801 base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[2]), 801 base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[2]),
802 1); 802 1);
803 803
804 // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck 804 // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
805 // overwriting components. 805 // overwriting components.
806 tracker()->ComputeInputLatencyHistograms( 806 tracker()->ComputeInputLatencyHistograms(
807 event.type, tracker()->latency_component_id(), fake_latency, 807 event.type(), tracker()->latency_component_id(), fake_latency,
808 blocking); 808 blocking);
809 } 809 }
810 } 810 }
811 811
812 // Touch start. 812 // Touch start.
813 EXPECT_THAT( 813 EXPECT_THAT(
814 histogram_tester().GetAllSamples( 814 histogram_tester().GetAllSamples(
815 "Event.Latency.QueueingTime.TouchStartDefaultPrevented"), 815 "Event.Latency.QueueingTime.TouchStartDefaultPrevented"),
816 ElementsAre(Bucket( 816 ElementsAre(Bucket(
817 touchstart_timestamps_ms[1] - touchstart_timestamps_ms[0], 1))); 817 touchstart_timestamps_ms[1] - touchstart_timestamps_ms[0], 1)));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"), 862 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"),
863 ElementsAre(Bucket( 863 ElementsAre(Bucket(
864 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); 864 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1)));
865 EXPECT_THAT(histogram_tester().GetAllSamples( 865 EXPECT_THAT(histogram_tester().GetAllSamples(
866 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"), 866 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"),
867 ElementsAre(Bucket( 867 ElementsAre(Bucket(
868 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); 868 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1)));
869 } 869 }
870 870
871 } // namespace content 871 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698