| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop/message_loop_proxy.h" |
| 13 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 14 #include "base/thread_task_runner_handle.h" | |
| 15 #include "content/public/test/test_file_system_options.h" | 15 #include "content/public/test/test_file_system_options.h" |
| 16 #include "storage/browser/fileapi/file_system_backend.h" | 16 #include "storage/browser/fileapi/file_system_backend.h" |
| 17 #include "storage/browser/fileapi/file_system_url.h" | 17 #include "storage/browser/fileapi/file_system_url.h" |
| 18 #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h" | 18 #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h" |
| 19 #include "storage/common/fileapi/file_system_util.h" | 19 #include "storage/common/fileapi/file_system_util.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 22 | 22 |
| 23 using storage::FileSystemURL; | 23 using storage::FileSystemURL; |
| 24 using storage::SandboxFileSystemBackend; | 24 using storage::SandboxFileSystemBackend; |
| (...skipping 47 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::MessageLoopProxy::current().get(), |
| 83 NULL /* special_storage_policy */, options)); | 83 data_dir_.path(), |
| 84 NULL /* special_storage_policy */, |
| 85 options)); |
| 84 } | 86 } |
| 85 | 87 |
| 86 void SetUpNewBackend(const storage::FileSystemOptions& options) { | 88 void SetUpNewBackend(const storage::FileSystemOptions& options) { |
| 87 SetUpNewDelegate(options); | 89 SetUpNewDelegate(options); |
| 88 backend_.reset(new SandboxFileSystemBackend(delegate_.get())); | 90 backend_.reset(new SandboxFileSystemBackend(delegate_.get())); |
| 89 } | 91 } |
| 90 | 92 |
| 91 storage::SandboxFileSystemBackendDelegate::OriginEnumerator* | 93 storage::SandboxFileSystemBackendDelegate::OriginEnumerator* |
| 92 CreateOriginEnumerator() const { | 94 CreateOriginEnumerator() const { |
| 93 return backend_->CreateOriginEnumerator(); | 95 return backend_->CreateOriginEnumerator(); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 303 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
| 302 &root_path)); | 304 &root_path)); |
| 303 base::FilePath expected = file_system_path().AppendASCII( | 305 base::FilePath expected = file_system_path().AppendASCII( |
| 304 kRootPathFileURITestCases[i].expected_path); | 306 kRootPathFileURITestCases[i].expected_path); |
| 305 EXPECT_EQ(expected.value(), root_path.value()); | 307 EXPECT_EQ(expected.value(), root_path.value()); |
| 306 EXPECT_TRUE(base::DirectoryExists(root_path)); | 308 EXPECT_TRUE(base::DirectoryExists(root_path)); |
| 307 } | 309 } |
| 308 } | 310 } |
| 309 | 311 |
| 310 } // namespace content | 312 } // namespace content |
| OLD | NEW |