Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: content/browser/indexed_db/indexed_db_quota_client_unittest.cc

Issue 214233005: Move mock_quota_manager and friends from webkit/ to content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.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/message_loop/message_loop.h"
12 #include "base/test/test_simple_task_runner.h" 12 #include "base/test/test_simple_task_runner.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "content/browser/browser_thread_impl.h" 14 #include "content/browser/browser_thread_impl.h"
15 #include "content/browser/indexed_db/indexed_db_context_impl.h" 15 #include "content/browser/indexed_db/indexed_db_context_impl.h"
16 #include "content/browser/indexed_db/indexed_db_quota_client.h" 16 #include "content/browser/indexed_db/indexed_db_quota_client.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 "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 #include "webkit/browser/quota/mock_quota_manager.h"
22 #include "webkit/common/database/database_identifier.h" 22 #include "webkit/common/database/database_identifier.h"
23 23
24 // Declared to shorten the line lengths. 24 // Declared to shorten the line lengths.
25 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; 25 static const quota::StorageType kTemp = quota::kStorageTypeTemporary;
26 static const quota::StorageType kPerm = quota::kStorageTypePersistent; 26 static const quota::StorageType kPerm = quota::kStorageTypePersistent;
27 27
28 namespace content { 28 namespace content {
29 29
30 // Base class for our test fixtures. 30 // Base class for our test fixtures.
31 class IndexedDBQuotaClientTest : public testing::Test { 31 class IndexedDBQuotaClientTest : public testing::Test {
32 public: 32 public:
33 const GURL kOriginA; 33 const GURL kOriginA;
34 const GURL kOriginB; 34 const GURL kOriginB;
35 const GURL kOriginOther; 35 const GURL kOriginOther;
36 36
37 IndexedDBQuotaClientTest() 37 IndexedDBQuotaClientTest()
38 : kOriginA("http://host"), 38 : kOriginA("http://host"),
39 kOriginB("http://host:8000"), 39 kOriginB("http://host:8000"),
40 kOriginOther("http://other"), 40 kOriginOther("http://other"),
41 usage_(0), 41 usage_(0),
42 task_runner_(new base::TestSimpleTaskRunner), 42 task_runner_(new base::TestSimpleTaskRunner),
43 weak_factory_(this) { 43 weak_factory_(this) {
44 browser_context_.reset(new TestBrowserContext()); 44 browser_context_.reset(new TestBrowserContext());
45 45
46 scoped_refptr<quota::QuotaManager> quota_manager = 46 scoped_refptr<quota::QuotaManager> quota_manager =
47 new quota::MockQuotaManager( 47 new MockQuotaManager(
48 false /*in_memory*/, 48 false /*in_memory*/,
49 browser_context_->GetPath(), 49 browser_context_->GetPath(),
50 base::MessageLoop::current()->message_loop_proxy(), 50 base::MessageLoop::current()->message_loop_proxy(),
51 base::MessageLoop::current()->message_loop_proxy(), 51 base::MessageLoop::current()->message_loop_proxy(),
52 browser_context_->GetSpecialStoragePolicy()); 52 browser_context_->GetSpecialStoragePolicy());
53 53
54 idb_context_ = 54 idb_context_ =
55 new IndexedDBContextImpl(browser_context_->GetPath(), 55 new IndexedDBContextImpl(browser_context_->GetPath(),
56 browser_context_->GetSpecialStoragePolicy(), 56 browser_context_->GetSpecialStoragePolicy(),
57 quota_manager->proxy(), 57 quota_manager->proxy(),
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); 237 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp));
238 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); 238 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
239 239
240 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); 240 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA);
241 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); 241 EXPECT_EQ(quota::kQuotaStatusOk, delete_status);
242 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); 242 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp));
243 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); 243 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
244 } 244 }
245 245
246 } // namespace content 246 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/file_system_operation_impl_write_unittest.cc ('k') | content/browser/quota/mock_quota_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698