Index: base/process/memory_unittest.cc |
diff --git a/base/process/memory_unittest.cc b/base/process/memory_unittest.cc |
index 0276b495915cc5d6d37ee3522da45608b2cac76a..1e1891c4265f99cb8b68cbe7aba5c1f30821558d 100644 |
--- a/base/process/memory_unittest.cc |
+++ b/base/process/memory_unittest.cc |
@@ -13,9 +13,6 @@ |
#include "base/strings/stringprintf.h" |
#include "testing/gtest/include/gtest/gtest.h" |
-#if defined(OS_WIN) |
-#include <windows.h> |
-#endif |
#if defined(OS_POSIX) |
#include <errno.h> |
#endif |
@@ -29,76 +26,6 @@ |
#include "base/test/malloc_wrapper.h" |
#endif |
-#if defined(OS_WIN) |
-// HeapQueryInformation function pointer. |
-typedef BOOL (WINAPI* HeapQueryFn) \ |
- (HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T); |
- |
-const int kConstantInModule = 42; |
- |
-TEST(ProcessMemoryTest, GetModuleFromAddress) { |
- // Since the unit tests are their own EXE, this should be |
- // equivalent to the EXE's HINSTANCE. |
- // |
- // kConstantInModule is a constant in this file and |
- // therefore within the unit test EXE. |
- EXPECT_EQ(::GetModuleHandle(NULL), |
- base::GetModuleFromAddress( |
- const_cast<int*>(&kConstantInModule))); |
- |
- // Any address within the kernel32 module should return |
- // kernel32's HMODULE. Our only assumption here is that |
- // kernel32 is larger than 4 bytes. |
- HMODULE kernel32 = ::GetModuleHandle(L"kernel32.dll"); |
- HMODULE kernel32_from_address = |
- base::GetModuleFromAddress(reinterpret_cast<DWORD*>(kernel32) + 1); |
- EXPECT_EQ(kernel32, kernel32_from_address); |
-} |
- |
-TEST(ProcessMemoryTest, EnableLFH) { |
- ASSERT_TRUE(base::EnableLowFragmentationHeap()); |
- if (IsDebuggerPresent()) { |
- // Under these conditions, LFH can't be enabled. There's no point to test |
- // anything. |
- const char* no_debug_env = getenv("_NO_DEBUG_HEAP"); |
- if (!no_debug_env || strcmp(no_debug_env, "1")) |
- return; |
- } |
- HMODULE kernel32 = GetModuleHandle(L"kernel32.dll"); |
- ASSERT_TRUE(kernel32 != NULL); |
- HeapQueryFn heap_query = reinterpret_cast<HeapQueryFn>(GetProcAddress( |
- kernel32, |
- "HeapQueryInformation")); |
- |
- // On Windows 2000, the function is not exported. This is not a reason to |
- // fail but we won't be able to retrieves information about the heap, so we |
- // should stop here. |
- if (heap_query == NULL) |
- return; |
- |
- HANDLE heaps[1024] = { 0 }; |
- unsigned number_heaps = GetProcessHeaps(1024, heaps); |
- EXPECT_GT(number_heaps, 0u); |
- for (unsigned i = 0; i < number_heaps; ++i) { |
- ULONG flag = 0; |
- SIZE_T length; |
- ASSERT_NE(0, heap_query(heaps[i], |
- HeapCompatibilityInformation, |
- &flag, |
- sizeof(flag), |
- &length)); |
- // If flag is 0, the heap is a standard heap that does not support |
- // look-asides. If flag is 1, the heap supports look-asides. If flag is 2, |
- // the heap is a low-fragmentation heap (LFH). Note that look-asides are not |
- // supported on the LFH. |
- |
- // We don't have any documented way of querying the HEAP_NO_SERIALIZE flag. |
- EXPECT_LE(flag, 2u); |
- EXPECT_NE(flag, 1u); |
- } |
-} |
-#endif // defined(OS_WIN) |
- |
#if defined(OS_MACOSX) |
// For the following Mac tests: |
@@ -131,7 +58,7 @@ TEST(ProcessMemoryTest, MacTerminateOnHeapCorruption) { |
// Don't test these on ASan/TSan/MSan configurations: only test the real |
// allocator. |
// TODO(vandebo) make this work on Windows too. |
-#if !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !defined(OS_WIN) && \ |
+#if !defined(OS_ANDROID) && !defined(OS_OPENBSD) && \ |
!defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
#if defined(USE_TCMALLOC) |
@@ -415,5 +342,5 @@ TEST_F(OutOfMemoryHandledTest, UncheckedCalloc) { |
EXPECT_TRUE(value_ == NULL); |
} |
#endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
-#endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && !defined(OS_WIN) && |
+#endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && |
// !defined(ADDRESS_SANITIZER) |