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 <stack> | 5 #include <stack> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return; | 150 return; |
151 } | 151 } |
152 CallCallback(callback); | 152 CallCallback(callback); |
153 } | 153 } |
154 | 154 |
155 void CallCallback(const GetUsageAndQuotaCallback& callback) { | 155 void CallCallback(const GetUsageAndQuotaCallback& callback) { |
156 callback.Run(quota::kQuotaStatusOk, 0, kMockQuota); | 156 callback.Run(quota::kQuotaStatusOk, 0, kMockQuota); |
157 } | 157 } |
158 | 158 |
159 bool async_; | 159 bool async_; |
| 160 |
| 161 protected: |
| 162 virtual ~MockQuotaManager() {} |
160 }; | 163 }; |
161 | 164 |
162 class MockQuotaManagerProxy : public quota::QuotaManagerProxy { | 165 class MockQuotaManagerProxy : public quota::QuotaManagerProxy { |
163 public: | 166 public: |
164 MockQuotaManagerProxy() | 167 MockQuotaManagerProxy() |
165 : QuotaManagerProxy(NULL, NULL), | 168 : QuotaManagerProxy(NULL, NULL), |
166 notify_storage_accessed_count_(0), | 169 notify_storage_accessed_count_(0), |
167 notify_storage_modified_count_(0), | 170 notify_storage_modified_count_(0), |
168 last_delta_(0), | 171 last_delta_(0), |
169 mock_manager_(new MockQuotaManager) { | 172 mock_manager_(new MockQuotaManager) { |
(...skipping 23 matching lines...) Expand all Loading... |
193 // Not needed for our tests. | 196 // Not needed for our tests. |
194 virtual void RegisterClient(quota::QuotaClient* client) OVERRIDE {} | 197 virtual void RegisterClient(quota::QuotaClient* client) OVERRIDE {} |
195 virtual void NotifyOriginInUse(const GURL& origin) OVERRIDE {} | 198 virtual void NotifyOriginInUse(const GURL& origin) OVERRIDE {} |
196 virtual void NotifyOriginNoLongerInUse(const GURL& origin) OVERRIDE {} | 199 virtual void NotifyOriginNoLongerInUse(const GURL& origin) OVERRIDE {} |
197 | 200 |
198 int notify_storage_accessed_count_; | 201 int notify_storage_accessed_count_; |
199 int notify_storage_modified_count_; | 202 int notify_storage_modified_count_; |
200 GURL last_origin_; | 203 GURL last_origin_; |
201 int last_delta_; | 204 int last_delta_; |
202 scoped_refptr<MockQuotaManager> mock_manager_; | 205 scoped_refptr<MockQuotaManager> mock_manager_; |
| 206 |
| 207 protected: |
| 208 virtual ~MockQuotaManagerProxy() {} |
203 }; | 209 }; |
204 | 210 |
205 template <class Method> | 211 template <class Method> |
206 void RunMethod(Method method) { | 212 void RunMethod(Method method) { |
207 (this->*method)(); | 213 (this->*method)(); |
208 } | 214 } |
209 | 215 |
210 // Helper callback to run a test on our io_thread. The io_thread is spun up | 216 // Helper callback to run a test on our io_thread. The io_thread is spun up |
211 // once and reused for all tests. | 217 // once and reused for all tests. |
212 template <class Method> | 218 template <class Method> |
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 } | 1409 } |
1404 | 1410 |
1405 TEST_F(AppCacheStorageImplTest, FindMainResponseExclusionsInWorkingSet) { | 1411 TEST_F(AppCacheStorageImplTest, FindMainResponseExclusionsInWorkingSet) { |
1406 RunTestOnIOThread( | 1412 RunTestOnIOThread( |
1407 &AppCacheStorageImplTest::FindMainResponseExclusionsInWorkingSet); | 1413 &AppCacheStorageImplTest::FindMainResponseExclusionsInWorkingSet); |
1408 } | 1414 } |
1409 | 1415 |
1410 // That's all folks! | 1416 // That's all folks! |
1411 | 1417 |
1412 } // namespace appcache | 1418 } // namespace appcache |
OLD | NEW |