chromium/base/metrics/statistics_recorder_unittest.cc

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

#include "base/metrics/statistics_recorder.h"

#include <stddef.h>

#include <memory>
#include <optional>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_base.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/metrics_hashes.h"
#include "base/metrics/persistent_histogram_allocator.h"
#include "base/metrics/record_histogram_checker.h"
#include "base/metrics/sparse_histogram.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

// Class to make sure any manipulations we do to the min log level are
// contained (i.e., do not affect other unit tests).
class LogStateSaver {};

// Test implementation of RecordHistogramChecker interface.
class OddRecordHistogramChecker : public base::RecordHistogramChecker {};

}  // namespace

namespace base {

IsEmpty;
SizeIs;
UnorderedElementsAre;

class StatisticsRecorderTest : public testing::TestWithParam<bool> {};

// Run all HistogramTest cases with both heap and persistent memory.
INSTANTIATE_TEST_SUITE_P();

TEST_P(StatisticsRecorderTest, NotInitialized) {}

TEST_P(StatisticsRecorderTest, RegisterHistogram) {}

TEST_P(StatisticsRecorderTest, FindHistogram) {}

TEST_P(StatisticsRecorderTest, WithName) {}

TEST_P(StatisticsRecorderTest, RegisterHistogramWithFactoryGet) {}

TEST_P(StatisticsRecorderTest, RegisterHistogramWithMacros) {}

TEST_P(StatisticsRecorderTest, BucketRangesSharing) {}

TEST_P(StatisticsRecorderTest, ToJSON) {}

// Check the serialized JSON with a different verbosity level.
TEST_P(StatisticsRecorderTest, ToJSONOmitBuckets) {}

TEST_P(StatisticsRecorderTest, IterationTest) {}

namespace {

// CallbackCheckWrapper is simply a convenient way to check and store that
// a callback was actually run.
struct CallbackCheckWrapper {};

}  // namespace

TEST_P(StatisticsRecorderTest,
       AddHistogramCallbackBeforeHistogramRegistration) {}

TEST_P(StatisticsRecorderTest,
       RemoveHistogramCallbackBeforeHistogramRegistrationWithMultipleClients) {}

TEST_P(StatisticsRecorderTest, AddHistogramCallbackWithMultipleClients) {}

TEST_P(StatisticsRecorderTest, RemoveHistogramCallbackWithMultipleClients) {}

// Check that callback is used.
TEST_P(StatisticsRecorderTest, CallbackUsedTest) {}

// Check that setting a callback before the histogram exists works.
TEST_P(StatisticsRecorderTest, CallbackUsedBeforeHistogramCreatedTest) {}

TEST_P(StatisticsRecorderTest, GlobalCallbackCalled) {}

TEST_P(StatisticsRecorderTest, LogOnShutdownNotInitialized) {}

TEST_P(StatisticsRecorderTest, LogOnShutdownInitializedExplicitly) {}

TEST_P(StatisticsRecorderTest, LogOnShutdownInitialized) {}

class TestHistogramProvider : public StatisticsRecorder::HistogramProvider {};

TEST_P(StatisticsRecorderTest, ImportHistogramsTest) {}

TEST_P(StatisticsRecorderTest, RecordHistogramChecker) {}

}  // namespace base