summaryrefslogtreecommitdiffstats
path: root/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser/indexed_db/indexed_db_quota_client_unittest.cc')
-rw-r--r--content/browser/indexed_db/indexed_db_quota_client_unittest.cc58
1 files changed, 24 insertions, 34 deletions
diff --git a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
index 2570f9d..e87f2a5 100644
--- a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
@@ -48,15 +48,15 @@ class IndexedDBQuotaClientTest : public testing::Test {
io_thread_(BrowserThread::IO, &message_loop_) {
browser_context_.reset(new TestBrowserContext());
idb_context_ = static_cast<IndexedDBContextImpl*>(
- BrowserContext::GetDefaultStoragePartition(browser_context_.get())->
- GetIndexedDBContext());
+ BrowserContext::GetDefaultStoragePartition(browser_context_.get())
+ ->GetIndexedDBContext());
message_loop_.RunUntilIdle();
setup_temp_dir();
}
void setup_temp_dir() {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
- base::FilePath indexeddb_dir = temp_dir_.path().Append(
- IndexedDBContextImpl::kIndexedDBDirectory);
+ base::FilePath indexeddb_dir =
+ temp_dir_.path().Append(IndexedDBContextImpl::kIndexedDBDirectory);
ASSERT_TRUE(file_util::CreateDirectory(indexeddb_dir));
idb_context()->set_data_path_for_testing(indexeddb_dir);
}
@@ -71,13 +71,13 @@ class IndexedDBQuotaClientTest : public testing::Test {
base::MessageLoop::current()->RunUntilIdle();
}
- int64 GetOriginUsage(
- quota::QuotaClient* client,
- const GURL& origin,
- quota::StorageType type) {
+ int64 GetOriginUsage(quota::QuotaClient* client,
+ const GURL& origin,
+ quota::StorageType type) {
usage_ = -1;
client->GetOriginUsage(
- origin, type,
+ origin,
+ type,
base::Bind(&IndexedDBQuotaClientTest::OnGetOriginUsageComplete,
weak_factory_.GetWeakPtr()));
base::MessageLoop::current()->RunUntilIdle();
@@ -85,9 +85,8 @@ class IndexedDBQuotaClientTest : public testing::Test {
return usage_;
}
- const std::set<GURL>& GetOriginsForType(
- quota::QuotaClient* client,
- quota::StorageType type) {
+ const std::set<GURL>& GetOriginsForType(quota::QuotaClient* client,
+ quota::StorageType type) {
origins_.clear();
type_ = quota::kStorageTypeTemporary;
client->GetOriginsForType(
@@ -98,14 +97,14 @@ class IndexedDBQuotaClientTest : public testing::Test {
return origins_;
}
- const std::set<GURL>& GetOriginsForHost(
- quota::QuotaClient* client,
- quota::StorageType type,
- const std::string& host) {
+ const std::set<GURL>& GetOriginsForHost(quota::QuotaClient* client,
+ quota::StorageType type,
+ const std::string& host) {
origins_.clear();
type_ = quota::kStorageTypeTemporary;
client->GetOriginsForHost(
- type, host,
+ type,
+ host,
base::Bind(&IndexedDBQuotaClientTest::OnGetOriginsComplete,
weak_factory_.GetWeakPtr()));
base::MessageLoop::current()->RunUntilIdle();
@@ -116,7 +115,8 @@ class IndexedDBQuotaClientTest : public testing::Test {
const GURL& origin_url) {
delete_status_ = quota::kQuotaStatusUnknown;
client->DeleteOriginData(
- origin_url, kTemp,
+ origin_url,
+ kTemp,
base::Bind(&IndexedDBQuotaClientTest::OnDeleteOriginComplete,
weak_factory_.GetWeakPtr()));
base::MessageLoop::current()->RunUntilIdle();
@@ -143,12 +143,10 @@ class IndexedDBQuotaClientTest : public testing::Test {
}
private:
- void OnGetOriginUsageComplete(int64 usage) {
- usage_ = usage;
- }
+ void OnGetOriginUsageComplete(int64 usage) { usage_ = usage; }
void OnGetOriginsComplete(const std::set<GURL>& origins,
- quota::StorageType type) {
+ quota::StorageType type) {
origins_ = origins;
type_ = type;
}
@@ -174,9 +172,7 @@ class IndexedDBQuotaClientTest : public testing::Test {
};
TEST_F(IndexedDBQuotaClientTest, GetOriginUsage) {
- IndexedDBQuotaClient client(
- base::MessageLoopProxy::current(),
- idb_context());
+ IndexedDBQuotaClient client(base::MessageLoopProxy::current(), idb_context());
AddFakeIndexedDB(kOriginA, 6);
AddFakeIndexedDB(kOriginB, 3);
@@ -193,9 +189,7 @@ TEST_F(IndexedDBQuotaClientTest, GetOriginUsage) {
}
TEST_F(IndexedDBQuotaClientTest, GetOriginsForHost) {
- IndexedDBQuotaClient client(
- base::MessageLoopProxy::current(),
- idb_context());
+ IndexedDBQuotaClient client(base::MessageLoopProxy::current(), idb_context());
EXPECT_EQ(kOriginA.host(), kOriginB.host());
EXPECT_NE(kOriginA.host(), kOriginOther.host());
@@ -219,9 +213,7 @@ TEST_F(IndexedDBQuotaClientTest, GetOriginsForHost) {
}
TEST_F(IndexedDBQuotaClientTest, GetOriginsForType) {
- IndexedDBQuotaClient client(
- base::MessageLoopProxy::current(),
- idb_context());
+ IndexedDBQuotaClient client(base::MessageLoopProxy::current(), idb_context());
EXPECT_TRUE(GetOriginsForType(&client, kTemp).empty());
EXPECT_TRUE(GetOriginsForType(&client, kPerm).empty());
@@ -235,9 +227,7 @@ TEST_F(IndexedDBQuotaClientTest, GetOriginsForType) {
}
TEST_F(IndexedDBQuotaClientTest, DeleteOrigin) {
- IndexedDBQuotaClient client(
- base::MessageLoopProxy::current(),
- idb_context());
+ IndexedDBQuotaClient client(base::MessageLoopProxy::current(), idb_context());
AddFakeIndexedDB(kOriginA, 1000);
AddFakeIndexedDB(kOriginB, 50);