Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2502)

Unified Diff: base/trace_event/winheap_dump_provider_win_unittest.cc

Issue 1101853002: Revert of Add a WinHeap dump provider to the memory profiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/winheap_dump_provider_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/winheap_dump_provider_win_unittest.cc
diff --git a/base/trace_event/winheap_dump_provider_win_unittest.cc b/base/trace_event/winheap_dump_provider_win_unittest.cc
deleted file mode 100644
index 44d9c1b2be8724ab5af96d32f316a13e7b7551af..0000000000000000000000000000000000000000
--- a/base/trace_event/winheap_dump_provider_win_unittest.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2015 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/trace_event/winheap_dump_provider_win.h"
-
-#include <windows.h>
-
-#include "base/trace_event/memory_dump_session_state.h"
-#include "base/trace_event/process_memory_dump.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace base {
-namespace trace_event {
-
-class WinHeapDumpProviderTest : public testing::Test {
- public:
- bool GetHeapInformation(WinHeapDumpProvider* provider,
- WinHeapInfo* heap_info,
- const std::set<void*>& block_to_skip) {
- return provider->GetHeapInformation(heap_info, block_to_skip);
- }
-};
-
-TEST_F(WinHeapDumpProviderTest, DumpInto) {
- ProcessMemoryDump pmd(make_scoped_refptr(new MemoryDumpSessionState()));
-
- WinHeapDumpProvider* winheap_dump_provider =
- WinHeapDumpProvider::GetInstance();
- ASSERT_NE(reinterpret_cast<WinHeapDumpProvider*>(nullptr),
- winheap_dump_provider);
-
- ASSERT_TRUE(winheap_dump_provider->DumpInto(&pmd));
-}
-
-TEST_F(WinHeapDumpProviderTest, GetHeapInformation) {
- ProcessMemoryDump pmd(make_scoped_refptr(new MemoryDumpSessionState()));
-
- WinHeapDumpProvider* winheap_dump_provider =
- WinHeapDumpProvider::GetInstance();
- ASSERT_NE(reinterpret_cast<WinHeapDumpProvider*>(nullptr),
- winheap_dump_provider);
-
- HANDLE heap = ::HeapCreate(NULL, 0, 0);
- ASSERT_NE(nullptr, heap);
-
- const size_t kAllocSize = 42;
- void* alloc = ::HeapAlloc(heap, 0, kAllocSize);
- ASSERT_NE(nullptr, alloc);
-
- WinHeapInfo heap_info = {0};
- heap_info.heap_id = heap;
- std::set<void*> block_to_skip;
-
- // Put the allocation into the skip list and make sure that the provider
- // ignores it.
- block_to_skip.insert(alloc);
- ASSERT_TRUE(
- GetHeapInformation(winheap_dump_provider, &heap_info, block_to_skip));
- EXPECT_EQ(0U, heap_info.block_count);
- EXPECT_EQ(0U, heap_info.allocated_size);
- // We can't check the committed size here, as it can depend on the version of
- // kernel32.dll.
-
- // Remove the allocation from the skip list and check if it's analysed
- // properlyly.
- block_to_skip.erase(alloc);
- ASSERT_TRUE(
- GetHeapInformation(winheap_dump_provider, &heap_info, block_to_skip));
- EXPECT_EQ(1, heap_info.block_count);
- EXPECT_EQ(kAllocSize, heap_info.allocated_size);
- EXPECT_LT(kAllocSize, heap_info.committed_size);
-
- EXPECT_TRUE(::HeapFree(heap, 0, alloc));
- EXPECT_EQ(TRUE, ::HeapDestroy(heap));
-}
-
-} // namespace trace_event
-} // namespace base
« no previous file with comments | « base/trace_event/winheap_dump_provider_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698