blob: a6d7c774bd06d2c78fd364115d105c54e503a3e3 [file] [log] [blame]
// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/sampling_heap_profiler/poisson_allocation_sampler.h"
#include <stdlib.h>
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
TEST(PoissonAllocationSamplerTest, MuteHooksWithoutInit) {
// ScopedMuteHookedSamplesForTesting updates the allocator hooks. Make sure
// is safe to call from tests that might not call
// PoissonAllocationSampler::Get() to initialize the rest of the
// PoissonAllocationSampler.
EXPECT_FALSE(PoissonAllocationSampler::AreHookedSamplesMuted());
void* volatile p = nullptr;
{
PoissonAllocationSampler::ScopedMuteHookedSamplesForTesting mute_hooks;
p = malloc(10000);
}
free(p);
}
} // namespace base