chromium/cc/metrics/dropped_frame_counter_unittest.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/metrics/dropped_frame_counter.h"

#include <vector>

#include "base/memory/raw_ptr.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
#include "base/time/default_tick_clock.h"
#include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "cc/animation/animation_host.h"
#include "cc/metrics/custom_metrics_recorder.h"
#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_frame_info.h"
#include "cc/test/fake_picture_layer.h"
#include "cc/test/layer_tree_test.h"

namespace cc {
namespace {

SmoothnessStrategy;

FrameInfo CreateStubFrameInfo(bool is_dropped) {}

class TestCustomMetricsRecorder : public CustomMetricRecorder {};

class DroppedFrameCounterTestBase : public LayerTreeTest {};

class DroppedFrameCounterNoDropTest : public DroppedFrameCounterTestBase {};

MULTI_THREAD_TEST_F(DroppedFrameCounterNoDropTest);

class DroppedFrameCounterMainDropsNoSmoothness
    : public DroppedFrameCounterTestBase {};

// TODO(crbug.com/40144326) Disabled for flakiness.
// MULTI_THREAD_TEST_F(DroppedFrameCounterMainDropsNoSmoothness);

class DroppedFrameCounterMainDropsSmoothnessTest
    : public DroppedFrameCounterTestBase {};

// TODO(crbug.com/40144326) Disabled for flakiness.
// MULTI_THREAD_TEST_F(DroppedFrameCounterMainDropsSmoothnessTest);

class DroppedFrameCounterTest : public testing::Test {};

// Test class that supports parameterized tests for each of the different
// SmoothnessStrategy.
//
// TODO(jonross): when we build the other strategies parameterize the
// expectations.
class SmoothnessStrategyDroppedFrameCounterTest
    : public DroppedFrameCounterTest,
      public testing::WithParamInterface<SmoothnessStrategy> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(SmoothnessStrategyDroppedFrameCounterTest, SimplePattern1) {}

TEST_P(SmoothnessStrategyDroppedFrameCounterTest, SimplePattern2) {}

TEST_P(SmoothnessStrategyDroppedFrameCounterTest, IncompleteWindow) {}

TEST_P(SmoothnessStrategyDroppedFrameCounterTest, MaxPercentDroppedChanges) {}

TEST_F(DroppedFrameCounterTest, MaxPercentDroppedWithIdleFrames) {}

TEST_F(DroppedFrameCounterTest, NoCrashForIntervalLargerThanWindow) {}

TEST_P(SmoothnessStrategyDroppedFrameCounterTest, Percentile95WithIdleFrames) {}

TEST_P(SmoothnessStrategyDroppedFrameCounterTest,
       Percentile95WithIdleFramesWhileHidden) {}

TEST_P(SmoothnessStrategyDroppedFrameCounterTest,
       Percentile95WithIdleFramesThenHide) {}

// Tests that when ResetPendingFrames updates the sliding window, that the max
// PercentDroppedFrames is also updated accordingly. (https://crbug.com/1225307)
TEST_P(SmoothnessStrategyDroppedFrameCounterTest,
       ResetPendingFramesUpdatesMaxPercentDroppedFrames) {}

TEST_F(DroppedFrameCounterTest, ResetPendingFramesAccountingForPendingFrames) {}

TEST_F(DroppedFrameCounterTest, Reset) {}

TEST_F(DroppedFrameCounterTest, ConsistentSmoothnessRatings) {}

TEST_F(DroppedFrameCounterTest, MovingSmoothnessRatings) {}

TEST_F(DroppedFrameCounterTest, FramesInFlightWhenFcpReceived) {}

TEST_F(DroppedFrameCounterTest, ForkedCompositorFrameReporter) {}

TEST_F(DroppedFrameCounterTest, WorstSmoothnessTiming) {}

TEST_F(DroppedFrameCounterTest, ReportOnEveryFrameForUI) {}

}  // namespace
}  // namespace cc