Index: net/disk_cache/backend_unittest.cc |
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc |
index 0cd754166cd38a5b0e0917f77a6d4aabee00d878..18a70139e2a8f3a8f7efc01ba3e3979655367118 100644 |
--- a/net/disk_cache/backend_unittest.cc |
+++ b/net/disk_cache/backend_unittest.cc |
@@ -20,6 +20,7 @@ |
#include "net/disk_cache/histogram_macros.h" |
#include "net/disk_cache/mapped_file.h" |
#include "net/disk_cache/mem_backend_impl.h" |
+#include "net/disk_cache/tracing_cache_backend.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#if defined(OS_WIN) |
@@ -71,6 +72,7 @@ class DiskCacheBackendTest : public DiskCacheTestWithCache { |
void BackendDisable2(); |
void BackendDisable3(); |
void BackendDisable4(); |
+ void TracingBackendBasics(); |
}; |
void DiskCacheBackendTest::BackendBasics() { |
@@ -2663,3 +2665,45 @@ TEST_F(DiskCacheBackendTest, ShaderCacheUpdateRankForExternalCacheHit) { |
ASSERT_EQ(net::OK, OpenEntry("key0", &entry)); |
entry->Close(); |
} |
+ |
+void DiskCacheBackendTest::TracingBackendBasics() { |
+ InitCache(); |
+ cache_ = new disk_cache::TracingCacheBackend(cache_); |
+ cache_impl_ = NULL; |
+ EXPECT_EQ(net::DISK_CACHE, cache_->GetCacheType()); |
+ if (!simple_cache_mode_) { |
+ EXPECT_EQ(0, cache_->GetEntryCount()); |
+ } |
+ |
+ net::TestCompletionCallback cb; |
+ disk_cache::Entry* entry = NULL; |
+ EXPECT_NE(net::OK, OpenEntry("key", &entry)); |
+ EXPECT_TRUE(NULL == entry); |
+ |
+ ASSERT_EQ(net::OK, CreateEntry("key", &entry)); |
+ EXPECT_TRUE(NULL != entry); |
+ |
+ disk_cache::Entry* same_entry = NULL; |
+ ASSERT_EQ(net::OK, OpenEntry("key", &same_entry)); |
+ EXPECT_TRUE(NULL != same_entry); |
+ |
+ if (!simple_cache_mode_) { |
+ EXPECT_EQ(1, cache_->GetEntryCount()); |
+ } |
+ entry->Close(); |
+ entry = NULL; |
+ same_entry->Close(); |
+ same_entry = NULL; |
+} |
+ |
+#ifdef USE_TRACING_CACHE_BACKEND |
rvargas (doing something else)
2013/04/05 19:25:13
This has no relation with the active defines for t
pasko-google - do not use
2013/04/08 15:37:40
This guards against someone trying to run tests wi
|
+#error "The tracing backend should be created manually in tests" |
+#endif |
+TEST_F(DiskCacheBackendTest, TracingBackendBasicsWithBackendImpl) { |
+ TracingBackendBasics(); |
+} |
+ |
+TEST_F(DiskCacheBackendTest, TracingBackendBasicsWithSimpleBackend) { |
+ SetSimpleCacheMode(); |
+ TracingBackendBasics(); |
+} |