chromium/third_party/blink/common/privacy_budget/aggregating_sample_collector_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 "third_party/blink/common/privacy_budget/aggregating_sample_collector.h"

#include <memory>
#include <type_traits>
#include <vector>

#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/metrics/public/mojom/ukm_interface.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/common/privacy_budget/identifiability_sample_collector_test_utils.h"
#include "third_party/blink/common/privacy_budget/test_ukm_recorder.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_sample_collector.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings_provider.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_sample.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"

namespace {
Pointee;
UnorderedElementsAre;
}  // namespace

namespace blink {

namespace {
constexpr ukm::SourceId kTestSource1 =;
constexpr ukm::SourceId kTestSource2 =;
constexpr IdentifiableSurface kTestSurface1 =;
constexpr IdentifiableSurface kTestSurface2 =;
constexpr IdentifiableToken kTestValue1 =;

// A settings provider that activates the study and allows all surfaces and
// types.
class TestSettingsProvider : public IdentifiabilityStudySettingsProvider {};

}  // namespace

class AggregatingSampleCollectorTest : public ::testing::Test {};

TEST_F(AggregatingSampleCollectorTest, NoImmediatePassthrough) {}

TEST_F(AggregatingSampleCollectorTest, MergesDuplicates) {}

TEST_F(AggregatingSampleCollectorTest, DoesNotCountDuplicates) {}

TEST_F(AggregatingSampleCollectorTest, TooManySurfaces) {}

TEST_F(AggregatingSampleCollectorTest, TooManySources) {}

TEST_F(AggregatingSampleCollectorTest, TooManySamplesPerSurface) {}

TEST_F(AggregatingSampleCollectorTest, TooManyUnsentMetrics) {}

TEST_F(AggregatingSampleCollectorTest, TooManyUnsentSources) {}

TEST_F(AggregatingSampleCollectorTest, UnsentMetricsAreTooOld) {}

TEST_F(AggregatingSampleCollectorTest, FlushSource) {}

// This test exercises the global instance. The goal is to make sure that the
// global instance is what we think it is.
TEST_F(AggregatingSampleCollectorTest, GlobalInstance) {}

TEST_F(AggregatingSampleCollectorTest, NullRecorder) {}

TEST_F(AggregatingSampleCollectorTest, InvalidSourceId) {}
}  // namespace blink