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 nullptr, | 280 NULL), |
281 storage::GetQuotaSettingsFunc()), | |
282 async_(false) {} | 281 async_(false) {} |
283 | 282 |
284 void GetUsageAndQuota(const GURL& origin, | 283 void GetUsageAndQuota(const GURL& origin, |
285 storage::StorageType type, | 284 storage::StorageType type, |
286 const UsageAndQuotaCallback& callback) override { | 285 const GetUsageAndQuotaCallback& callback) override { |
287 EXPECT_EQ(storage::kStorageTypeTemporary, type); | 286 EXPECT_EQ(storage::kStorageTypeTemporary, type); |
288 if (async_) { | 287 if (async_) { |
289 base::ThreadTaskRunnerHandle::Get()->PostTask( | 288 base::ThreadTaskRunnerHandle::Get()->PostTask( |
290 FROM_HERE, base::Bind(&MockQuotaManager::CallCallback, | 289 FROM_HERE, base::Bind(&MockQuotaManager::CallCallback, |
291 base::Unretained(this), callback)); | 290 base::Unretained(this), callback)); |
292 return; | 291 return; |
293 } | 292 } |
294 CallCallback(callback); | 293 CallCallback(callback); |
295 } | 294 } |
296 | 295 |
297 void CallCallback(const UsageAndQuotaCallback& callback) { | 296 void CallCallback(const GetUsageAndQuotaCallback& callback) { |
298 callback.Run(storage::kQuotaStatusOk, 0, kMockQuota); | 297 callback.Run(storage::kQuotaStatusOk, 0, kMockQuota); |
299 } | 298 } |
300 | 299 |
301 bool async_; | 300 bool async_; |
302 | 301 |
303 protected: | 302 protected: |
304 ~MockQuotaManager() override {} | 303 ~MockQuotaManager() override {} |
305 }; | 304 }; |
306 | 305 |
307 class MockQuotaManagerProxy : public storage::QuotaManagerProxy { | 306 class MockQuotaManagerProxy : public storage::QuotaManagerProxy { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 void RegisterClient(storage::QuotaClient* client) override {} | 338 void RegisterClient(storage::QuotaClient* client) override {} |
340 void NotifyOriginInUse(const GURL& origin) override {} | 339 void NotifyOriginInUse(const GURL& origin) override {} |
341 void NotifyOriginNoLongerInUse(const GURL& origin) override {} | 340 void NotifyOriginNoLongerInUse(const GURL& origin) override {} |
342 void SetUsageCacheEnabled(storage::QuotaClient::ID client_id, | 341 void SetUsageCacheEnabled(storage::QuotaClient::ID client_id, |
343 const GURL& origin, | 342 const GURL& origin, |
344 storage::StorageType type, | 343 storage::StorageType type, |
345 bool enabled) override {} | 344 bool enabled) override {} |
346 void GetUsageAndQuota(base::SequencedTaskRunner* original_task_runner, | 345 void GetUsageAndQuota(base::SequencedTaskRunner* original_task_runner, |
347 const GURL& origin, | 346 const GURL& origin, |
348 storage::StorageType type, | 347 storage::StorageType type, |
349 const UsageAndQuotaCallback& callback) override {} | 348 const GetUsageAndQuotaCallback& callback) override {} |
350 | 349 |
351 int notify_storage_accessed_count_; | 350 int notify_storage_accessed_count_; |
352 int notify_storage_modified_count_; | 351 int notify_storage_modified_count_; |
353 GURL last_origin_; | 352 GURL last_origin_; |
354 int last_delta_; | 353 int last_delta_; |
355 scoped_refptr<MockQuotaManager> mock_manager_; | 354 scoped_refptr<MockQuotaManager> mock_manager_; |
356 | 355 |
357 protected: | 356 protected: |
358 ~MockQuotaManagerProxy() override {} | 357 ~MockQuotaManagerProxy() override {} |
359 }; | 358 }; |
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2026 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); | 2025 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); |
2027 } | 2026 } |
2028 | 2027 |
2029 TEST_F(AppCacheStorageImplTest, Reinitialize3) { | 2028 TEST_F(AppCacheStorageImplTest, Reinitialize3) { |
2030 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3); | 2029 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3); |
2031 } | 2030 } |
2032 | 2031 |
2033 // That's all folks! | 2032 // That's all folks! |
2034 | 2033 |
2035 } // namespace content | 2034 } // namespace content |
OLD | NEW |