#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 LogStateSaver { … };
class OddRecordHistogramChecker : public base::RecordHistogramChecker { … };
}
namespace base {
IsEmpty;
SizeIs;
UnorderedElementsAre;
class StatisticsRecorderTest : public testing::TestWithParam<bool> { … };
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) { … }
TEST_P(StatisticsRecorderTest, ToJSONOmitBuckets) { … }
TEST_P(StatisticsRecorderTest, IterationTest) { … }
namespace {
struct CallbackCheckWrapper { … };
}
TEST_P(StatisticsRecorderTest,
AddHistogramCallbackBeforeHistogramRegistration) { … }
TEST_P(StatisticsRecorderTest,
RemoveHistogramCallbackBeforeHistogramRegistrationWithMultipleClients) { … }
TEST_P(StatisticsRecorderTest, AddHistogramCallbackWithMultipleClients) { … }
TEST_P(StatisticsRecorderTest, RemoveHistogramCallbackWithMultipleClients) { … }
TEST_P(StatisticsRecorderTest, CallbackUsedTest) { … }
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) { … }
}