Index: net/disk_cache/backend_unittest.cc |
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc |
index 2f401c8cfcbdea79b56826fce07108a5d9ea1f12..4d9af6ef45bf6261baaab2028132adf8869e262b 100644 |
--- a/net/disk_cache/backend_unittest.cc |
+++ b/net/disk_cache/backend_unittest.cc |
@@ -18,6 +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 "net/base/cache_type.h" |
#include "net/base/io_buffer.h" |
#include "net/base/net_errors.h" |
@@ -323,6 +324,9 @@ void DiskCacheBackendTest::BackendBasics() { |
ASSERT_TRUE(NULL != entry1); |
entry1->Close(); |
entry1 = NULL; |
+ // base::trace_event::EstimateMemoryUsage(cache_) is added to make sure |
+ // tracking memory doesn't introduce crashes. |
+ base::trace_event::EstimateMemoryUsage(cache_); |
ASSERT_THAT(OpenEntry("the first key", &entry1), IsOk()); |
ASSERT_TRUE(NULL != entry1); |
@@ -336,6 +340,7 @@ void DiskCacheBackendTest::BackendBasics() { |
ASSERT_TRUE(NULL != entry1); |
ASSERT_TRUE(NULL != entry2); |
EXPECT_EQ(2, cache_->GetEntryCount()); |
+ base::trace_event::EstimateMemoryUsage(cache_); |
disk_cache::Entry* entry3 = NULL; |
ASSERT_THAT(OpenEntry("some other key", &entry3), IsOk()); |
@@ -348,6 +353,7 @@ void DiskCacheBackendTest::BackendBasics() { |
entry1->Close(); |
entry2->Close(); |
entry3->Close(); |
+ base::trace_event::EstimateMemoryUsage(cache_); |
EXPECT_THAT(DoomEntry("the first key"), IsOk()); |
EXPECT_EQ(0, cache_->GetEntryCount()); |
@@ -359,6 +365,7 @@ void DiskCacheBackendTest::BackendBasics() { |
EXPECT_THAT(DoomEntry("some other key"), IsOk()); |
EXPECT_EQ(0, cache_->GetEntryCount()); |
entry2->Close(); |
+ base::trace_event::EstimateMemoryUsage(cache_); |
} |
TEST_F(DiskCacheBackendTest, Basics) { |