| Index: content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc
|
| diff --git a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc
|
| index cd7d819d523c15d76a5173d2c0da5e38a6d4716e..6496ec6e3cabd043931ba7cad480b3157c9a736c 100644
|
| --- a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc
|
| +++ b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc
|
| @@ -93,6 +93,15 @@ class IndexedDBQuotaClientTest : public testing::Test {
|
| return origins_;
|
| }
|
|
|
| + quota::QuotaStatusCode DeleteOrigin(quota::QuotaClient* client,
|
| + const GURL& origin_url) {
|
| + delete_status_ = quota::kQuotaStatusUnknown;
|
| + client->DeleteOriginData(origin_url, kTemp, callback_factory_.NewCallback(
|
| + &IndexedDBQuotaClientTest::OnDeleteOriginComplete));
|
| + MessageLoop::current()->RunAllPending();
|
| + return delete_status_;
|
| + }
|
| +
|
| IndexedDBContext* idb_context() { return idb_context_.get(); }
|
|
|
| void SetFileSizeTo(const FilePath& path, int size) {
|
| @@ -120,6 +129,10 @@ class IndexedDBQuotaClientTest : public testing::Test {
|
| origins_ = origins;
|
| }
|
|
|
| + void OnDeleteOriginComplete(quota::QuotaStatusCode code) {
|
| + delete_status_ = code;
|
| + }
|
| +
|
| ScopedTempDir temp_dir_;
|
| int64 usage_;
|
| std::set<GURL> origins_;
|
| @@ -127,6 +140,7 @@ class IndexedDBQuotaClientTest : public testing::Test {
|
| base::ScopedCallbackFactory<IndexedDBQuotaClientTest> callback_factory_;
|
| MessageLoop message_loop_;
|
| BrowserThread webkit_thread_;
|
| + quota::QuotaStatusCode delete_status_;
|
| };
|
|
|
|
|
| @@ -190,3 +204,19 @@ TEST_F(IndexedDBQuotaClientTest, GetOriginsForType) {
|
|
|
| EXPECT_TRUE(GetOriginsForType(&client, kPerm).empty());
|
| }
|
| +
|
| +TEST_F(IndexedDBQuotaClientTest, DeleteOrigin) {
|
| + IndexedDBQuotaClient client(
|
| + base::MessageLoopProxy::CreateForCurrentThread(),
|
| + idb_context());
|
| +
|
| + AddFakeIndexedDB(kOriginA, 1000);
|
| + AddFakeIndexedDB(kOriginB, 50);
|
| + EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp));
|
| + EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
|
| +
|
| + quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA);
|
| + EXPECT_EQ(quota::kQuotaStatusOk, delete_status);
|
| + EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp));
|
| + EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
|
| +}
|
|
|