OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <map> | 5 #include <map> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 void FlushIndexedDBTaskRunner() { task_runner_->RunUntilIdle(); } | 62 void FlushIndexedDBTaskRunner() { task_runner_->RunUntilIdle(); } |
63 | 63 |
64 void setup_temp_dir() { | 64 void setup_temp_dir() { |
65 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 65 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
66 base::FilePath indexeddb_dir = | 66 base::FilePath indexeddb_dir = |
67 temp_dir_.path().Append(IndexedDBContextImpl::kIndexedDBDirectory); | 67 temp_dir_.path().Append(IndexedDBContextImpl::kIndexedDBDirectory); |
68 ASSERT_TRUE(base::CreateDirectory(indexeddb_dir)); | 68 ASSERT_TRUE(base::CreateDirectory(indexeddb_dir)); |
69 idb_context()->set_data_path_for_testing(indexeddb_dir); | 69 idb_context()->set_data_path_for_testing(indexeddb_dir); |
70 } | 70 } |
71 | 71 |
72 virtual ~IndexedDBQuotaClientTest() { | 72 ~IndexedDBQuotaClientTest() override { |
73 FlushIndexedDBTaskRunner(); | 73 FlushIndexedDBTaskRunner(); |
74 idb_context_ = NULL; | 74 idb_context_ = NULL; |
75 browser_context_.reset(); | 75 browser_context_.reset(); |
76 base::MessageLoop::current()->RunUntilIdle(); | 76 base::MessageLoop::current()->RunUntilIdle(); |
77 } | 77 } |
78 | 78 |
79 int64 GetOriginUsage(storage::QuotaClient* client, | 79 int64 GetOriginUsage(storage::QuotaClient* client, |
80 const GURL& origin, | 80 const GURL& origin, |
81 storage::StorageType type) { | 81 storage::StorageType type) { |
82 usage_ = -1; | 82 usage_ = -1; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); | 236 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); |
237 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 237 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
238 | 238 |
239 storage::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); | 239 storage::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); |
240 EXPECT_EQ(storage::kQuotaStatusOk, delete_status); | 240 EXPECT_EQ(storage::kQuotaStatusOk, delete_status); |
241 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); | 241 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); |
242 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 242 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
243 } | 243 } |
244 | 244 |
245 } // namespace content | 245 } // namespace content |
OLD | NEW |