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

Unified Diff: webkit/quota/quota_manager_unittest.cc

Issue 7029007: Implement EvictOriginData in QuotaManager. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added a. test function. (Not working well, and not reflected the comments.) Created 9 years, 7 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
« webkit/quota/quota_manager.cc ('K') | « webkit/quota/quota_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/quota/quota_manager_unittest.cc
diff --git a/webkit/quota/quota_manager_unittest.cc b/webkit/quota/quota_manager_unittest.cc
index 3c519b418d78d1111bfa3c57c26382239aa29e5f..b479edb50d967e02e4b0c1f9b4607778798db9b1 100644
--- a/webkit/quota/quota_manager_unittest.cc
+++ b/webkit/quota/quota_manager_unittest.cc
@@ -140,6 +140,14 @@ class QuotaManagerTest : public testing::Test {
&QuotaManagerTest::DidDelete));
}
+ void EvictOriginData(const GURL& origin,
+ StorageType type) {
+ quota_status_ = kQuotaStatusUnknown;
+ quota_manager_->EvictOriginData(origin, type,
+ callback_factory_.NewCallback(
+ &QuotaManagerTest::DidDelete));
michaeln 2011/05/17 19:30:01 DidEvict?
Dai Mikurube (NOT FULLTIME) 2011/05/18 04:34:48 Exactly. Done.
+ }
+
void DidGetUsageAndQuota(QuotaStatusCode status, int64 usage, int64 quota) {
quota_status_ = status;
usage_ = usage;
@@ -170,6 +178,10 @@ class QuotaManagerTest : public testing::Test {
quota_status_ = status;
}
+ void DidEvictOriginData(QuotaStatusCode status) {
+ quota_status_ = status;
+ }
+
void set_additional_callback_count(int c) { additional_callback_count_ = c; }
int additional_callback_count() const { return additional_callback_count_; }
void DidGetUsageAndQuotaAdditional(
@@ -718,4 +730,26 @@ TEST_F(QuotaManagerTest, GetUsage_WithDeleteOrigin) {
EXPECT_EQ(predelete_host_pers, usage());
}
+TEST_F(QuotaManagerTest, EvictOriginData) {
+ static const MockOriginData kData[] = {
+ { "http://foo.com/", kStorageTypeTemporary, 1 },
+ { "http://foo.com:1/", kStorageTypeTemporary, 20 },
+ { "http://foo.com/", kStorageTypePersistent, 300 },
+ { "http://bar.com/", kStorageTypeTemporary, 4000 },
+ };
+ MockStorageClient* client = CreateClient(kData, ARRAYSIZE_UNSAFE(kData));
+ RegisterClient(client);
+
+ GetGlobalUsage(kStorageTypeTemporary);
+ MessageLoop::current()->RunAllPending();
+ LOG(ERROR) << usage();
+
+ EvictOriginData(GURL("http://bar.com/"), kStorageTypeTemporary);
+ MessageLoop::current()->RunAllPending();
+
+ GetGlobalUsage(kStorageTypeTemporary);
+ MessageLoop::current()->RunAllPending();
+ LOG(ERROR) << usage();
+}
+
} // namespace quota
« webkit/quota/quota_manager.cc ('K') | « webkit/quota/quota_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698