| Index: trunk/src/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
|
| ===================================================================
|
| --- trunk/src/content/browser/indexed_db/indexed_db_quota_client_unittest.cc (revision 202301)
|
| +++ trunk/src/content/browser/indexed_db/indexed_db_quota_client_unittest.cc (working copy)
|
| @@ -48,15 +48,15 @@
|
| 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 @@
|
| 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,8 +85,9 @@
|
| 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(
|
| @@ -97,14 +98,14 @@
|
| 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();
|
| @@ -115,8 +116,7 @@
|
| 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,10 +143,12 @@
|
| }
|
|
|
| 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;
|
| }
|
| @@ -172,7 +174,9 @@
|
| };
|
|
|
| TEST_F(IndexedDBQuotaClientTest, GetOriginUsage) {
|
| - IndexedDBQuotaClient client(base::MessageLoopProxy::current(), idb_context());
|
| + IndexedDBQuotaClient client(
|
| + base::MessageLoopProxy::current(),
|
| + idb_context());
|
|
|
| AddFakeIndexedDB(kOriginA, 6);
|
| AddFakeIndexedDB(kOriginB, 3);
|
| @@ -189,7 +193,9 @@
|
| }
|
|
|
| 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());
|
| @@ -213,7 +219,9 @@
|
| }
|
|
|
| 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());
|
| @@ -227,7 +235,9 @@
|
| }
|
|
|
| TEST_F(IndexedDBQuotaClientTest, DeleteOrigin) {
|
| - IndexedDBQuotaClient client(base::MessageLoopProxy::current(), idb_context());
|
| + IndexedDBQuotaClient client(
|
| + base::MessageLoopProxy::current(),
|
| + idb_context());
|
|
|
| AddFakeIndexedDB(kOriginA, 1000);
|
| AddFakeIndexedDB(kOriginB, 50);
|
|
|