OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/appcache/appcache_storage_impl.h" | 5 #include "content/browser/appcache/appcache_storage_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <stack> | 10 #include <stack> |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 AppCacheStorageImplTest* test_; | 270 AppCacheStorageImplTest* test_; |
271 }; | 271 }; |
272 | 272 |
273 class MockQuotaManager : public storage::QuotaManager { | 273 class MockQuotaManager : public storage::QuotaManager { |
274 public: | 274 public: |
275 MockQuotaManager() | 275 MockQuotaManager() |
276 : QuotaManager(true /* is_incognito */, | 276 : QuotaManager(true /* is_incognito */, |
277 base::FilePath(), | 277 base::FilePath(), |
278 io_thread->task_runner().get(), | 278 io_thread->task_runner().get(), |
279 db_thread->task_runner().get(), | 279 db_thread->task_runner().get(), |
280 NULL), | 280 nullptr, |
| 281 storage::GetTemporaryStorageConfigurationFunc()), |
281 async_(false) {} | 282 async_(false) {} |
282 | 283 |
283 void GetUsageAndQuota(const GURL& origin, | 284 void GetUsageAndQuota(const GURL& origin, |
284 storage::StorageType type, | 285 storage::StorageType type, |
285 const GetUsageAndQuotaCallback& callback) override { | 286 const UsageAndQuotaCallback& callback) override { |
286 EXPECT_EQ(storage::kStorageTypeTemporary, type); | 287 EXPECT_EQ(storage::kStorageTypeTemporary, type); |
287 if (async_) { | 288 if (async_) { |
288 base::ThreadTaskRunnerHandle::Get()->PostTask( | 289 base::ThreadTaskRunnerHandle::Get()->PostTask( |
289 FROM_HERE, base::Bind(&MockQuotaManager::CallCallback, | 290 FROM_HERE, base::Bind(&MockQuotaManager::CallCallback, |
290 base::Unretained(this), callback)); | 291 base::Unretained(this), callback)); |
291 return; | 292 return; |
292 } | 293 } |
293 CallCallback(callback); | 294 CallCallback(callback); |
294 } | 295 } |
295 | 296 |
296 void CallCallback(const GetUsageAndQuotaCallback& callback) { | 297 void CallCallback(const UsageAndQuotaCallback& callback) { |
297 callback.Run(storage::kQuotaStatusOk, 0, kMockQuota); | 298 callback.Run(storage::kQuotaStatusOk, 0, kMockQuota); |
298 } | 299 } |
299 | 300 |
300 bool async_; | 301 bool async_; |
301 | 302 |
302 protected: | 303 protected: |
303 ~MockQuotaManager() override {} | 304 ~MockQuotaManager() override {} |
304 }; | 305 }; |
305 | 306 |
306 class MockQuotaManagerProxy : public storage::QuotaManagerProxy { | 307 class MockQuotaManagerProxy : public storage::QuotaManagerProxy { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 void RegisterClient(storage::QuotaClient* client) override {} | 339 void RegisterClient(storage::QuotaClient* client) override {} |
339 void NotifyOriginInUse(const GURL& origin) override {} | 340 void NotifyOriginInUse(const GURL& origin) override {} |
340 void NotifyOriginNoLongerInUse(const GURL& origin) override {} | 341 void NotifyOriginNoLongerInUse(const GURL& origin) override {} |
341 void SetUsageCacheEnabled(storage::QuotaClient::ID client_id, | 342 void SetUsageCacheEnabled(storage::QuotaClient::ID client_id, |
342 const GURL& origin, | 343 const GURL& origin, |
343 storage::StorageType type, | 344 storage::StorageType type, |
344 bool enabled) override {} | 345 bool enabled) override {} |
345 void GetUsageAndQuota(base::SequencedTaskRunner* original_task_runner, | 346 void GetUsageAndQuota(base::SequencedTaskRunner* original_task_runner, |
346 const GURL& origin, | 347 const GURL& origin, |
347 storage::StorageType type, | 348 storage::StorageType type, |
348 const GetUsageAndQuotaCallback& callback) override {} | 349 const UsageAndQuotaCallback& callback) override {} |
349 | 350 |
350 int notify_storage_accessed_count_; | 351 int notify_storage_accessed_count_; |
351 int notify_storage_modified_count_; | 352 int notify_storage_modified_count_; |
352 GURL last_origin_; | 353 GURL last_origin_; |
353 int last_delta_; | 354 int last_delta_; |
354 scoped_refptr<MockQuotaManager> mock_manager_; | 355 scoped_refptr<MockQuotaManager> mock_manager_; |
355 | 356 |
356 protected: | 357 protected: |
357 ~MockQuotaManagerProxy() override {} | 358 ~MockQuotaManagerProxy() override {} |
358 }; | 359 }; |
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); | 2028 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); |
2028 } | 2029 } |
2029 | 2030 |
2030 TEST_F(AppCacheStorageImplTest, Reinitialize3) { | 2031 TEST_F(AppCacheStorageImplTest, Reinitialize3) { |
2031 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3); | 2032 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3); |
2032 } | 2033 } |
2033 | 2034 |
2034 // That's all folks! | 2035 // That's all folks! |
2035 | 2036 |
2036 } // namespace content | 2037 } // namespace content |
OLD | NEW |