OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/fileapi/file_system_path_manager.h" | 5 #include "webkit/fileapi/file_system_path_manager.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return root_path_callback_status_; | 203 return root_path_callback_status_; |
204 } | 204 } |
205 | 205 |
206 bool CheckValidFileSystemPath(FileSystemPathManager* manager, | 206 bool CheckValidFileSystemPath(FileSystemPathManager* manager, |
207 const FilePath& path) { | 207 const FilePath& path) { |
208 return manager->CrackFileSystemPath(path, NULL, NULL, NULL); | 208 return manager->CrackFileSystemPath(path, NULL, NULL, NULL); |
209 } | 209 } |
210 | 210 |
211 FilePath data_path() { return data_dir_->path(); } | 211 FilePath data_path() { return data_dir_->path(); } |
212 FilePath file_system_path() { | 212 FilePath file_system_path() { |
213 return data_dir_->path().Append( | 213 return FileSystemPathManager::GetFileSystemCommonRootDirectory( |
214 FileSystemPathManager::kFileSystemDirectory); | 214 data_dir_->path()); |
215 } | 215 } |
216 | 216 |
217 private: | 217 private: |
218 scoped_ptr<ScopedTempDir> data_dir_; | 218 scoped_ptr<ScopedTempDir> data_dir_; |
219 base::ScopedCallbackFactory<FileSystemPathManagerTest> callback_factory_; | 219 base::ScopedCallbackFactory<FileSystemPathManagerTest> callback_factory_; |
220 | 220 |
221 bool root_path_callback_status_; | 221 bool root_path_callback_status_; |
222 FilePath root_path_; | 222 FilePath root_path_; |
223 std::string file_system_name_; | 223 std::string file_system_name_; |
224 | 224 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 TEST_F(FileSystemPathManagerTest, IsRestrictedName) { | 418 TEST_F(FileSystemPathManagerTest, IsRestrictedName) { |
419 scoped_ptr<FileSystemPathManager> manager(NewPathManager(false, false)); | 419 scoped_ptr<FileSystemPathManager> manager(NewPathManager(false, false)); |
420 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kIsRestrictedNameTestCases); ++i) { | 420 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kIsRestrictedNameTestCases); ++i) { |
421 SCOPED_TRACE(testing::Message() << "IsRestrictedName #" << i << " " | 421 SCOPED_TRACE(testing::Message() << "IsRestrictedName #" << i << " " |
422 << kIsRestrictedNameTestCases[i].name); | 422 << kIsRestrictedNameTestCases[i].name); |
423 FilePath name(kIsRestrictedNameTestCases[i].name); | 423 FilePath name(kIsRestrictedNameTestCases[i].name); |
424 EXPECT_EQ(kIsRestrictedNameTestCases[i].expected_dangerous, | 424 EXPECT_EQ(kIsRestrictedNameTestCases[i].expected_dangerous, |
425 manager->IsRestrictedFileName(name)); | 425 manager->IsRestrictedFileName(name)); |
426 } | 426 } |
427 } | 427 } |
OLD | NEW |