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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } // namespace | 158 } // namespace |
159 | 159 |
160 class FileSystemPathManagerTest : public testing::Test { | 160 class FileSystemPathManagerTest : public testing::Test { |
161 public: | 161 public: |
162 FileSystemPathManagerTest() | 162 FileSystemPathManagerTest() |
163 : callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 163 : callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
164 } | 164 } |
165 | 165 |
166 void SetUp() { | 166 void SetUp() { |
167 data_dir_.reset(new ScopedTempDir); | 167 data_dir_.reset(new ScopedTempDir); |
168 data_dir_->CreateUniqueTempDir(); | 168 ASSERT_TRUE(data_dir_->CreateUniqueTempDir()); |
169 ASSERT_TRUE(data_dir_->IsValid()); | |
170 root_path_callback_status_ = false; | 169 root_path_callback_status_ = false; |
171 root_path_.clear(); | 170 root_path_.clear(); |
172 file_system_name_.clear(); | 171 file_system_name_.clear(); |
173 } | 172 } |
174 | 173 |
175 protected: | 174 protected: |
176 FileSystemPathManager* NewPathManager( | 175 FileSystemPathManager* NewPathManager( |
177 bool incognito, | 176 bool incognito, |
178 bool allow_file_access) { | 177 bool allow_file_access) { |
179 return new FileSystemPathManager( | 178 return new FileSystemPathManager( |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 TEST_F(FileSystemPathManagerTest, IsRestrictedName) { | 417 TEST_F(FileSystemPathManagerTest, IsRestrictedName) { |
419 scoped_ptr<FileSystemPathManager> manager(NewPathManager(false, false)); | 418 scoped_ptr<FileSystemPathManager> manager(NewPathManager(false, false)); |
420 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kIsRestrictedNameTestCases); ++i) { | 419 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kIsRestrictedNameTestCases); ++i) { |
421 SCOPED_TRACE(testing::Message() << "IsRestrictedName #" << i << " " | 420 SCOPED_TRACE(testing::Message() << "IsRestrictedName #" << i << " " |
422 << kIsRestrictedNameTestCases[i].name); | 421 << kIsRestrictedNameTestCases[i].name); |
423 FilePath name(kIsRestrictedNameTestCases[i].name); | 422 FilePath name(kIsRestrictedNameTestCases[i].name); |
424 EXPECT_EQ(kIsRestrictedNameTestCases[i].expected_dangerous, | 423 EXPECT_EQ(kIsRestrictedNameTestCases[i].expected_dangerous, |
425 manager->IsRestrictedFileName(name)); | 424 manager->IsRestrictedFileName(name)); |
426 } | 425 } |
427 } | 426 } |
OLD | NEW |