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

Unified Diff: net/disk_cache/backend_unittest.cc

Issue 13731002: Cache Backend Proxy to intercept all cache events from the IO thread. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: added destructor Created 7 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 | « no previous file | net/disk_cache/cache_creator.cc » ('j') | net/disk_cache/in_flight_backend_io.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+}
« no previous file with comments | « no previous file | net/disk_cache/cache_creator.cc » ('j') | net/disk_cache/in_flight_backend_io.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698