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

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

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

Powered by Google App Engine
This is Rietveld 408576698