summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-17 03:31:31 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-17 03:31:31 +0000
commit4b66b659788f41749e431b109b89ce8aa67952f4 (patch)
treef2b497ba81493714b2363740b080486281a3cf51 /webkit
parent74aafb471d019ab7e6197d19fc58e32c430f5c38 (diff)
downloadchromium_src-4b66b659788f41749e431b109b89ce8aa67952f4.zip
chromium_src-4b66b659788f41749e431b109b89ce8aa67952f4.tar.gz
chromium_src-4b66b659788f41749e431b109b89ce8aa67952f4.tar.bz2
Added DeleteOriginData to QuotaClient
BUG=61676 TEST=SandboxQuotaClientTest.DeleteOriginTest Review URL: http://codereview.chromium.org/7003021 Patch from Taiju Tsuiki <tzik@google.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85588 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/database/database_quota_client.cc10
-rw-r--r--webkit/database/database_quota_client.h3
-rw-r--r--webkit/fileapi/file_system_context.cc16
-rw-r--r--webkit/fileapi/file_system_context.h5
-rw-r--r--webkit/fileapi/sandbox_quota_client.cc49
-rw-r--r--webkit/fileapi/sandbox_quota_client.h5
-rw-r--r--webkit/fileapi/sandbox_quota_client_unittest.cc84
-rw-r--r--webkit/quota/mock_storage_client.cc30
-rw-r--r--webkit/quota/mock_storage_client.h7
-rw-r--r--webkit/quota/quota_client.h9
-rw-r--r--webkit/quota/quota_manager.h2
-rw-r--r--webkit/quota/quota_manager_unittest.cc55
12 files changed, 264 insertions, 11 deletions
diff --git a/webkit/database/database_quota_client.cc b/webkit/database/database_quota_client.cc
index 4f3da01..4e26e37 100644
--- a/webkit/database/database_quota_client.cc
+++ b/webkit/database/database_quota_client.cc
@@ -4,6 +4,8 @@
#include "webkit/database/database_quota_client.h"
+#include <vector>
+
#include "base/message_loop_proxy.h"
#include "net/base/net_util.h"
#include "webkit/database/database_tracker.h"
@@ -198,6 +200,14 @@ void DatabaseQuotaClient::GetOriginsForHost(
}
}
+void DatabaseQuotaClient::DeleteOriginData(const GURL& origin,
+ quota::StorageType type,
+ DeletionCallback* callback) {
+ // TODO(tzik): implement me
+ callback->Run(quota::kQuotaErrorNotSupported);
+ delete callback;
+}
+
void DatabaseQuotaClient::DidGetOriginUsage(
const GURL& origin_url, int64 usage) {
DCHECK(usage_for_origin_callbacks_.HasCallbacks(origin_url));
diff --git a/webkit/database/database_quota_client.h b/webkit/database/database_quota_client.h
index 5733e57..b965a97 100644
--- a/webkit/database/database_quota_client.h
+++ b/webkit/database/database_quota_client.h
@@ -40,6 +40,9 @@ class DatabaseQuotaClient : public quota::QuotaClient,
virtual void GetOriginsForHost(quota::StorageType type,
const std::string& host,
GetOriginsCallback* callback) OVERRIDE;
+ virtual void DeleteOriginData(const GURL& origin,
+ quota::StorageType type,
+ DeletionCallback* callback) OVERRIDE;
private:
class HelperTask;
class GetOriginUsageTask;
diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc
index d27b87d..97b1181 100644
--- a/webkit/fileapi/file_system_context.cc
+++ b/webkit/fileapi/file_system_context.cc
@@ -70,14 +70,24 @@ bool FileSystemContext::IsStorageUnlimited(const GURL& origin) {
special_storage_policy_->IsStorageUnlimited(origin));
}
-void FileSystemContext::DeleteDataForOriginOnFileThread(
+bool FileSystemContext::DeleteDataForOriginOnFileThread(
const GURL& origin_url) {
- DCHECK(path_manager_.get());
DCHECK(file_message_loop_->BelongsToCurrentThread());
+ // TODO(tzik): Report the amount of deleted data to QuotaManager.
FilePath path_for_origin =
sandbox_provider()->GetBaseDirectoryForOrigin(origin_url);
- file_util::Delete(path_for_origin, true /* recursive */);
+ return file_util::Delete(path_for_origin, true /* recursive */);
+}
+
+bool FileSystemContext::DeleteDataForOriginAndTypeOnFileThread(
+ const GURL& origin_url, FileSystemType type) {
+ DCHECK(file_message_loop_->BelongsToCurrentThread());
+ // TODO(tzik): ditto. Report the amount of deleted data to QuotaManager.
+
+ FilePath path_for_origin =
+ sandbox_provider()->GetBaseDirectoryForOriginAndType(origin_url, type);
+ return file_util::Delete(path_for_origin, true /* recursive */);
}
void FileSystemContext::DeleteOnCorrectThread() const {
diff --git a/webkit/fileapi/file_system_context.h b/webkit/fileapi/file_system_context.h
index f80e5f0..9a48023 100644
--- a/webkit/fileapi/file_system_context.h
+++ b/webkit/fileapi/file_system_context.h
@@ -7,6 +7,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "webkit/fileapi/file_system_types.h"
#include "webkit/quota/special_storage_policy.h"
class FilePath;
@@ -50,7 +51,9 @@ class FileSystemContext
// This method can be called on any thread.
bool IsStorageUnlimited(const GURL& origin);
- void DeleteDataForOriginOnFileThread(const GURL& origin_url);
+ bool DeleteDataForOriginOnFileThread(const GURL& origin_url);
+ bool DeleteDataForOriginAndTypeOnFileThread(const GURL& origin_url,
+ FileSystemType type);
FileSystemPathManager* path_manager() const { return path_manager_.get(); }
quota::QuotaManagerProxy* quota_manager_proxy() const {
diff --git a/webkit/fileapi/sandbox_quota_client.cc b/webkit/fileapi/sandbox_quota_client.cc
index 3b6ceda..541ecf1 100644
--- a/webkit/fileapi/sandbox_quota_client.cc
+++ b/webkit/fileapi/sandbox_quota_client.cc
@@ -184,6 +184,44 @@ class SandboxQuotaClient::GetOriginsForHostTask
std::string host_;
};
+class SandboxQuotaClient::DeleteOriginTask
+ : public QuotaThreadTask {
+ public:
+ DeleteOriginTask(
+ SandboxQuotaClient* quota_client,
+ scoped_refptr<MessageLoopProxy> file_message_loop,
+ const GURL& origin,
+ FileSystemType type,
+ DeletionCallback* callback)
+ : QuotaThreadTask(quota_client, file_message_loop),
+ file_system_context_(quota_client->file_system_context_),
+ origin_(origin),
+ type_(type),
+ status_(quota::kQuotaStatusUnknown),
+ callback_(callback) {
+ }
+
+ virtual ~DeleteOriginTask() {}
+
+ virtual void RunOnTargetThread() OVERRIDE {
+ if (file_system_context_->
+ DeleteDataForOriginAndTypeOnFileThread(origin_, type_))
+ status_ = quota::kQuotaStatusOk;
+ else
+ status_ = quota::kQuotaErrorInvalidModification;
+ }
+
+ virtual void Completed() OVERRIDE {
+ callback_->Run(status_);
+ }
+ private:
+ FileSystemContext* file_system_context_;
+ GURL origin_;
+ FileSystemType type_;
+ quota::QuotaStatusCode status_;
+ scoped_ptr<DeletionCallback> callback_;
+};
+
SandboxQuotaClient::SandboxQuotaClient(
scoped_refptr<base::MessageLoopProxy> file_message_loop,
FileSystemContext* file_system_context,
@@ -266,6 +304,17 @@ void SandboxQuotaClient::GetOriginsForHost(
}
}
+void SandboxQuotaClient::DeleteOriginData(const GURL& origin,
+ StorageType type,
+ DeletionCallback* callback) {
+ FileSystemType fs_type = QuotaStorageTypeToFileSystemType(type);
+ DCHECK(fs_type != kFileSystemTypeUnknown);
+ scoped_refptr<DeleteOriginTask> task(
+ new DeleteOriginTask(this, file_message_loop_,
+ origin, fs_type, callback));
+ task->Start();
+}
+
void SandboxQuotaClient::DidGetOriginUsage(
FileSystemType type, const GURL& origin_url, int64 usage) {
visited_origins_.insert(origin_url);
diff --git a/webkit/fileapi/sandbox_quota_client.h b/webkit/fileapi/sandbox_quota_client.h
index 7aae5fb..db39e08 100644
--- a/webkit/fileapi/sandbox_quota_client.h
+++ b/webkit/fileapi/sandbox_quota_client.h
@@ -8,6 +8,7 @@
#include <deque>
#include <list>
#include <map>
+#include <set>
#include <string>
#include "base/basictypes.h"
@@ -45,12 +46,16 @@ class SandboxQuotaClient : public quota::QuotaClient,
virtual void GetOriginsForHost(quota::StorageType type,
const std::string& host,
GetOriginsCallback* callback) OVERRIDE;
+ virtual void DeleteOriginData(const GURL& origin,
+ quota::StorageType type,
+ DeletionCallback* callback) OVERRIDE;
private:
class GetOriginUsageTask;
class GetOriginsTaskBase;
class GetOriginsForTypeTask;
class GetOriginsForHostTask;
+ class DeleteOriginTask;
typedef std::pair<fileapi::FileSystemType, std::string> TypeAndHostOrOrigin;
typedef quota::CallbackQueueMap1<GetUsageCallback*,
diff --git a/webkit/fileapi/sandbox_quota_client_unittest.cc b/webkit/fileapi/sandbox_quota_client_unittest.cc
index 1ffc2b2..09da1dd 100644
--- a/webkit/fileapi/sandbox_quota_client_unittest.cc
+++ b/webkit/fileapi/sandbox_quota_client_unittest.cc
@@ -33,7 +33,7 @@ const int kUsageFileSize = FileSystemUsageCache::kUsageFileSize;
class MockFileSystemPathManager : public FileSystemPathManager {
public:
- MockFileSystemPathManager(const FilePath& filesystem_path)
+ explicit MockFileSystemPathManager(const FilePath& filesystem_path)
: FileSystemPathManager(base::MessageLoopProxy::CreateForCurrentThread(),
filesystem_path, NULL, false, true) {}
};
@@ -44,7 +44,8 @@ class SandboxQuotaClientTest : public testing::Test {
public:
SandboxQuotaClientTest()
: callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
- additional_callback_count_(0) {
+ additional_callback_count_(0),
+ deletion_status_(quota::kQuotaStatusUnknown) {
}
void SetUp() {
@@ -177,7 +178,18 @@ class SandboxQuotaClientTest : public testing::Test {
}
}
+ void DeleteOriginData(SandboxQuotaClient* quota_client,
+ const char* origin,
+ quota::StorageType type) {
+ deletion_status_ = quota::kQuotaStatusUnknown;
+ quota_client->DeleteOriginData(
+ GURL(origin), type,
+ callback_factory_.NewCallback(
+ &SandboxQuotaClientTest::OnDeleteOrigin));
+ }
+
int64 usage() const { return usage_; }
+ quota::QuotaStatusCode status() { return deletion_status_; }
int additional_callback_count() const { return additional_callback_count_; }
void set_additional_callback_count(int count) {
additional_callback_count_ = count;
@@ -192,16 +204,21 @@ class SandboxQuotaClientTest : public testing::Test {
origins_ = origins;
}
- void OnGetAdditionalUsage(int64) {
+ void OnGetAdditionalUsage(int64 usage_unused) {
++additional_callback_count_;
}
+ void OnDeleteOrigin(quota::QuotaStatusCode status) {
+ deletion_status_ = status;
+ }
+
ScopedTempDir data_dir_;
scoped_refptr<FileSystemContext> file_system_context_;
base::ScopedCallbackFactory<SandboxQuotaClientTest> callback_factory_;
int64 usage_;
int additional_callback_count_;
std::set<GURL> origins_;
+ quota::QuotaStatusCode deletion_status_;
DISALLOW_COPY_AND_ASSIGN(SandboxQuotaClientTest);
};
@@ -431,4 +448,65 @@ TEST_F(SandboxQuotaClientTest, IncognitoTest) {
EXPECT_EQ(0U, origins.size());
}
+TEST_F(SandboxQuotaClientTest, DeleteOriginTest) {
+ scoped_ptr<SandboxQuotaClient> quota_client(NewQuotaClient(false));
+ const TestFile kFiles[] = {
+ {true, NULL, 0, "http://foo.com/", kTemporary},
+ {false, "a", 1, "http://foo.com/", kTemporary},
+ {true, NULL, 0, "https://foo.com/", kTemporary},
+ {false, "b", 2, "https://foo.com/", kTemporary},
+ {true, NULL, 0, "http://foo.com/", kPersistent},
+ {false, "c", 4, "http://foo.com/", kPersistent},
+ {true, NULL, 0, "http://bar.com/", kTemporary},
+ {false, "d", 8, "http://bar.com/", kTemporary},
+ {true, NULL, 0, "http://bar.com/", kPersistent},
+ {false, "e", 16, "http://bar.com/", kPersistent},
+ {true, NULL, 0, "https://bar.com/", kPersistent},
+ {false, "f", 32, "https://bar.com/", kPersistent},
+ {true, NULL, 0, "https://bar.com/", kTemporary},
+ {false, "g", 64, "https://bar.com/", kTemporary},
+ };
+ CreateFiles(kFiles, ARRAYSIZE_UNSAFE(kFiles));
+
+ DeleteOriginData(quota_client.get(), "http://foo.com/", kTemporary);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(quota::kQuotaStatusOk, status());
+
+ DeleteOriginData(quota_client.get(), "http://bar.com/", kPersistent);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(quota::kQuotaStatusOk, status());
+
+ DeleteOriginData(quota_client.get(), "http://buz.com/", kTemporary);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(quota::kQuotaStatusOk, status());
+
+ EXPECT_EQ(0, GetOriginUsage(
+ quota_client.get(), "http://foo.com/", kTemporary));
+ EXPECT_EQ(0, GetOriginUsage(
+ quota_client.get(), "http://bar.com/", kPersistent));
+ EXPECT_EQ(0, GetOriginUsage(
+ quota_client.get(), "http://buz.com/", kTemporary));
+
+ EXPECT_EQ(2 + kUsageFileSize,
+ GetOriginUsage(quota_client.get(),
+ "https://foo.com/",
+ kTemporary));
+ EXPECT_EQ(4 + kUsageFileSize,
+ GetOriginUsage(quota_client.get(),
+ "http://foo.com/",
+ kPersistent));
+ EXPECT_EQ(8 + kUsageFileSize,
+ GetOriginUsage(quota_client.get(),
+ "http://bar.com/",
+ kTemporary));
+ EXPECT_EQ(32 + kUsageFileSize,
+ GetOriginUsage(quota_client.get(),
+ "https://bar.com/",
+ kPersistent));
+ EXPECT_EQ(64 + kUsageFileSize,
+ GetOriginUsage(quota_client.get(),
+ "https://bar.com/",
+ kTemporary));
+}
+
} // namespace fileapi
diff --git a/webkit/quota/mock_storage_client.cc b/webkit/quota/mock_storage_client.cc
index e2e8a69..39958d1 100644
--- a/webkit/quota/mock_storage_client.cc
+++ b/webkit/quota/mock_storage_client.cc
@@ -52,6 +52,8 @@ MockStorageClient::~MockStorageClient() {
STLDeleteContainerPointers(usage_callbacks_.begin(), usage_callbacks_.end());
STLDeleteContainerPointers(
origins_callbacks_.begin(), origins_callbacks_.end());
+ STLDeleteContainerPointers(
+ deletion_callbacks_.begin(), deletion_callbacks_.end());
}
void MockStorageClient::AddMockOriginData(
@@ -111,6 +113,16 @@ void MockStorageClient::GetOriginsForHost(
type, host, callback));
}
+void MockStorageClient::DeleteOriginData(
+ const GURL& origin, StorageType type,
+ DeletionCallback* callback) {
+ deletion_callbacks_.insert(callback);
+ base::MessageLoopProxy::CreateForCurrentThread()->PostTask(
+ FROM_HERE, runnable_factory_.NewRunnableMethod(
+ &MockStorageClient::RunDeleteOriginData,
+ origin, type, callback));
+}
+
void MockStorageClient::RunGetOriginUsage(
const GURL& origin_url, StorageType type, GetUsageCallback* callback_ptr) {
usage_callbacks_.erase(callback_ptr);
@@ -151,4 +163,22 @@ void MockStorageClient::RunGetOriginsForHost(
callback->Run(origins);
}
+void MockStorageClient::RunDeleteOriginData(
+ const GURL& origin_url,
+ StorageType type,
+ DeletionCallback* callback_ptr) {
+ OriginDataMap::iterator itr
+ = origin_data_.find(make_pair(origin_url, type));
+ if (itr != origin_data_.end()) {
+ int64 delta = itr->second;
+ quota_manager_proxy_->
+ NotifyStorageModified(id(), origin_url, type, -delta);
+ origin_data_.erase(itr);
+ }
+
+ scoped_ptr<DeletionCallback> callback(callback_ptr);
+ deletion_callbacks_.erase(callback_ptr);
+ callback->Run(kQuotaStatusOk);
+}
+
} // namespace quota
diff --git a/webkit/quota/mock_storage_client.h b/webkit/quota/mock_storage_client.h
index cf0299a..6d8def2 100644
--- a/webkit/quota/mock_storage_client.h
+++ b/webkit/quota/mock_storage_client.h
@@ -39,6 +39,9 @@ class MockStorageClient : public QuotaClient {
GetOriginsCallback* callback) OVERRIDE;
virtual void GetOriginsForHost(StorageType type, const std::string& host,
GetOriginsCallback* callback) OVERRIDE;
+ virtual void DeleteOriginData(const GURL& origin,
+ StorageType type,
+ DeletionCallback* callback) OVERRIDE;
private:
void RunGetOriginUsage(const GURL& origin_url,
@@ -49,6 +52,9 @@ class MockStorageClient : public QuotaClient {
void RunGetOriginsForHost(StorageType type,
const std::string& host,
GetOriginsCallback* callback);
+ void RunDeleteOriginData(const GURL& origin_url,
+ StorageType type,
+ DeletionCallback* callback);
scoped_refptr<QuotaManagerProxy> quota_manager_proxy_;
const ID id_;
@@ -58,6 +64,7 @@ class MockStorageClient : public QuotaClient {
std::set<GetUsageCallback*> usage_callbacks_;
std::set<GetOriginsCallback*> origins_callbacks_;
+ std::set<DeletionCallback*> deletion_callbacks_;
ScopedRunnableMethodFactory<MockStorageClient> runnable_factory_;
diff --git a/webkit/quota/quota_client.h b/webkit/quota/quota_client.h
index 3e46159..d9499eb 100644
--- a/webkit/quota/quota_client.h
+++ b/webkit/quota/quota_client.h
@@ -5,8 +5,9 @@
#ifndef WEBKIT_QUOTA_QUOTA_CLIENT_H_
#define WEBKIT_QUOTA_QUOTA_CLIENT_H_
-#include <set>
#include <list>
+#include <set>
+#include <string>
#include "base/callback_old.h"
#include "base/time.h"
@@ -23,6 +24,7 @@ class QuotaClient {
public:
typedef Callback1<int64>::Type GetUsageCallback;
typedef Callback1<const std::set<GURL>&>::Type GetOriginsCallback;
+ typedef Callback1<QuotaStatusCode>::Type DeletionCallback;
virtual ~QuotaClient() {}
@@ -57,6 +59,11 @@ class QuotaClient {
virtual void GetOriginsForHost(StorageType type,
const std::string& host,
GetOriginsCallback* callback) = 0;
+
+ // Called by the QuotaManager.
+ virtual void DeleteOriginData(const GURL& origin,
+ StorageType type,
+ DeletionCallback* callback) = 0;
};
typedef std::list<QuotaClient*> QuotaClientList;
diff --git a/webkit/quota/quota_manager.h b/webkit/quota/quota_manager.h
index 0d63c84..955cab5 100644
--- a/webkit/quota/quota_manager.h
+++ b/webkit/quota/quota_manager.h
@@ -14,9 +14,9 @@
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/file_path.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_callback_factory.h"
#include "base/memory/scoped_ptr.h"
-#include "base/memory/ref_counted.h"
#include "webkit/quota/quota_client.h"
#include "webkit/quota/quota_task.h"
#include "webkit/quota/quota_types.h"
diff --git a/webkit/quota/quota_manager_unittest.cc b/webkit/quota/quota_manager_unittest.cc
index fd6e671..3c519b4 100644
--- a/webkit/quota/quota_manager_unittest.cc
+++ b/webkit/quota/quota_manager_unittest.cc
@@ -4,8 +4,6 @@
#include <vector>
-#include "testing/gtest/include/gtest/gtest.h"
-
#include "base/file_util.h"
#include "base/memory/scoped_callback_factory.h"
#include "base/memory/scoped_ptr.h"
@@ -13,6 +11,7 @@
#include "base/message_loop.h"
#include "base/message_loop_proxy.h"
#include "base/stl_util-inl.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaError.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h"
#include "webkit/quota/mock_storage_client.h"
@@ -132,6 +131,15 @@ class QuotaManagerTest : public testing::Test {
&QuotaManagerTest::DidGetUsageAndQuotaAdditional));
}
+ void DeleteOriginData(QuotaClient* client,
+ const GURL& origin,
+ StorageType type) {
+ quota_status_ = kQuotaStatusUnknown;
+ client->DeleteOriginData(origin, type,
+ callback_factory_.NewCallback(
+ &QuotaManagerTest::DidDelete));
+ }
+
void DidGetUsageAndQuota(QuotaStatusCode status, int64 usage, int64 quota) {
quota_status_ = status;
usage_ = usage;
@@ -158,6 +166,10 @@ class QuotaManagerTest : public testing::Test {
usage_ = usage;
}
+ void DidDelete(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(
@@ -667,4 +679,43 @@ TEST_F(QuotaManagerTest, GetUsage_WithModification) {
EXPECT_EQ(usage(), 4000 + 50000 + 900000000);
}
+TEST_F(QuotaManagerTest, GetUsage_WithDeleteOrigin) {
+ 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();
+ int64 predelete_global_tmp = usage();
+
+ GetHostUsage("foo.com", kStorageTypeTemporary);
+ MessageLoop::current()->RunAllPending();
+ int64 predelete_host_tmp = usage();
+
+ GetHostUsage("foo.com", kStorageTypePersistent);
+ MessageLoop::current()->RunAllPending();
+ int64 predelete_host_pers = usage();
+
+ DeleteOriginData(client, GURL("http://foo.com/"), kStorageTypeTemporary);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(kQuotaStatusOk, status());
+
+ GetGlobalUsage(kStorageTypeTemporary);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(predelete_global_tmp - 1, usage());
+
+ GetHostUsage("foo.com", kStorageTypeTemporary);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(predelete_host_tmp - 1, usage());
+
+ GetHostUsage("foo.com", kStorageTypePersistent);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(predelete_host_pers, usage());
+}
+
} // namespace quota