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" |
| 11 #include "base/message_loop/message_loop.h" |
11 #include "base/test/test_simple_task_runner.h" | 12 #include "base/test/test_simple_task_runner.h" |
12 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
13 #include "content/browser/browser_thread_impl.h" | 14 #include "content/browser/browser_thread_impl.h" |
14 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 15 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
15 #include "content/browser/indexed_db/indexed_db_quota_client.h" | 16 #include "content/browser/indexed_db/indexed_db_quota_client.h" |
16 #include "content/browser/quota/mock_quota_manager.h" | 17 #include "content/browser/quota/mock_quota_manager.h" |
17 #include "content/public/browser/storage_partition.h" | 18 #include "content/public/browser/storage_partition.h" |
18 #include "content/public/test/test_browser_context.h" | 19 #include "content/public/test/test_browser_context.h" |
19 #include "content/public/test/test_browser_thread_bundle.h" | 20 #include "content/public/test/test_browser_thread_bundle.h" |
20 #include "storage/common/database/database_identifier.h" | 21 #include "storage/common/database/database_identifier.h" |
(...skipping 15 matching lines...) Expand all Loading... |
36 IndexedDBQuotaClientTest() | 37 IndexedDBQuotaClientTest() |
37 : kOriginA("http://host"), | 38 : kOriginA("http://host"), |
38 kOriginB("http://host:8000"), | 39 kOriginB("http://host:8000"), |
39 kOriginOther("http://other"), | 40 kOriginOther("http://other"), |
40 usage_(0), | 41 usage_(0), |
41 task_runner_(new base::TestSimpleTaskRunner), | 42 task_runner_(new base::TestSimpleTaskRunner), |
42 weak_factory_(this) { | 43 weak_factory_(this) { |
43 browser_context_.reset(new TestBrowserContext()); | 44 browser_context_.reset(new TestBrowserContext()); |
44 | 45 |
45 scoped_refptr<storage::QuotaManager> quota_manager = | 46 scoped_refptr<storage::QuotaManager> quota_manager = |
46 new MockQuotaManager(false /*in_memory*/, browser_context_->GetPath(), | 47 new MockQuotaManager(false /*in_memory*/, |
47 base::MessageLoop::current()->task_runner(), | 48 browser_context_->GetPath(), |
48 base::MessageLoop::current()->task_runner(), | 49 base::MessageLoop::current()->message_loop_proxy(), |
| 50 base::MessageLoop::current()->message_loop_proxy(), |
49 browser_context_->GetSpecialStoragePolicy()); | 51 browser_context_->GetSpecialStoragePolicy()); |
50 | 52 |
51 idb_context_ = | 53 idb_context_ = |
52 new IndexedDBContextImpl(browser_context_->GetPath(), | 54 new IndexedDBContextImpl(browser_context_->GetPath(), |
53 browser_context_->GetSpecialStoragePolicy(), | 55 browser_context_->GetSpecialStoragePolicy(), |
54 quota_manager->proxy(), | 56 quota_manager->proxy(), |
55 task_runner_.get()); | 57 task_runner_.get()); |
56 base::MessageLoop::current()->RunUntilIdle(); | 58 base::MessageLoop::current()->RunUntilIdle(); |
57 setup_temp_dir(); | 59 setup_temp_dir(); |
58 } | 60 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); | 236 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); |
235 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 237 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
236 | 238 |
237 storage::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); | 239 storage::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); |
238 EXPECT_EQ(storage::kQuotaStatusOk, delete_status); | 240 EXPECT_EQ(storage::kQuotaStatusOk, delete_status); |
239 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); | 241 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); |
240 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 242 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
241 } | 243 } |
242 | 244 |
243 } // namespace content | 245 } // namespace content |
OLD | NEW |