chromium/components/gwp_asan/client/gwp_asan_unittest.cc

// Copyright 2019 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/gwp_asan/client/gwp_asan.h"

#include <map>
#include <optional>
#include <set>
#include <string>
#include <string_view>
#include <utility>

#include "base/metrics/field_trial_params.h"
#include "base/test/gtest_util.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace gwp_asan {
namespace internal {

std::optional<AllocatorSettings> GetAllocatorSettingsImpl(
    const base::Feature& feature,
    bool boost_sampling,
    std::string_view process_type);
std::optional<AllocatorSettings> GetAllocatorSettings(
    const base::Feature& feature,
    bool boost_sampling,
    std::string_view process_type);

namespace {

constexpr size_t kLoopIterations =;
BASE_FEATURE();
BASE_FEATURE();
BASE_FEATURE();

inline constexpr std::string_view kDummyProcessType =;

// Tries to enable hooking with the given process sampling parameters
// kLoopIterations times and return the number of times hooking was enabled.
size_t processSamplingTest(const char* process_sampling,
                           const char* process_sampling_boost) {}

// Enables hooking kLoopIterations times with the given allocation sampling
// parameters and returns the allocation sampling frequencies hooking was
// enabled with.
std::set<size_t> allocationSamplingTest(
    const char* allocation_sampling_multiplier,
    const char* allocation_sampling_range) {}

}  // namespace

TEST(GwpAsanTest, ProcessSamplingWorks) {}

TEST(GwpAsanTest, AllocationSamplingWorks) {}

TEST(GwpAsanTest, GetDefaultAllocatorSettings) {}

TEST(GwpAsanTest, GetOutOfRangeAllocatorSettings) {}

TEST(GwpAsanTest, GetProcessSpecificAllocatorSettings) {}

TEST(GwpAsanTest, GetProcessSpecificAllocationSamplingMultiplier) {}

TEST(GwpAsanTest, GetProcessSpecificAllocationSamplingRange) {}

}  // namespace internal
}  // namespace gwp_asan