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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 DCHECK(file_system_context_.get()); | 125 DCHECK(file_system_context_.get()); |
126 FileSystemOperationContext* context = | 126 FileSystemOperationContext* context = |
127 new FileSystemOperationContext(file_system_context_.get()); | 127 new FileSystemOperationContext(file_system_context_.get()); |
128 context->set_update_observers( | 128 context->set_update_observers( |
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_backend()->GetQuotaUtil()-> | 135 file_system_context_->sandbox_delegate()->AddFileChangeObserver( |
136 AddFileChangeObserver(type_, observer, NULL); | 136 type_, observer, NULL); |
137 } | 137 } |
138 | 138 |
139 storage::FileSystemUsageCache* SandboxFileSystemTestHelper::usage_cache() { | 139 storage::FileSystemUsageCache* SandboxFileSystemTestHelper::usage_cache() { |
140 return file_system_context()->sandbox_delegate()->usage_cache(); | 140 return file_system_context()->sandbox_delegate()->usage_cache(); |
141 } | 141 } |
142 | 142 |
143 void SandboxFileSystemTestHelper::SetUpFileSystem() { | 143 void SandboxFileSystemTestHelper::SetUpFileSystem() { |
144 DCHECK(file_system_context_.get()); | 144 DCHECK(file_system_context_.get()); |
145 DCHECK(file_system_context_->sandbox_backend()->CanHandleType(type_)); | 145 DCHECK(file_system_context_->sandbox_backend()->CanHandleType(type_)); |
146 | 146 |
147 file_util_ = file_system_context_->sandbox_delegate()->sync_file_util(); | 147 file_util_ = file_system_context_->sandbox_delegate()->sync_file_util(); |
148 DCHECK(file_util_); | 148 DCHECK(file_util_); |
149 | 149 |
150 // Prepare the origin's root directory. | 150 // Prepare the origin's root directory. |
151 file_system_context_->sandbox_delegate()-> | 151 file_system_context_->sandbox_delegate()-> |
152 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); | 152 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); |
153 | 153 |
154 // Initialize the usage cache file. | 154 // Initialize the usage cache file. |
155 base::FilePath usage_cache_path = GetUsageCachePath(); | 155 base::FilePath usage_cache_path = GetUsageCachePath(); |
156 if (!usage_cache_path.empty()) | 156 if (!usage_cache_path.empty()) |
157 usage_cache()->UpdateUsage(usage_cache_path, 0); | 157 usage_cache()->UpdateUsage(usage_cache_path, 0); |
158 } | 158 } |
159 | 159 |
160 } // namespace content | 160 } // namespace content |
OLD | NEW |