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/sandbox_file_system_backend.h" | 5 #include "storage/browser/fileapi/sandbox_file_system_backend.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 class SandboxFileSystemBackendTest : public testing::Test { | 72 class SandboxFileSystemBackendTest : public testing::Test { |
73 protected: | 73 protected: |
74 void SetUp() override { | 74 void SetUp() override { |
75 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 75 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
76 SetUpNewDelegate(CreateAllowFileAccessOptions()); | 76 SetUpNewDelegate(CreateAllowFileAccessOptions()); |
77 } | 77 } |
78 | 78 |
79 void SetUpNewDelegate(const storage::FileSystemOptions& options) { | 79 void SetUpNewDelegate(const storage::FileSystemOptions& options) { |
80 delegate_.reset(new SandboxFileSystemBackendDelegate( | 80 delegate_.reset(new SandboxFileSystemBackendDelegate( |
81 NULL /* quota_manager_proxy */, | 81 NULL /* quota_manager_proxy */, |
82 base::ThreadTaskRunnerHandle::Get().get(), data_dir_.path(), | 82 base::ThreadTaskRunnerHandle::Get().get(), data_dir_.GetPath(), |
83 NULL /* special_storage_policy */, options)); | 83 NULL /* special_storage_policy */, options)); |
84 } | 84 } |
85 | 85 |
86 void SetUpNewBackend(const storage::FileSystemOptions& options) { | 86 void SetUpNewBackend(const storage::FileSystemOptions& options) { |
87 SetUpNewDelegate(options); | 87 SetUpNewDelegate(options); |
88 backend_.reset(new SandboxFileSystemBackend(delegate_.get())); | 88 backend_.reset(new SandboxFileSystemBackend(delegate_.get())); |
89 } | 89 } |
90 | 90 |
91 storage::SandboxFileSystemBackendDelegate::OriginEnumerator* | 91 storage::SandboxFileSystemBackendDelegate::OriginEnumerator* |
92 CreateOriginEnumerator() const { | 92 CreateOriginEnumerator() const { |
(...skipping 22 matching lines...) Expand all Loading... |
115 return false; | 115 return false; |
116 base::FilePath returned_root_path = | 116 base::FilePath returned_root_path = |
117 delegate_->GetBaseDirectoryForOriginAndType( | 117 delegate_->GetBaseDirectoryForOriginAndType( |
118 origin_url, type, false /* create */); | 118 origin_url, type, false /* create */); |
119 if (root_path) | 119 if (root_path) |
120 *root_path = returned_root_path; | 120 *root_path = returned_root_path; |
121 return !returned_root_path.empty(); | 121 return !returned_root_path.empty(); |
122 } | 122 } |
123 | 123 |
124 base::FilePath file_system_path() const { | 124 base::FilePath file_system_path() const { |
125 return data_dir_.path().Append( | 125 return data_dir_.GetPath().Append( |
126 SandboxFileSystemBackendDelegate::kFileSystemDirectory); | 126 SandboxFileSystemBackendDelegate::kFileSystemDirectory); |
127 } | 127 } |
128 | 128 |
129 base::ScopedTempDir data_dir_; | 129 base::ScopedTempDir data_dir_; |
130 base::MessageLoop message_loop_; | 130 base::MessageLoop message_loop_; |
131 std::unique_ptr<storage::SandboxFileSystemBackendDelegate> delegate_; | 131 std::unique_ptr<storage::SandboxFileSystemBackendDelegate> delegate_; |
132 std::unique_ptr<storage::SandboxFileSystemBackend> backend_; | 132 std::unique_ptr<storage::SandboxFileSystemBackend> backend_; |
133 }; | 133 }; |
134 | 134 |
135 TEST_F(SandboxFileSystemBackendTest, Empty) { | 135 TEST_F(SandboxFileSystemBackendTest, Empty) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 301 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
302 &root_path)); | 302 &root_path)); |
303 base::FilePath expected = file_system_path().AppendASCII( | 303 base::FilePath expected = file_system_path().AppendASCII( |
304 kRootPathFileURITestCases[i].expected_path); | 304 kRootPathFileURITestCases[i].expected_path); |
305 EXPECT_EQ(expected.value(), root_path.value()); | 305 EXPECT_EQ(expected.value(), root_path.value()); |
306 EXPECT_TRUE(base::DirectoryExists(root_path)); | 306 EXPECT_TRUE(base::DirectoryExists(root_path)); |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 } // namespace content | 310 } // namespace content |
OLD | NEW |