#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 = …;
size_t processSamplingTest(const char* process_sampling,
const char* process_sampling_boost) { … }
std::set<size_t> allocationSamplingTest(
const char* allocation_sampling_multiplier,
const char* allocation_sampling_range) { … }
}
TEST(GwpAsanTest, ProcessSamplingWorks) { … }
TEST(GwpAsanTest, AllocationSamplingWorks) { … }
TEST(GwpAsanTest, GetDefaultAllocatorSettings) { … }
TEST(GwpAsanTest, GetOutOfRangeAllocatorSettings) { … }
TEST(GwpAsanTest, GetProcessSpecificAllocatorSettings) { … }
TEST(GwpAsanTest, GetProcessSpecificAllocationSamplingMultiplier) { … }
TEST(GwpAsanTest, GetProcessSpecificAllocationSamplingRange) { … }
}
}