chromium/cc/metrics/ukm_manager_unittest.cc

// Copyright 2017 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/ukm_manager.h"

#include <utility>
#include <vector>

#include "base/ranges/algorithm.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/time/time.h"
#include "cc/metrics/begin_main_frame_metrics.h"
#include "cc/metrics/compositor_frame_reporter.h"
#include "cc/metrics/event_metrics.h"
#include "components/ukm/test_ukm_recorder.h"
#include "components/viz/common/frame_timing_details.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace cc {
namespace {

const char kTestUrl[] =;
const int64_t kTestSourceId1 =;

// Names of compositor/event latency UKM events.
const char kCompositorLatency[] =;
const char kEventLatency[] =;

// Names of enum metrics used in compositor/event latency UKM metrics.
const char kMissedFrame[] =;
const char kEventType[] =;
const char kScrollInputType[] =;

// Names of compositor stages and substages used in compositor/event latency UKM
// metrics.
const char kGenerationToRendererCompositor[] =;
const char kRendererCompositorQueueingDelay[] =;
const char kRendererCompositorProcessing[] =;
const char kRendererCompositorToMain[] =;
const char kRendererMainProcessing[] =;
const char kRendererMainFinishedToBeginImplFrame[] =;
const char kBeginImplFrameToSendBeginMainFrame[] =;
const char kSendBeginMainFrameToCommit[] =;
const char kBlinkBreakdownHandleInputEvents[] =;
const char kBlinkBreakdownAnimate[] =;
const char kBlinkBreakdownStyleUpdate[] =;
const char kBlinkBreakdownLayoutUpdate[] =;
const char kBlinkBreakdownPrepaint[] =;
const char kBlinkBreakdownCompositingInputs[] =;
const char kBlinkBreakdownPaint[] =;
const char kBlinkBreakdownCompositeCommit[] =;
const char kBlinkBreakdownUpdateLayers[] =;
const char kBlinkBreakdownBeginMainSentToStarted[] =;
const char kCommit[] =;
const char kEndCommitToActivation[] =;
const char kActivation[] =;
const char kEndActivateToSubmitCompositorFrame[] =;
const char kSubmitCompositorFrameToPresentationCompositorFrame[] =;
const char kVizBreakdownSubmitToReceiveCompositorFrame[] =;
const char kVizBreakdownReceivedCompositorFrameToStartDraw[] =;
const char kVizBreakdownStartDrawToSwapStart[] =;
const char kVizBreakdownSwapStartToSwapEnd[] =;
const char kVizBreakdownSwapStartToBufferAvailable[] =;
const char kVizBreakdownBufferAvailableToBufferReady[] =;
const char kVizBreakdownBufferReadyToLatch[] =;
const char kVizBreakdownLatchToSwapEnd[] =;
const char kVizBreakdownSwapEndToPresentationCompositorFrame[] =;
const char kTotalLatency[] =;

// Names of frame sequence types use in compositor latency UKM metrics (see
// FrameSequenceTrackerType enum).
const char kCompositorAnimation[] =;
const char kMainThreadAnimation[] =;
const char kPinchZoom[] =;
const char kRAF[] =;
const char kScrollbarScroll[] =;
const char kTouchScroll[] =;
const char kVideo[] =;
const char kWheelScroll[] =;

class UkmManagerTest : public testing::Test {};

class UkmManagerCompositorLatencyTest
    : public UkmManagerTest,
      public testing::WithParamInterface<
          CompositorFrameReporter::FrameReportType> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(UkmManagerCompositorLatencyTest, CompositorLatency) {}

TEST_F(UkmManagerTest, EventLatency) {}

}  // namespace
}  // namespace cc