OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/media_galleries/fileapi/native_media_file_util.h" | 5 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 void SetUp() override { | 123 void SetUp() override { |
124 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 124 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
125 ASSERT_TRUE(base::CreateDirectory(root_path())); | 125 ASSERT_TRUE(base::CreateDirectory(root_path())); |
126 | 126 |
127 scoped_refptr<storage::SpecialStoragePolicy> storage_policy = | 127 scoped_refptr<storage::SpecialStoragePolicy> storage_policy = |
128 new content::MockSpecialStoragePolicy(); | 128 new content::MockSpecialStoragePolicy(); |
129 | 129 |
130 ScopedVector<storage::FileSystemBackend> additional_providers; | 130 ScopedVector<storage::FileSystemBackend> additional_providers; |
131 additional_providers.push_back(new MediaFileSystemBackend( | 131 additional_providers.push_back(new MediaFileSystemBackend( |
132 data_dir_.path(), base::ThreadTaskRunnerHandle::Get().get())); | 132 data_dir_.GetPath(), base::ThreadTaskRunnerHandle::Get().get())); |
133 | 133 |
134 file_system_context_ = new storage::FileSystemContext( | 134 file_system_context_ = new storage::FileSystemContext( |
135 base::ThreadTaskRunnerHandle::Get().get(), | 135 base::ThreadTaskRunnerHandle::Get().get(), |
136 base::ThreadTaskRunnerHandle::Get().get(), | 136 base::ThreadTaskRunnerHandle::Get().get(), |
137 storage::ExternalMountPoints::CreateRefCounted().get(), | 137 storage::ExternalMountPoints::CreateRefCounted().get(), |
138 storage_policy.get(), NULL, std::move(additional_providers), | 138 storage_policy.get(), NULL, std::move(additional_providers), |
139 std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.path(), | 139 std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.GetPath(), |
140 content::CreateAllowFileAccessOptions()); | 140 content::CreateAllowFileAccessOptions()); |
141 | 141 |
142 filesystem_id_ = isolated_context()->RegisterFileSystemForPath( | 142 filesystem_id_ = isolated_context()->RegisterFileSystemForPath( |
143 storage::kFileSystemTypeNativeMedia, std::string(), root_path(), NULL); | 143 storage::kFileSystemTypeNativeMedia, std::string(), root_path(), NULL); |
144 | 144 |
145 isolated_context()->AddReference(filesystem_id_); | 145 isolated_context()->AddReference(filesystem_id_); |
146 } | 146 } |
147 | 147 |
148 void TearDown() override { | 148 void TearDown() override { |
149 isolated_context()->RemoveReference(filesystem_id_); | 149 isolated_context()->RemoveReference(filesystem_id_); |
(...skipping 10 matching lines...) Expand all Loading... |
160 origin(), | 160 origin(), |
161 storage::kFileSystemTypeIsolated, | 161 storage::kFileSystemTypeIsolated, |
162 GetVirtualPath(test_case_path)); | 162 GetVirtualPath(test_case_path)); |
163 } | 163 } |
164 | 164 |
165 storage::IsolatedContext* isolated_context() { | 165 storage::IsolatedContext* isolated_context() { |
166 return storage::IsolatedContext::GetInstance(); | 166 return storage::IsolatedContext::GetInstance(); |
167 } | 167 } |
168 | 168 |
169 base::FilePath root_path() { | 169 base::FilePath root_path() { |
170 return data_dir_.path().Append(FPL("Media Directory")); | 170 return data_dir_.GetPath().Append(FPL("Media Directory")); |
171 } | 171 } |
172 | 172 |
173 base::FilePath GetVirtualPath( | 173 base::FilePath GetVirtualPath( |
174 const base::FilePath::CharType* test_case_path) { | 174 const base::FilePath::CharType* test_case_path) { |
175 return base::FilePath::FromUTF8Unsafe(filesystem_id_). | 175 return base::FilePath::FromUTF8Unsafe(filesystem_id_). |
176 Append(FPL("Media Directory")). | 176 Append(FPL("Media Directory")). |
177 Append(base::FilePath(test_case_path)); | 177 Append(base::FilePath(test_case_path)); |
178 } | 178 } |
179 | 179 |
180 GURL origin() { | 180 GURL origin() { |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 expected_error = base::File::FILE_OK; | 566 expected_error = base::File::FILE_OK; |
567 else | 567 else |
568 expected_error = base::File::FILE_ERROR_SECURITY; | 568 expected_error = base::File::FILE_ERROR_SECURITY; |
569 error = base::File::FILE_ERROR_FAILED; | 569 error = base::File::FILE_ERROR_FAILED; |
570 operation_runner()->CreateSnapshotFile(url, | 570 operation_runner()->CreateSnapshotFile(url, |
571 base::Bind(CreateSnapshotCallback, &error)); | 571 base::Bind(CreateSnapshotCallback, &error)); |
572 base::RunLoop().RunUntilIdle(); | 572 base::RunLoop().RunUntilIdle(); |
573 ASSERT_EQ(expected_error, error); | 573 ASSERT_EQ(expected_error, error); |
574 } | 574 } |
575 } | 575 } |
OLD | NEW |