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/files/file_util.h" | 7 #include "base/files/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/mock_special_storage_policy.h" | 10 #include "content/public/test/mock_special_storage_policy.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 *file_system_context_->GetUpdateObservers(type_)); | 129 *file_system_context_->GetUpdateObservers(type_)); |
130 return context; | 130 return context; |
131 } | 131 } |
132 | 132 |
133 void SandboxFileSystemTestHelper::AddFileChangeObserver( | 133 void SandboxFileSystemTestHelper::AddFileChangeObserver( |
134 storage::FileChangeObserver* observer) { | 134 storage::FileChangeObserver* observer) { |
135 file_system_context_->sandbox_delegate()->AddFileChangeObserver( | 135 file_system_context_->sandbox_delegate()->AddFileChangeObserver( |
136 type_, observer, NULL); | 136 type_, observer, NULL); |
137 } | 137 } |
138 | 138 |
| 139 void SandboxFileSystemTestHelper::AddFileUpdateObserver( |
| 140 storage::FileUpdateObserver* observer) { |
| 141 file_system_context_->sandbox_delegate()->AddFileUpdateObserver( |
| 142 type_, observer, NULL); |
| 143 } |
| 144 |
139 storage::FileSystemUsageCache* SandboxFileSystemTestHelper::usage_cache() { | 145 storage::FileSystemUsageCache* SandboxFileSystemTestHelper::usage_cache() { |
140 return file_system_context()->sandbox_delegate()->usage_cache(); | 146 return file_system_context()->sandbox_delegate()->usage_cache(); |
141 } | 147 } |
142 | 148 |
143 void SandboxFileSystemTestHelper::SetUpFileSystem() { | 149 void SandboxFileSystemTestHelper::SetUpFileSystem() { |
144 DCHECK(file_system_context_.get()); | 150 DCHECK(file_system_context_.get()); |
145 DCHECK(file_system_context_->sandbox_backend()->CanHandleType(type_)); | 151 DCHECK(file_system_context_->sandbox_backend()->CanHandleType(type_)); |
146 | 152 |
147 file_util_ = file_system_context_->sandbox_delegate()->sync_file_util(); | 153 file_util_ = file_system_context_->sandbox_delegate()->sync_file_util(); |
148 DCHECK(file_util_); | 154 DCHECK(file_util_); |
149 | 155 |
150 // Prepare the origin's root directory. | 156 // Prepare the origin's root directory. |
151 file_system_context_->sandbox_delegate()-> | 157 file_system_context_->sandbox_delegate()-> |
152 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); | 158 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); |
153 | 159 |
154 // Initialize the usage cache file. | 160 // Initialize the usage cache file. |
155 base::FilePath usage_cache_path = GetUsageCachePath(); | 161 base::FilePath usage_cache_path = GetUsageCachePath(); |
156 if (!usage_cache_path.empty()) | 162 if (!usage_cache_path.empty()) |
157 usage_cache()->UpdateUsage(usage_cache_path, 0); | 163 usage_cache()->UpdateUsage(usage_cache_path, 0); |
158 } | 164 } |
159 | 165 |
160 } // namespace content | 166 } // namespace content |
OLD | NEW |