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" |
8 #include "base/strings/stringprintf.h" | 9 #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_ = new MockQuotaManager( | 57 mock_quota_manager_ = |
58 false /* is_incognito */, data_dir_.path(), | 58 new MockQuotaManager(false /* is_incognito */, |
59 base::ThreadTaskRunnerHandle::Get().get(), | 59 data_dir_.path(), |
60 base::ThreadTaskRunnerHandle::Get().get(), storage_policy_.get()); | 60 base::MessageLoopProxy::current().get(), |
| 61 base::MessageLoopProxy::current().get(), |
| 62 storage_policy_.get()); |
61 } | 63 } |
62 | 64 |
63 protected: | 65 protected: |
64 FileSystemContext* CreateFileSystemContextForTest( | 66 FileSystemContext* CreateFileSystemContextForTest( |
65 storage::ExternalMountPoints* external_mount_points) { | 67 storage::ExternalMountPoints* external_mount_points) { |
66 return new FileSystemContext( | 68 return new FileSystemContext( |
67 base::ThreadTaskRunnerHandle::Get().get(), | 69 base::MessageLoopProxy::current().get(), |
68 base::ThreadTaskRunnerHandle::Get().get(), external_mount_points, | 70 base::MessageLoopProxy::current().get(), |
69 storage_policy_.get(), mock_quota_manager_->proxy(), | 71 external_mount_points, |
| 72 storage_policy_.get(), |
| 73 mock_quota_manager_->proxy(), |
70 ScopedVector<FileSystemBackend>(), | 74 ScopedVector<FileSystemBackend>(), |
71 std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.path(), | 75 std::vector<storage::URLRequestAutoMountHandler>(), |
| 76 data_dir_.path(), |
72 CreateAllowFileAccessOptions()); | 77 CreateAllowFileAccessOptions()); |
73 } | 78 } |
74 | 79 |
75 // Verifies a *valid* filesystem url has expected values. | 80 // Verifies a *valid* filesystem url has expected values. |
76 void ExpectFileSystemURLMatches(const FileSystemURL& url, | 81 void ExpectFileSystemURLMatches(const FileSystemURL& url, |
77 const GURL& expect_origin, | 82 const GURL& expect_origin, |
78 storage::FileSystemType expect_mount_type, | 83 storage::FileSystemType expect_mount_type, |
79 storage::FileSystemType expect_type, | 84 storage::FileSystemType expect_type, |
80 const base::FilePath& expect_path, | 85 const base::FilePath& expect_path, |
81 const base::FilePath& expect_virtual_path, | 86 const base::FilePath& expect_virtual_path, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 storage::kFileSystemTypeForTransientFile)); | 383 storage::kFileSystemTypeForTransientFile)); |
379 EXPECT_TRUE(file_system_context->GetFileSystemBackend( | 384 EXPECT_TRUE(file_system_context->GetFileSystemBackend( |
380 storage::kFileSystemTypeNativeLocal)); | 385 storage::kFileSystemTypeNativeLocal)); |
381 EXPECT_TRUE(file_system_context->GetFileSystemBackend( | 386 EXPECT_TRUE(file_system_context->GetFileSystemBackend( |
382 storage::kFileSystemTypeNativeForPlatformApp)); | 387 storage::kFileSystemTypeNativeForPlatformApp)); |
383 } | 388 } |
384 | 389 |
385 } // namespace | 390 } // namespace |
386 | 391 |
387 } // namespace content | 392 } // namespace content |
OLD | NEW |