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

Unified Diff: net/base/sdch_manager_unittest.cc

Issue 2699163002: Whitelist net/ MemoryDumpProvider (Closed)
Patch Set: fix test on windows Created 3 years, 10 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 | « net/base/sdch_manager.cc ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/sdch_manager_unittest.cc
diff --git a/net/base/sdch_manager_unittest.cc b/net/base/sdch_manager_unittest.cc
index 31162841b6c90495ed201818d9e1b042beee2e1a..72913a3daf9e44658179383a7ad9fcf154cdb362 100644
--- a/net/base/sdch_manager_unittest.cc
+++ b/net/base/sdch_manager_unittest.cc
@@ -4,6 +4,7 @@
#include "net/base/sdch_manager.h"
+#include <inttypes.h>
#include <limits.h>
#include <memory>
@@ -640,7 +641,18 @@ TEST_F(SdchManagerTest, AddRemoveNotifications) {
sdch_manager()->RemoveObserver(&observer);
}
-TEST_F(SdchManagerTest, DumpMemoryStats) {
+class SdchManagerMemoryDumpTest
+ : public SdchManagerTest,
+ public testing::WithParamInterface<
+ base::trace_event::MemoryDumpLevelOfDetail> {};
+
+INSTANTIATE_TEST_CASE_P(
+ /* no prefix */,
+ SdchManagerMemoryDumpTest,
+ ::testing::Values(base::trace_event::MemoryDumpLevelOfDetail::DETAILED,
+ base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND));
+
+TEST_P(SdchManagerMemoryDumpTest, DumpMemoryStats) {
MockSdchObserver observer;
sdch_manager()->AddObserver(&observer);
@@ -655,20 +667,20 @@ TEST_F(SdchManagerTest, DumpMemoryStats) {
EXPECT_EQ(target_gurl, observer.last_dictionary_url());
EXPECT_EQ(server_hash, observer.last_server_hash());
- base::trace_event::MemoryDumpArgs dump_args = {
- base::trace_event::MemoryDumpLevelOfDetail::DETAILED};
+ base::trace_event::MemoryDumpArgs dump_args = {GetParam()};
std::unique_ptr<base::trace_event::ProcessMemoryDump> pmd(
new base::trace_event::ProcessMemoryDump(nullptr, dump_args));
base::trace_event::MemoryAllocatorDump* parent =
- pmd->CreateAllocatorDump("parent");
+ pmd->CreateAllocatorDump("net/url_request_context_0x123");
sdch_manager()->DumpMemoryStats(pmd.get(), parent->absolute_name());
const base::trace_event::MemoryAllocatorDump* sub_dump =
- pmd->GetAllocatorDump("parent/sdch_manager");
+ pmd->GetAllocatorDump("net/url_request_context_0x123/sdch_manager");
ASSERT_NE(nullptr, sub_dump);
const base::trace_event::MemoryAllocatorDump* dump = pmd->GetAllocatorDump(
- base::StringPrintf("net/sdch_manager_%p", sdch_manager()));
+ base::StringPrintf("net/sdch_manager_0x%" PRIxPTR,
+ reinterpret_cast<uintptr_t>(sdch_manager())));
std::unique_ptr<base::Value> raw_attrs =
dump->attributes_for_testing()->ToBaseValue();
base::DictionaryValue* attrs;
« no previous file with comments | « net/base/sdch_manager.cc ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698