1// Copyright (c) 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.
4
5#include "webkit/browser/fileapi/mock_file_system_context.h"
6
7#include "base/memory/scoped_vector.h"
8#include "webkit/browser/fileapi/external_mount_points.h"
9#include "webkit/browser/fileapi/file_system_backend.h"
10#include "webkit/browser/fileapi/file_system_context.h"
11#include "webkit/browser/fileapi/mock_file_system_options.h"
12#include "webkit/browser/fileapi/test_file_system_backend.h"
13#include "webkit/browser/quota/mock_special_storage_policy.h"
14
15namespace fileapi {
16
17FileSystemContext* CreateFileSystemContextForTesting(
18    quota::QuotaManagerProxy* quota_manager_proxy,
19    const base::FilePath& base_path) {
20  ScopedVector<FileSystemBackend> additional_providers;
21  additional_providers.push_back(new TestFileSystemBackend(
22      base::MessageLoopProxy::current().get(), base_path));
23  return CreateFileSystemContextWithAdditionalProvidersForTesting(
24      quota_manager_proxy, additional_providers.Pass(), base_path);
25}
26
27FileSystemContext* CreateFileSystemContextWithAdditionalProvidersForTesting(
28    quota::QuotaManagerProxy* quota_manager_proxy,
29    ScopedVector<FileSystemBackend> additional_providers,
30    const base::FilePath& base_path) {
31  return new FileSystemContext(
32      base::MessageLoopProxy::current().get(),
33      base::MessageLoopProxy::current().get(),
34      ExternalMountPoints::CreateRefCounted().get(),
35      make_scoped_refptr(new quota::MockSpecialStoragePolicy()).get(),
36      quota_manager_proxy,
37      additional_providers.Pass(),
38      base_path,
39      CreateAllowFileAccessOptions());
40}
41
42}  // namespace fileapi
43