chromium/components/shared_highlighting/core/common/shared_highlighting_metrics_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 "components/shared_highlighting/core/common/shared_highlighting_metrics.h"

#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "components/ukm/test_ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace shared_highlighting {

namespace {

const char kSearchEngineUrl[] =;

const char kSourceUkmMetric[] =;
const char kSuccessUkmMetric[] =;
const char kErrorUkmMetric[] =;

class SharedHighlightingMetricsTest : public testing::Test {};

TEST_F(SharedHighlightingMetricsTest, LogTextFragmentAmbiguousMatch) {}

TEST_F(SharedHighlightingMetricsTest, LogTextFragmentLinkOpenSource) {}

TEST_F(SharedHighlightingMetricsTest, LogTextFragmentMatchRate) {}

TEST_F(SharedHighlightingMetricsTest, LogTextFragmentSelectorCount) {}

TEST_F(SharedHighlightingMetricsTest, LogLinkGenerationStatus) {}

TEST_F(SharedHighlightingMetricsTest, LogLinkGenerationErrorReason) {}

TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmSuccessSearchEngine) {}

TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmFailSearchEngine) {}

TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmSuccessUnknownSource) {}

TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmFailUnknownSource) {}

TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmInvalidSourceId) {}

// Tests that using the endpoints with a custom recorder won't use the static
// UKM recorder.
TEST_F(SharedHighlightingMetricsTest, LinkOpenedUkmCustomRecorder) {}

TEST_F(SharedHighlightingMetricsTest, LinkGeneratedUkmSuccess) {}

TEST_F(SharedHighlightingMetricsTest, LinkGeneratedUkmError) {}

TEST_F(SharedHighlightingMetricsTest, LinkGeneratedUkmSuccessInvalidSourceId) {}

// Tests that using the endpoints with a custom recorder won't use the static
// UKM recorder.
TEST_F(SharedHighlightingMetricsTest, LinkGeneratedUkmCustomRecorder) {}

// Tests that link generation success latency logs to the right histogram.
TEST_F(SharedHighlightingMetricsTest, LinkGeneratedSuccessLatency) {}

// Tests that link generation failure latency logs to the right histogram.
TEST_F(SharedHighlightingMetricsTest, LinkGeneratedErrorLatency) {}

// Tests all the metrics that need to be recorded in case of a failure.
TEST_F(SharedHighlightingMetricsTest, LogRequestedFailureMetrics) {}

// Tests all the metrics that need to be recorded in case of a success.
TEST_F(SharedHighlightingMetricsTest, LogRequestedSuccessMetrics) {}

// Tests that requested before or after histogram is correctly recorded.
TEST_F(SharedHighlightingMetricsTest, LogLinkRequestedBeforeStatus) {}

// Tests that link generation failure latency logs to the right histogram.
TEST_F(SharedHighlightingMetricsTest, LogLinkToTextReshareStatus) {}

}  // namespace

}  // namespace shared_highlighting