OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <set> | 5 #include <set> |
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/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "content/browser/quota/mock_quota_manager.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "webkit/browser/quota/mock_quota_manager.h" | |
15 #include "webkit/browser/quota/mock_special_storage_policy.h" | 15 #include "webkit/browser/quota/mock_special_storage_policy.h" |
16 #include "webkit/browser/quota/mock_storage_client.h" | 16 #include "webkit/browser/quota/mock_storage_client.h" |
17 | 17 |
18 namespace quota { | 18 using quota::kQuotaStatusOk; |
| 19 using quota::kStorageTypePersistent; |
| 20 using quota::kStorageTypeTemporary; |
| 21 using quota::MockSpecialStoragePolicy; |
| 22 |
| 23 namespace content { |
19 | 24 |
20 const char kTestOrigin1[] = "http://host1:1/"; | 25 const char kTestOrigin1[] = "http://host1:1/"; |
21 const char kTestOrigin2[] = "http://host2:1/"; | 26 const char kTestOrigin2[] = "http://host2:1/"; |
22 const char kTestOrigin3[] = "http://host3:1/"; | 27 const char kTestOrigin3[] = "http://host3:1/"; |
23 | 28 |
24 const GURL kOrigin1(kTestOrigin1); | 29 const GURL kOrigin1(kTestOrigin1); |
25 const GURL kOrigin2(kTestOrigin2); | 30 const GURL kOrigin2(kTestOrigin2); |
26 const GURL kOrigin3(kTestOrigin3); | 31 const GURL kOrigin3(kTestOrigin3); |
27 | 32 |
28 const StorageType kTemporary = kStorageTypeTemporary; | 33 const StorageType kTemporary = kStorageTypeTemporary; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void DeleteOriginData(const GURL& origin, StorageType type, | 74 void DeleteOriginData(const GURL& origin, StorageType type, |
70 int quota_client_mask) { | 75 int quota_client_mask) { |
71 manager_->DeleteOriginData( | 76 manager_->DeleteOriginData( |
72 origin, type, quota_client_mask, | 77 origin, type, quota_client_mask, |
73 base::Bind(&MockQuotaManagerTest::DeletedOriginData, | 78 base::Bind(&MockQuotaManagerTest::DeletedOriginData, |
74 weak_factory_.GetWeakPtr())); | 79 weak_factory_.GetWeakPtr())); |
75 } | 80 } |
76 | 81 |
77 void DeletedOriginData(QuotaStatusCode status) { | 82 void DeletedOriginData(QuotaStatusCode status) { |
78 ++deletion_callback_count_; | 83 ++deletion_callback_count_; |
79 EXPECT_EQ(quota::kQuotaStatusOk, status); | 84 EXPECT_EQ(kQuotaStatusOk, status); |
80 } | 85 } |
81 | 86 |
82 int deletion_callback_count() const { | 87 int deletion_callback_count() const { |
83 return deletion_callback_count_; | 88 return deletion_callback_count_; |
84 } | 89 } |
85 | 90 |
86 MockQuotaManager* manager() const { | 91 MockQuotaManager* manager() const { |
87 return manager_.get(); | 92 return manager_.get(); |
88 } | 93 } |
89 | 94 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 EXPECT_EQ(1UL, origins().count(kOrigin2)); | 217 EXPECT_EQ(1UL, origins().count(kOrigin2)); |
213 | 218 |
214 GetModifiedOrigins(kTemporary, now - a_minute); | 219 GetModifiedOrigins(kTemporary, now - a_minute); |
215 base::RunLoop().RunUntilIdle(); | 220 base::RunLoop().RunUntilIdle(); |
216 | 221 |
217 EXPECT_EQ(kTemporary, type()); | 222 EXPECT_EQ(kTemporary, type()); |
218 EXPECT_EQ(1UL, origins().size()); | 223 EXPECT_EQ(1UL, origins().size()); |
219 EXPECT_EQ(0UL, origins().count(kOrigin1)); | 224 EXPECT_EQ(0UL, origins().count(kOrigin1)); |
220 EXPECT_EQ(1UL, origins().count(kOrigin2)); | 225 EXPECT_EQ(1UL, origins().count(kOrigin2)); |
221 } | 226 } |
222 } // Namespace quota | 227 } // Namespace content |
OLD | NEW |