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

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: trivial net.gyp merge 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') | no next file with comments »
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..b5826b6a8bc6225adb6237b508fd7a60f266fd92 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,52 @@ 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;
+}
+
+TEST_F(DiskCacheBackendTest, TracingBackendBasicsWithBackendImpl) {
+ TracingBackendBasics();
+}
+
+// File renaming is flaky on Windows, disable all Simple Backend Tests there.
+#ifdef OS_WIN
+#define TEST_SIMPLECACHE_F(c, t) TEST_F(c, DISABLED_##t)
+#else
+#define TEST_SIMPLECACHE_F(c, t) TEST_F(c, t)
+#endif
+
+TEST_SIMPLECACHE_F(DiskCacheBackendTest,
+ TracingBackendBasicsWithSimpleBackend) {
+ SetSimpleCacheMode();
+ TracingBackendBasics();
+ // TODO(pasko): implement integrity checking on the Simple Backend.
+ DisableIntegrityCheck();
+}
« no previous file with comments | « no previous file | net/disk_cache/cache_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698