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 "content/public/test/sandbox_file_system_test_helper.h" | 5 #include "content/public/test/sandbox_file_system_test_helper.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "content/public/test/test_file_system_context.h" | 10 #include "content/public/test/test_file_system_context.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 GetUsageCachePathForOriginAndType(origin_, type_); | 84 GetUsageCachePathForOriginAndType(origin_, type_); |
85 } | 85 } |
86 | 86 |
87 FileSystemURL SandboxFileSystemTestHelper::CreateURL( | 87 FileSystemURL SandboxFileSystemTestHelper::CreateURL( |
88 const base::FilePath& path) const { | 88 const base::FilePath& path) const { |
89 return file_system_context_->CreateCrackedFileSystemURL(origin_, type_, path); | 89 return file_system_context_->CreateCrackedFileSystemURL(origin_, type_, path); |
90 } | 90 } |
91 | 91 |
92 int64 SandboxFileSystemTestHelper::GetCachedOriginUsage() const { | 92 int64 SandboxFileSystemTestHelper::GetCachedOriginUsage() const { |
93 return file_system_context_->GetQuotaUtil(type_) | 93 return file_system_context_->GetQuotaUtil(type_) |
94 ->GetOriginUsageOnFileThread(file_system_context_.get(), origin_, type_); | 94 ->GetOriginUsageOnFileTaskRunner( |
| 95 file_system_context_.get(), origin_, type_); |
95 } | 96 } |
96 | 97 |
97 int64 SandboxFileSystemTestHelper::ComputeCurrentOriginUsage() { | 98 int64 SandboxFileSystemTestHelper::ComputeCurrentOriginUsage() { |
98 usage_cache()->CloseCacheFiles(); | 99 usage_cache()->CloseCacheFiles(); |
99 int64 size = base::ComputeDirectorySize(GetOriginRootPath()); | 100 int64 size = base::ComputeDirectorySize(GetOriginRootPath()); |
100 if (base::PathExists(GetUsageCachePath())) | 101 if (base::PathExists(GetUsageCachePath())) |
101 size -= FileSystemUsageCache::kUsageFileSize; | 102 size -= FileSystemUsageCache::kUsageFileSize; |
102 return size; | 103 return size; |
103 } | 104 } |
104 | 105 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 file_system_context_->sandbox_delegate()-> | 144 file_system_context_->sandbox_delegate()-> |
144 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); | 145 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); |
145 | 146 |
146 // Initialize the usage cache file. | 147 // Initialize the usage cache file. |
147 base::FilePath usage_cache_path = GetUsageCachePath(); | 148 base::FilePath usage_cache_path = GetUsageCachePath(); |
148 if (!usage_cache_path.empty()) | 149 if (!usage_cache_path.empty()) |
149 usage_cache()->UpdateUsage(usage_cache_path, 0); | 150 usage_cache()->UpdateUsage(usage_cache_path, 0); |
150 } | 151 } |
151 | 152 |
152 } // namespace fileapi | 153 } // namespace fileapi |
OLD | NEW |