| 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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
| 5 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 6 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" |
| 7 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 8 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 9 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 10 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 11 #include "content/browser/browser_thread_impl.h" | 15 #include "content/browser/browser_thread_impl.h" |
| 12 #include "content/browser/gpu/shader_disk_cache.h" | 16 #include "content/browser/gpu/shader_disk_cache.h" |
| 13 #include "content/browser/quota/mock_quota_manager.h" | 17 #include "content/browser/quota/mock_quota_manager.h" |
| 14 #include "content/browser/storage_partition_impl.h" | 18 #include "content/browser/storage_partition_impl.h" |
| 15 #include "content/public/browser/local_storage_usage_info.h" | 19 #include "content/public/browser/local_storage_usage_info.h" |
| 16 #include "content/public/browser/storage_partition.h" | 20 #include "content/public/browser/storage_partition.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 FILE_PATH_LITERAL("http_host2_1.localstorage"); | 53 FILE_PATH_LITERAL("http_host2_1.localstorage"); |
| 50 | 54 |
| 51 const base::FilePath::CharType kDomStorageOrigin3[] = | 55 const base::FilePath::CharType kDomStorageOrigin3[] = |
| 52 FILE_PATH_LITERAL("http_host3_1.localstorage"); | 56 FILE_PATH_LITERAL("http_host3_1.localstorage"); |
| 53 | 57 |
| 54 const storage::StorageType kTemporary = storage::kStorageTypeTemporary; | 58 const storage::StorageType kTemporary = storage::kStorageTypeTemporary; |
| 55 const storage::StorageType kPersistent = storage::kStorageTypePersistent; | 59 const storage::StorageType kPersistent = storage::kStorageTypePersistent; |
| 56 | 60 |
| 57 const storage::QuotaClient::ID kClientFile = storage::QuotaClient::kFileSystem; | 61 const storage::QuotaClient::ID kClientFile = storage::QuotaClient::kFileSystem; |
| 58 | 62 |
| 59 const uint32 kAllQuotaRemoveMask = | 63 const uint32_t kAllQuotaRemoveMask = |
| 60 StoragePartition::REMOVE_DATA_MASK_APPCACHE | | 64 StoragePartition::REMOVE_DATA_MASK_APPCACHE | |
| 61 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | | 65 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | |
| 62 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB | | 66 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB | |
| 63 StoragePartition::REMOVE_DATA_MASK_WEBSQL; | 67 StoragePartition::REMOVE_DATA_MASK_WEBSQL; |
| 64 | 68 |
| 65 class AwaitCompletionHelper { | 69 class AwaitCompletionHelper { |
| 66 public: | 70 public: |
| 67 AwaitCompletionHelper() : start_(false), already_quit_(false) {} | 71 AwaitCompletionHelper() : start_(false), already_quit_(false) {} |
| 68 virtual ~AwaitCompletionHelper() {} | 72 virtual ~AwaitCompletionHelper() {} |
| 69 | 73 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 const base::Time delete_begin, | 291 const base::Time delete_begin, |
| 288 const base::Time delete_end, | 292 const base::Time delete_end, |
| 289 base::RunLoop* run_loop) { | 293 base::RunLoop* run_loop) { |
| 290 partition->ClearData( | 294 partition->ClearData( |
| 291 StoragePartition::REMOVE_DATA_MASK_COOKIES, | 295 StoragePartition::REMOVE_DATA_MASK_COOKIES, |
| 292 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, | 296 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
| 293 GURL(), StoragePartition::OriginMatcherFunction(), | 297 GURL(), StoragePartition::OriginMatcherFunction(), |
| 294 delete_begin, delete_end, run_loop->QuitClosure()); | 298 delete_begin, delete_end, run_loop->QuitClosure()); |
| 295 } | 299 } |
| 296 | 300 |
| 297 void ClearStuff(uint32 remove_mask, | 301 void ClearStuff(uint32_t remove_mask, |
| 298 content::StoragePartition* partition, | 302 content::StoragePartition* partition, |
| 299 const base::Time delete_begin, | 303 const base::Time delete_begin, |
| 300 const base::Time delete_end, | 304 const base::Time delete_end, |
| 301 const StoragePartition::OriginMatcherFunction& origin_matcher, | 305 const StoragePartition::OriginMatcherFunction& origin_matcher, |
| 302 base::RunLoop* run_loop) { | 306 base::RunLoop* run_loop) { |
| 303 partition->ClearData( | 307 partition->ClearData( |
| 304 remove_mask, StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, | 308 remove_mask, StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
| 305 GURL(), origin_matcher, delete_begin, delete_end, | 309 GURL(), origin_matcher, delete_begin, delete_end, |
| 306 run_loop->QuitClosure()); | 310 run_loop->QuitClosure()); |
| 307 } | 311 } |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 &run_loop)); | 913 &run_loop)); |
| 910 run_loop.Run(); | 914 run_loop.Run(); |
| 911 | 915 |
| 912 // kOrigin1 and kOrigin2 do not have age more than a week. | 916 // kOrigin1 and kOrigin2 do not have age more than a week. |
| 913 EXPECT_FALSE(tester.DOMStorageExistsForOrigin(kOrigin1)); | 917 EXPECT_FALSE(tester.DOMStorageExistsForOrigin(kOrigin1)); |
| 914 EXPECT_FALSE(tester.DOMStorageExistsForOrigin(kOrigin2)); | 918 EXPECT_FALSE(tester.DOMStorageExistsForOrigin(kOrigin2)); |
| 915 EXPECT_TRUE(tester.DOMStorageExistsForOrigin(kOrigin3)); | 919 EXPECT_TRUE(tester.DOMStorageExistsForOrigin(kOrigin3)); |
| 916 } | 920 } |
| 917 | 921 |
| 918 } // namespace content | 922 } // namespace content |
| OLD | NEW |