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
3 // found in the LICENSE file.
5 #include "content/public/test/test_file_system_context.h"
7 #include "base/memory/scoped_vector.h"
8 #include "base/thread_task_runner_handle.h"
9 #include "content/public/test/mock_special_storage_policy.h"
10 #include "content/public/test/test_file_system_backend.h"
11 #include "content/public/test/test_file_system_options.h"
12 #include "storage/browser/fileapi/external_mount_points.h"
13 #include "storage/browser/fileapi/file_system_backend.h"
14 #include "storage/browser/fileapi/file_system_context.h"
18 storage::FileSystemContext
* CreateFileSystemContextForTesting(
19 storage::QuotaManagerProxy
* quota_manager_proxy
,
20 const base::FilePath
& base_path
) {
21 ScopedVector
<storage::FileSystemBackend
> additional_providers
;
22 additional_providers
.push_back(new TestFileSystemBackend(
23 base::ThreadTaskRunnerHandle::Get().get(), base_path
));
24 return CreateFileSystemContextWithAdditionalProvidersForTesting(
25 quota_manager_proxy
, additional_providers
.Pass(), base_path
);
28 storage::FileSystemContext
*
29 CreateFileSystemContextWithAdditionalProvidersForTesting(
30 storage::QuotaManagerProxy
* quota_manager_proxy
,
31 ScopedVector
<storage::FileSystemBackend
> additional_providers
,
32 const base::FilePath
& base_path
) {
33 return new storage::FileSystemContext(
34 base::ThreadTaskRunnerHandle::Get().get(),
35 base::ThreadTaskRunnerHandle::Get().get(),
36 storage::ExternalMountPoints::CreateRefCounted().get(),
37 make_scoped_refptr(new MockSpecialStoragePolicy()).get(),
38 quota_manager_proxy
, additional_providers
.Pass(),
39 std::vector
<storage::URLRequestAutoMountHandler
>(), base_path
,
40 CreateAllowFileAccessOptions());
43 storage::FileSystemContext
* CreateFileSystemContextWithAutoMountersForTesting(
44 storage::QuotaManagerProxy
* quota_manager_proxy
,
45 ScopedVector
<storage::FileSystemBackend
> additional_providers
,
46 const std::vector
<storage::URLRequestAutoMountHandler
>& auto_mounters
,
47 const base::FilePath
& base_path
) {
48 return new storage::FileSystemContext(
49 base::ThreadTaskRunnerHandle::Get().get(),
50 base::ThreadTaskRunnerHandle::Get().get(),
51 storage::ExternalMountPoints::CreateRefCounted().get(),
52 make_scoped_refptr(new MockSpecialStoragePolicy()).get(),
53 quota_manager_proxy
, additional_providers
.Pass(), auto_mounters
,
54 base_path
, CreateAllowFileAccessOptions());
57 storage::FileSystemContext
* CreateIncognitoFileSystemContextForTesting(
58 storage::QuotaManagerProxy
* quota_manager_proxy
,
59 const base::FilePath
& base_path
) {
60 ScopedVector
<storage::FileSystemBackend
> additional_providers
;
61 return new storage::FileSystemContext(
62 base::ThreadTaskRunnerHandle::Get().get(),
63 base::ThreadTaskRunnerHandle::Get().get(),
64 storage::ExternalMountPoints::CreateRefCounted().get(),
65 make_scoped_refptr(new MockSpecialStoragePolicy()).get(),
66 quota_manager_proxy
, additional_providers
.Pass(),
67 std::vector
<storage::URLRequestAutoMountHandler
>(), base_path
,
68 CreateIncognitoFileSystemOptions());
71 } // namespace content