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 "storage/browser/fileapi/file_system_context.h" | 5 #include "storage/browser/fileapi/file_system_context.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop/message_loop.h" | |
9 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/thread_task_runner_handle.h" |
10 #include "content/browser/quota/mock_quota_manager.h" | 10 #include "content/browser/quota/mock_quota_manager.h" |
11 #include "content/public/test/mock_special_storage_policy.h" | 11 #include "content/public/test/mock_special_storage_policy.h" |
12 #include "content/public/test/test_file_system_options.h" | 12 #include "content/public/test/test_file_system_options.h" |
13 #include "storage/browser/fileapi/external_mount_points.h" | 13 #include "storage/browser/fileapi/external_mount_points.h" |
14 #include "storage/browser/fileapi/file_system_backend.h" | 14 #include "storage/browser/fileapi/file_system_backend.h" |
15 #include "storage/browser/fileapi/isolated_context.h" | 15 #include "storage/browser/fileapi/isolated_context.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 #define FPL(x) FILE_PATH_LITERAL(x) | 18 #define FPL(x) FILE_PATH_LITERAL(x) |
19 | 19 |
(...skipping 27 matching lines...) Expand all Loading... |
47 | 47 |
48 class FileSystemContextTest : public testing::Test { | 48 class FileSystemContextTest : public testing::Test { |
49 public: | 49 public: |
50 FileSystemContextTest() {} | 50 FileSystemContextTest() {} |
51 | 51 |
52 void SetUp() override { | 52 void SetUp() override { |
53 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 53 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
54 | 54 |
55 storage_policy_ = new MockSpecialStoragePolicy(); | 55 storage_policy_ = new MockSpecialStoragePolicy(); |
56 | 56 |
57 mock_quota_manager_ = | 57 mock_quota_manager_ = new MockQuotaManager( |
58 new MockQuotaManager(false /* is_incognito */, | 58 false /* is_incognito */, data_dir_.path(), |
59 data_dir_.path(), | 59 base::ThreadTaskRunnerHandle::Get().get(), |
60 base::MessageLoopProxy::current().get(), | 60 base::ThreadTaskRunnerHandle::Get().get(), storage_policy_.get()); |
61 base::MessageLoopProxy::current().get(), | |
62 storage_policy_.get()); | |
63 } | 61 } |
64 | 62 |
65 protected: | 63 protected: |
66 FileSystemContext* CreateFileSystemContextForTest( | 64 FileSystemContext* CreateFileSystemContextForTest( |
67 storage::ExternalMountPoints* external_mount_points) { | 65 storage::ExternalMountPoints* external_mount_points) { |
68 return new FileSystemContext( | 66 return new FileSystemContext( |
69 base::MessageLoopProxy::current().get(), | 67 base::ThreadTaskRunnerHandle::Get().get(), |
70 base::MessageLoopProxy::current().get(), | 68 base::ThreadTaskRunnerHandle::Get().get(), external_mount_points, |
71 external_mount_points, | 69 storage_policy_.get(), mock_quota_manager_->proxy(), |
72 storage_policy_.get(), | |
73 mock_quota_manager_->proxy(), | |
74 ScopedVector<FileSystemBackend>(), | 70 ScopedVector<FileSystemBackend>(), |
75 std::vector<storage::URLRequestAutoMountHandler>(), | 71 std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.path(), |
76 data_dir_.path(), | |
77 CreateAllowFileAccessOptions()); | 72 CreateAllowFileAccessOptions()); |
78 } | 73 } |
79 | 74 |
80 // Verifies a *valid* filesystem url has expected values. | 75 // Verifies a *valid* filesystem url has expected values. |
81 void ExpectFileSystemURLMatches(const FileSystemURL& url, | 76 void ExpectFileSystemURLMatches(const FileSystemURL& url, |
82 const GURL& expect_origin, | 77 const GURL& expect_origin, |
83 storage::FileSystemType expect_mount_type, | 78 storage::FileSystemType expect_mount_type, |
84 storage::FileSystemType expect_type, | 79 storage::FileSystemType expect_type, |
85 const base::FilePath& expect_path, | 80 const base::FilePath& expect_path, |
86 const base::FilePath& expect_virtual_path, | 81 const base::FilePath& expect_virtual_path, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 storage::kFileSystemTypeForTransientFile)); | 378 storage::kFileSystemTypeForTransientFile)); |
384 EXPECT_TRUE(file_system_context->GetFileSystemBackend( | 379 EXPECT_TRUE(file_system_context->GetFileSystemBackend( |
385 storage::kFileSystemTypeNativeLocal)); | 380 storage::kFileSystemTypeNativeLocal)); |
386 EXPECT_TRUE(file_system_context->GetFileSystemBackend( | 381 EXPECT_TRUE(file_system_context->GetFileSystemBackend( |
387 storage::kFileSystemTypeNativeForPlatformApp)); | 382 storage::kFileSystemTypeNativeForPlatformApp)); |
388 } | 383 } |
389 | 384 |
390 } // namespace | 385 } // namespace |
391 | 386 |
392 } // namespace content | 387 } // namespace content |
OLD | NEW |