OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 5 |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
12 #include "base/message_loop_proxy.h" | 13 #include "base/message_loop_proxy.h" |
13 #include "base/scoped_temp_dir.h" | |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "webkit/quota/mock_quota_manager.h" | 15 #include "webkit/quota/mock_quota_manager.h" |
16 #include "webkit/quota/mock_special_storage_policy.h" | 16 #include "webkit/quota/mock_special_storage_policy.h" |
17 #include "webkit/quota/mock_storage_client.h" | 17 #include "webkit/quota/mock_storage_client.h" |
18 | 18 |
19 namespace quota { | 19 namespace quota { |
20 | 20 |
21 const char kTestOrigin1[] = "http://host1:1/"; | 21 const char kTestOrigin1[] = "http://host1:1/"; |
22 const char kTestOrigin2[] = "http://host2:1/"; | 22 const char kTestOrigin2[] = "http://host2:1/"; |
23 const char kTestOrigin3[] = "http://host3:1/"; | 23 const char kTestOrigin3[] = "http://host3:1/"; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 const std::set<GURL>& origins() const { | 92 const std::set<GURL>& origins() const { |
93 return origins_; | 93 return origins_; |
94 } | 94 } |
95 | 95 |
96 const StorageType& type() const { | 96 const StorageType& type() const { |
97 return type_; | 97 return type_; |
98 } | 98 } |
99 | 99 |
100 private: | 100 private: |
101 MessageLoop message_loop_; | 101 MessageLoop message_loop_; |
102 ScopedTempDir data_dir_; | 102 base::ScopedTempDir data_dir_; |
103 base::WeakPtrFactory<MockQuotaManagerTest> weak_factory_; | 103 base::WeakPtrFactory<MockQuotaManagerTest> weak_factory_; |
104 scoped_refptr<MockQuotaManager> manager_; | 104 scoped_refptr<MockQuotaManager> manager_; |
105 scoped_refptr<MockSpecialStoragePolicy> policy_; | 105 scoped_refptr<MockSpecialStoragePolicy> policy_; |
106 | 106 |
107 int deletion_callback_count_; | 107 int deletion_callback_count_; |
108 | 108 |
109 std::set<GURL> origins_; | 109 std::set<GURL> origins_; |
110 StorageType type_; | 110 StorageType type_; |
111 | 111 |
112 DISALLOW_COPY_AND_ASSIGN(MockQuotaManagerTest); | 112 DISALLOW_COPY_AND_ASSIGN(MockQuotaManagerTest); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 GetModifiedOrigins(kTemporary, now - a_minute); | 215 GetModifiedOrigins(kTemporary, now - a_minute); |
216 MessageLoop::current()->RunAllPending(); | 216 MessageLoop::current()->RunAllPending(); |
217 | 217 |
218 EXPECT_EQ(kTemporary, type()); | 218 EXPECT_EQ(kTemporary, type()); |
219 EXPECT_EQ(1UL, origins().size()); | 219 EXPECT_EQ(1UL, origins().size()); |
220 EXPECT_EQ(0UL, origins().count(kOrigin1)); | 220 EXPECT_EQ(0UL, origins().count(kOrigin1)); |
221 EXPECT_EQ(1UL, origins().count(kOrigin2)); | 221 EXPECT_EQ(1UL, origins().count(kOrigin2)); |
222 } | 222 } |
223 } // Namespace quota | 223 } // Namespace quota |
OLD | NEW |