summaryrefslogtreecommitdiffstats
path: root/chromium/cc/metrics/compositor_frame_reporter_unittest.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-10-26 13:57:00 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-11-02 11:31:01 +0000
commit1943b3c2a1dcee36c233724fc4ee7613d71b9cf6 (patch)
tree8c1b5f12357025c197da5427ae02cfdc2f3570d6 /chromium/cc/metrics/compositor_frame_reporter_unittest.cc
parent21ba0c5d4bf8fba15dddd97cd693bad2358b77fd (diff)
BASELINE: Update Chromium to 94.0.4606.111
Change-Id: I924781584def20fc800bedf6ff41fdb96c438193 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/cc/metrics/compositor_frame_reporter_unittest.cc')
-rw-r--r--chromium/cc/metrics/compositor_frame_reporter_unittest.cc115
1 files changed, 72 insertions, 43 deletions
diff --git a/chromium/cc/metrics/compositor_frame_reporter_unittest.cc b/chromium/cc/metrics/compositor_frame_reporter_unittest.cc
index 63e046a5f00..0f885408da1 100644
--- a/chromium/cc/metrics/compositor_frame_reporter_unittest.cc
+++ b/chromium/cc/metrics/compositor_frame_reporter_unittest.cc
@@ -74,13 +74,12 @@ class CompositorFrameReporterTest : public testing::Test {
std::unique_ptr<EventMetrics> CreateEventMetrics(
ui::EventType type,
- absl::optional<EventMetrics::ScrollUpdateType> scroll_update_type,
- absl::optional<ui::ScrollInputType> scroll_input_type) {
+ absl::optional<EventMetrics::ScrollParams> scroll_params =
+ absl::nullopt) {
const base::TimeTicks event_time = AdvanceNowByMs(3);
AdvanceNowByMs(3);
std::unique_ptr<EventMetrics> metrics = EventMetrics::CreateForTesting(
- type, scroll_update_type, scroll_input_type, event_time,
- &test_tick_clock_);
+ type, scroll_params, event_time, &test_tick_clock_);
if (metrics) {
AdvanceNowByMs(3);
metrics->SetDispatchStageTimestamp(
@@ -133,30 +132,30 @@ TEST_F(CompositorFrameReporterTest, MainFrameAbortedReportingTest) {
pipeline_reporter_->StartStage(
CompositorFrameReporter::StageType::kBeginImplFrameToSendBeginMainFrame,
Now());
- EXPECT_EQ(0, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(0u, pipeline_reporter_->stage_history_size_for_testing());
AdvanceNowByMs(3);
pipeline_reporter_->StartStage(
CompositorFrameReporter::StageType::kSendBeginMainFrameToCommit, Now());
- EXPECT_EQ(1, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(1u, pipeline_reporter_->stage_history_size_for_testing());
AdvanceNowByMs(3);
pipeline_reporter_->StartStage(
CompositorFrameReporter::StageType::kEndActivateToSubmitCompositorFrame,
Now());
- EXPECT_EQ(2, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(2u, pipeline_reporter_->stage_history_size_for_testing());
AdvanceNowByMs(3);
pipeline_reporter_->StartStage(
CompositorFrameReporter::StageType::
kSubmitCompositorFrameToPresentationCompositorFrame,
Now());
- EXPECT_EQ(3, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(3u, pipeline_reporter_->stage_history_size_for_testing());
AdvanceNowByMs(3);
pipeline_reporter_->TerminateFrame(
CompositorFrameReporter::FrameTerminationStatus::kPresentedFrame, Now());
- EXPECT_EQ(4, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(4u, pipeline_reporter_->stage_history_size_for_testing());
pipeline_reporter_ = nullptr;
histogram_tester.ExpectTotalCount(
@@ -178,18 +177,18 @@ TEST_F(CompositorFrameReporterTest, ReplacedByNewReporterReportingTest) {
pipeline_reporter_->StartStage(CompositorFrameReporter::StageType::kCommit,
Now());
- EXPECT_EQ(0, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(0u, pipeline_reporter_->stage_history_size_for_testing());
AdvanceNowByMs(3);
pipeline_reporter_->StartStage(
CompositorFrameReporter::StageType::kEndCommitToActivation, Now());
- EXPECT_EQ(1, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(1u, pipeline_reporter_->stage_history_size_for_testing());
AdvanceNowByMs(2);
pipeline_reporter_->TerminateFrame(
CompositorFrameReporter::FrameTerminationStatus::kReplacedByNewReporter,
Now());
- EXPECT_EQ(2, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(2u, pipeline_reporter_->stage_history_size_for_testing());
pipeline_reporter_ = nullptr;
histogram_tester.ExpectTotalCount("CompositorLatency.Commit", 0);
@@ -202,18 +201,18 @@ TEST_F(CompositorFrameReporterTest, SubmittedFrameReportingTest) {
pipeline_reporter_->StartStage(
CompositorFrameReporter::StageType::kActivation, Now());
- EXPECT_EQ(0, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(0u, pipeline_reporter_->stage_history_size_for_testing());
AdvanceNowByMs(3);
pipeline_reporter_->StartStage(
CompositorFrameReporter::StageType::kEndActivateToSubmitCompositorFrame,
Now());
- EXPECT_EQ(1, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(1u, pipeline_reporter_->stage_history_size_for_testing());
AdvanceNowByMs(2);
pipeline_reporter_->TerminateFrame(
CompositorFrameReporter::FrameTerminationStatus::kPresentedFrame, Now());
- EXPECT_EQ(2, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(2u, pipeline_reporter_->stage_history_size_for_testing());
pipeline_reporter_ = nullptr;
histogram_tester.ExpectTotalCount("CompositorLatency.Activation", 1);
@@ -238,18 +237,18 @@ TEST_F(CompositorFrameReporterTest, SubmittedDroppedFrameReportingTest) {
pipeline_reporter_->StartStage(
CompositorFrameReporter::StageType::kSendBeginMainFrameToCommit, Now());
- EXPECT_EQ(0, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(0u, pipeline_reporter_->stage_history_size_for_testing());
AdvanceNowByMs(3);
pipeline_reporter_->StartStage(CompositorFrameReporter::StageType::kCommit,
Now());
- EXPECT_EQ(1, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(1u, pipeline_reporter_->stage_history_size_for_testing());
AdvanceNowByMs(2);
pipeline_reporter_->TerminateFrame(
CompositorFrameReporter::FrameTerminationStatus::kDidNotPresentFrame,
Now());
- EXPECT_EQ(2, pipeline_reporter_->stage_history_size_for_testing());
+ EXPECT_EQ(2u, pipeline_reporter_->stage_history_size_for_testing());
pipeline_reporter_ = nullptr;
histogram_tester.ExpectTotalCount(
@@ -277,9 +276,9 @@ TEST_F(CompositorFrameReporterTest,
base::HistogramTester histogram_tester;
std::unique_ptr<EventMetrics> event_metrics_ptrs[] = {
- CreateEventMetrics(ui::ET_TOUCH_PRESSED, absl::nullopt, absl::nullopt),
- CreateEventMetrics(ui::ET_TOUCH_MOVED, absl::nullopt, absl::nullopt),
- CreateEventMetrics(ui::ET_TOUCH_MOVED, absl::nullopt, absl::nullopt),
+ CreateEventMetrics(ui::ET_TOUCH_PRESSED),
+ CreateEventMetrics(ui::ET_TOUCH_MOVED),
+ CreateEventMetrics(ui::ET_TOUCH_MOVED),
};
EXPECT_THAT(event_metrics_ptrs, Each(NotNull()));
EventMetrics::List events_metrics(
@@ -329,17 +328,23 @@ TEST_F(CompositorFrameReporterTest,
const base::HistogramBase::Sample latency_ms;
} expected_latencies[] = {
{"EventLatency.TouchPressed.TotalLatency",
- (presentation_time - event_times[0]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (presentation_time - event_times[0]).InMicroseconds())},
{"EventLatency.TouchMoved.TotalLatency",
- (presentation_time - event_times[1]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (presentation_time - event_times[1]).InMicroseconds())},
{"EventLatency.TouchMoved.TotalLatency",
- (presentation_time - event_times[2]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (presentation_time - event_times[2]).InMicroseconds())},
{"EventLatency.TotalLatency",
- (presentation_time - event_times[0]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (presentation_time - event_times[0]).InMicroseconds())},
{"EventLatency.TotalLatency",
- (presentation_time - event_times[1]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (presentation_time - event_times[1]).InMicroseconds())},
{"EventLatency.TotalLatency",
- (presentation_time - event_times[2]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (presentation_time - event_times[2]).InMicroseconds())},
};
for (const auto& expected_latency : expected_latencies) {
histogram_tester.ExpectBucketCount(expected_latency.name,
@@ -353,15 +358,24 @@ TEST_F(CompositorFrameReporterTest,
EventLatencyScrollTotalForPresentedFrameReported) {
base::HistogramTester histogram_tester;
+ const bool kIsInertial = true;
+ const bool kIsNotInertial = false;
std::unique_ptr<EventMetrics> event_metrics_ptrs[] = {
- CreateEventMetrics(ui::ET_GESTURE_SCROLL_BEGIN, absl::nullopt,
- ui::ScrollInputType::kWheel),
+ CreateEventMetrics(ui::ET_GESTURE_SCROLL_BEGIN,
+ EventMetrics::ScrollParams(ui::ScrollInputType::kWheel,
+ kIsNotInertial)),
CreateEventMetrics(ui::ET_GESTURE_SCROLL_UPDATE,
- EventMetrics::ScrollUpdateType::kStarted,
- ui::ScrollInputType::kWheel),
+ EventMetrics::ScrollParams(
+ ui::ScrollInputType::kWheel, kIsNotInertial,
+ EventMetrics::ScrollUpdateType::kStarted)),
CreateEventMetrics(ui::ET_GESTURE_SCROLL_UPDATE,
- EventMetrics::ScrollUpdateType::kContinued,
- ui::ScrollInputType::kWheel),
+ EventMetrics::ScrollParams(
+ ui::ScrollInputType::kWheel, kIsNotInertial,
+ EventMetrics::ScrollUpdateType::kContinued)),
+ CreateEventMetrics(ui::ET_GESTURE_SCROLL_UPDATE,
+ EventMetrics::ScrollParams(
+ ui::ScrollInputType::kWheel, kIsInertial,
+ EventMetrics::ScrollUpdateType::kContinued)),
};
EXPECT_THAT(event_metrics_ptrs, Each(NotNull()));
EventMetrics::List events_metrics(
@@ -406,7 +420,10 @@ TEST_F(CompositorFrameReporterTest,
1},
{"EventLatency.GestureScrollUpdate.Wheel.TotalLatency", 1},
{"EventLatency.GestureScrollUpdate.Wheel.TotalLatencyToSwapBegin", 1},
- {"EventLatency.TotalLatency", 3},
+ {"EventLatency.InertialGestureScrollUpdate.Wheel.TotalLatency", 1},
+ {"EventLatency.InertialGestureScrollUpdate.Wheel.TotalLatencyToSwapBegin",
+ 1},
+ {"EventLatency.TotalLatency", 4},
};
for (const auto& expected_count : expected_counts) {
histogram_tester.ExpectTotalCount(expected_count.name,
@@ -421,17 +438,29 @@ TEST_F(CompositorFrameReporterTest,
const base::HistogramBase::Sample latency_ms;
} expected_latencies[] = {
{"EventLatency.GestureScrollBegin.Wheel.TotalLatency",
- (presentation_time - event_times[0]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (presentation_time - event_times[0]).InMicroseconds())},
{"EventLatency.GestureScrollBegin.Wheel.TotalLatencyToSwapBegin",
- (swap_begin_time - event_times[0]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (swap_begin_time - event_times[0]).InMicroseconds())},
{"EventLatency.FirstGestureScrollUpdate.Wheel.TotalLatency",
- (presentation_time - event_times[1]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (presentation_time - event_times[1]).InMicroseconds())},
{"EventLatency.FirstGestureScrollUpdate.Wheel.TotalLatencyToSwapBegin",
- (swap_begin_time - event_times[1]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (swap_begin_time - event_times[1]).InMicroseconds())},
{"EventLatency.GestureScrollUpdate.Wheel.TotalLatency",
- (presentation_time - event_times[2]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (presentation_time - event_times[2]).InMicroseconds())},
{"EventLatency.GestureScrollUpdate.Wheel.TotalLatencyToSwapBegin",
- (swap_begin_time - event_times[2]).InMicroseconds()},
+ static_cast<base::HistogramBase::Sample>(
+ (swap_begin_time - event_times[2]).InMicroseconds())},
+ {"EventLatency.InertialGestureScrollUpdate.Wheel.TotalLatency",
+ static_cast<base::HistogramBase::Sample>(
+ (presentation_time - event_times[3]).InMicroseconds())},
+ {"EventLatency.InertialGestureScrollUpdate.Wheel.TotalLatencyToSwapBegin",
+ static_cast<base::HistogramBase::Sample>(
+ (swap_begin_time - event_times[3]).InMicroseconds())},
};
for (const auto& expected_latency : expected_latencies) {
histogram_tester.ExpectBucketCount(expected_latency.name,
@@ -446,9 +475,9 @@ TEST_F(CompositorFrameReporterTest,
base::HistogramTester histogram_tester;
std::unique_ptr<EventMetrics> event_metrics_ptrs[] = {
- CreateEventMetrics(ui::ET_TOUCH_PRESSED, absl::nullopt, absl::nullopt),
- CreateEventMetrics(ui::ET_TOUCH_MOVED, absl::nullopt, absl::nullopt),
- CreateEventMetrics(ui::ET_TOUCH_MOVED, absl::nullopt, absl::nullopt),
+ CreateEventMetrics(ui::ET_TOUCH_PRESSED),
+ CreateEventMetrics(ui::ET_TOUCH_MOVED),
+ CreateEventMetrics(ui::ET_TOUCH_MOVED),
};
EXPECT_THAT(event_metrics_ptrs, Each(NotNull()));
EventMetrics::List events_metrics(