Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: content/browser/fileapi/obfuscated_file_util_unittest.cc

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/thread_task_runner_handle.h"
17 #include "content/browser/fileapi/mock_file_change_observer.h" 16 #include "content/browser/fileapi/mock_file_change_observer.h"
18 #include "content/public/test/async_file_test_helper.h" 17 #include "content/public/test/async_file_test_helper.h"
19 #include "content/public/test/mock_special_storage_policy.h" 18 #include "content/public/test/mock_special_storage_policy.h"
20 #include "content/public/test/sandbox_file_system_test_helper.h" 19 #include "content/public/test/sandbox_file_system_test_helper.h"
21 #include "content/public/test/test_file_system_context.h" 20 #include "content/public/test/test_file_system_context.h"
22 #include "content/test/fileapi_test_file_set.h" 21 #include "content/test/fileapi_test_file_set.h"
23 #include "storage/browser/fileapi/external_mount_points.h" 22 #include "storage/browser/fileapi/external_mount_points.h"
24 #include "storage/browser/fileapi/file_system_backend.h" 23 #include "storage/browser/fileapi/file_system_backend.h"
25 #include "storage/browser/fileapi/file_system_context.h" 24 #include "storage/browser/fileapi/file_system_context.h"
26 #include "storage/browser/fileapi/file_system_operation_context.h" 25 #include "storage/browser/fileapi/file_system_operation_context.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 sandbox_file_system_(origin_, type_), 149 sandbox_file_system_(origin_, type_),
151 quota_status_(storage::kQuotaStatusUnknown), 150 quota_status_(storage::kQuotaStatusUnknown),
152 usage_(-1), 151 usage_(-1),
153 weak_factory_(this) {} 152 weak_factory_(this) {}
154 153
155 void SetUp() override { 154 void SetUp() override {
156 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 155 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
157 156
158 storage_policy_ = new MockSpecialStoragePolicy(); 157 storage_policy_ = new MockSpecialStoragePolicy();
159 158
160 quota_manager_ = new storage::QuotaManager( 159 quota_manager_ =
161 false /* is_incognito */, data_dir_.path(), 160 new storage::QuotaManager(false /* is_incognito */,
162 base::ThreadTaskRunnerHandle::Get().get(), 161 data_dir_.path(),
163 base::ThreadTaskRunnerHandle::Get().get(), storage_policy_.get()); 162 base::MessageLoopProxy::current().get(),
163 base::MessageLoopProxy::current().get(),
164 storage_policy_.get());
164 165
165 // Every time we create a new sandbox_file_system helper, 166 // Every time we create a new sandbox_file_system helper,
166 // it creates another context, which creates another path manager, 167 // it creates another context, which creates another path manager,
167 // another sandbox_backend, and another OFU. 168 // another sandbox_backend, and another OFU.
168 // We need to pass in the context to skip all that. 169 // We need to pass in the context to skip all that.
169 file_system_context_ = CreateFileSystemContextForTesting( 170 file_system_context_ = CreateFileSystemContextForTesting(
170 quota_manager_->proxy(), 171 quota_manager_->proxy(),
171 data_dir_.path()); 172 data_dir_.path());
172 173
173 sandbox_file_system_.SetUp(file_system_context_.get()); 174 sandbox_file_system_.SetUp(file_system_context_.get());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 storage::FileSystemType type) { 224 storage::FileSystemType type) {
224 SandboxFileSystemTestHelper* file_system = 225 SandboxFileSystemTestHelper* file_system =
225 new SandboxFileSystemTestHelper(origin, type); 226 new SandboxFileSystemTestHelper(origin, type);
226 227
227 file_system->SetUp(file_system_context_.get()); 228 file_system->SetUp(file_system_context_.get());
228 return file_system; 229 return file_system;
229 } 230 }
230 231
231 scoped_ptr<ObfuscatedFileUtil> CreateObfuscatedFileUtil( 232 scoped_ptr<ObfuscatedFileUtil> CreateObfuscatedFileUtil(
232 storage::SpecialStoragePolicy* storage_policy) { 233 storage::SpecialStoragePolicy* storage_policy) {
233 return scoped_ptr<ObfuscatedFileUtil>(ObfuscatedFileUtil::CreateForTesting( 234 return scoped_ptr<ObfuscatedFileUtil>(
234 storage_policy, data_dir_path(), NULL, 235 ObfuscatedFileUtil::CreateForTesting(
235 base::ThreadTaskRunnerHandle::Get().get())); 236 storage_policy, data_dir_path(), NULL,
237 base::MessageLoopProxy::current().get()));
236 } 238 }
237 239
238 ObfuscatedFileUtil* ofu() { 240 ObfuscatedFileUtil* ofu() {
239 return static_cast<ObfuscatedFileUtil*>(sandbox_file_system_.file_util()); 241 return static_cast<ObfuscatedFileUtil*>(sandbox_file_system_.file_util());
240 } 242 }
241 243
242 const base::FilePath& test_directory() const { 244 const base::FilePath& test_directory() const {
243 return data_dir_.path(); 245 return data_dir_.path();
244 } 246 }
245 247
(...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2560 ofu()->GetDirectoryForOriginAndType( 2562 ofu()->GetDirectoryForOriginAndType(
2561 origin2, GetTypeString(kFileSystemTypeTemporary), false, &error); 2563 origin2, GetTypeString(kFileSystemTypeTemporary), false, &error);
2562 ASSERT_EQ(base::File::FILE_OK, error); 2564 ASSERT_EQ(base::File::FILE_OK, error);
2563 error = base::File::FILE_ERROR_FAILED; 2565 error = base::File::FILE_ERROR_FAILED;
2564 ofu()->GetDirectoryForOriginAndType( 2566 ofu()->GetDirectoryForOriginAndType(
2565 origin2, GetTypeString(kFileSystemTypePersistent), false, &error); 2567 origin2, GetTypeString(kFileSystemTypePersistent), false, &error);
2566 ASSERT_EQ(base::File::FILE_OK, error); 2568 ASSERT_EQ(base::File::FILE_OK, error);
2567 } 2569 }
2568 2570
2569 } // namespace content 2571 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698