Index: base/debug/thread_heap_usage_tracker_unittest.cc |
diff --git a/base/debug/thread_heap_usage_tracker_unittest.cc b/base/debug/thread_heap_usage_tracker_unittest.cc |
index 2012e4971f021581cc574a6024ddb1f6dc701c39..5a6a4fe715398491c99ee21a1c2cb540203239b3 100644 |
--- a/base/debug/thread_heap_usage_tracker_unittest.cc |
+++ b/base/debug/thread_heap_usage_tracker_unittest.cc |
@@ -10,6 +10,10 @@ |
#include "base/allocator/features.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+#if defined(OS_MACOSX) |
+#include "base/allocator/allocator_interception_mac.h" |
+#endif |
+ |
namespace base { |
namespace debug { |
@@ -550,11 +554,14 @@ TEST_F(ThreadHeapUsageTrackerTest, AllShimFunctionsAreProvided) { |
} |
#if BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) |
-TEST(ThreadHeapUsageShimTest, HooksIntoMallocWhenShimAvailable) { |
+class ThreadHeapUsageShimTest : public testing::Test { |
#if defined(OS_MACOSX) |
- allocator::InitializeAllocatorShim(); |
+ void SetUp() override { allocator::InitializeAllocatorShim(); } |
+ void TearDown() override { allocator::UninterceptMallocZonesForTesting(); } |
#endif |
+}; |
+TEST_F(ThreadHeapUsageShimTest, HooksIntoMallocWhenShimAvailable) { |
ASSERT_FALSE(ThreadHeapUsageTracker::IsHeapTrackingEnabled()); |
ThreadHeapUsageTracker::EnableHeapTracking(); |