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

Unified Diff: net/disk_cache/backend_unittest.cc

Issue 2779733002: [HttpCache] Store some memcache info to memory dumps for debugging (Closed)
Patch Set: Whitelist strings Created 3 years, 9 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
Index: net/disk_cache/backend_unittest.cc
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 20fa69ae349087155c05bf5ecd6cf51aaab52710..3074ab76ec00372eb7e0d31322ff89d528c02504 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -18,7 +18,7 @@
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
#include "base/threading/thread_task_runner_handle.h"
-#include "base/trace_event/memory_usage_estimator.h"
+#include "base/trace_event/process_memory_dump.h"
#include "net/base/cache_type.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
@@ -326,7 +326,11 @@ void DiskCacheBackendTest::BackendBasics() {
entry1 = NULL;
// base::trace_event::EstimateMemoryUsage(cache_) is added to make sure
ssid 2017/03/27 18:59:41 Is this comment still valid?
jkarlin 2017/03/28 15:09:45 Removed.
// tracking memory doesn't introduce crashes.
- EXPECT_LT(0u, base::trace_event::EstimateMemoryUsage(cache_));
+ base::trace_event::MemoryDumpArgs args = {
+ base::trace_event::MemoryDumpLevelOfDetail::DETAILED};
xunjieli 2017/03/27 18:29:06 Could you run this with base::trace_event::MemoryD
jkarlin 2017/03/28 15:09:45 Done, and broke it out into separate tests.
+ base::trace_event::ProcessMemoryDump pmd(nullptr, args);
+ ASSERT_LT(0u, cache_->DumpMemoryStats(&pmd, ""));
+ EXPECT_LT(0u, pmd.allocator_dumps().size());
ASSERT_THAT(OpenEntry("the first key", &entry1), IsOk());
ASSERT_TRUE(NULL != entry1);
@@ -340,20 +344,20 @@ void DiskCacheBackendTest::BackendBasics() {
ASSERT_TRUE(NULL != entry1);
ASSERT_TRUE(NULL != entry2);
EXPECT_EQ(2, cache_->GetEntryCount());
- EXPECT_LT(0u, base::trace_event::EstimateMemoryUsage(cache_));
+ base::trace_event::ProcessMemoryDump pmd2(nullptr, args);
+ ASSERT_LT(0u, cache_->DumpMemoryStats(&pmd2, ""));
+ EXPECT_LT(0u, pmd2.allocator_dumps().size());
disk_cache::Entry* entry3 = NULL;
ASSERT_THAT(OpenEntry("some other key", &entry3), IsOk());
ASSERT_TRUE(NULL != entry3);
EXPECT_TRUE(entry2 == entry3);
- EXPECT_LT(0u, base::trace_event::EstimateMemoryUsage(cache_));
EXPECT_THAT(DoomEntry("some other key"), IsOk());
EXPECT_EQ(1, cache_->GetEntryCount());
entry1->Close();
entry2->Close();
entry3->Close();
- EXPECT_LT(0u, base::trace_event::EstimateMemoryUsage(cache_));
EXPECT_THAT(DoomEntry("the first key"), IsOk());
EXPECT_EQ(0, cache_->GetEntryCount());
@@ -365,7 +369,6 @@ void DiskCacheBackendTest::BackendBasics() {
EXPECT_THAT(DoomEntry("some other key"), IsOk());
EXPECT_EQ(0, cache_->GetEntryCount());
entry2->Close();
- EXPECT_LT(0u, base::trace_event::EstimateMemoryUsage(cache_));
}
TEST_F(DiskCacheBackendTest, Basics) {

Powered by Google App Engine
This is Rietveld 408576698