| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
| 15 #include "base/scoped_temp_dir.h" | 15 #include "base/scoped_temp_dir.h" |
| 16 #include "base/sys_string_conversions.h" | 16 #include "base/sys_string_conversions.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "webkit/fileapi/file_system_context.h" | 18 #include "webkit/fileapi/file_system_context.h" |
| 19 #include "webkit/fileapi/file_system_operation_context.h" | 19 #include "webkit/fileapi/file_system_operation_context.h" |
| 20 #include "webkit/fileapi/file_system_path_manager.h" | |
| 21 #include "webkit/fileapi/file_system_test_helper.h" | 20 #include "webkit/fileapi/file_system_test_helper.h" |
| 22 #include "webkit/fileapi/file_system_usage_cache.h" | 21 #include "webkit/fileapi/file_system_usage_cache.h" |
| 22 #include "webkit/fileapi/mock_file_system_options.h" |
| 23 #include "webkit/fileapi/obfuscated_file_util.h" | 23 #include "webkit/fileapi/obfuscated_file_util.h" |
| 24 #include "webkit/quota/mock_special_storage_policy.h" | 24 #include "webkit/quota/mock_special_storage_policy.h" |
| 25 #include "webkit/quota/quota_manager.h" | 25 #include "webkit/quota/quota_manager.h" |
| 26 #include "webkit/quota/quota_types.h" | 26 #include "webkit/quota/quota_types.h" |
| 27 | 27 |
| 28 using namespace fileapi; | 28 using namespace fileapi; |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 FilePath UTF8ToFilePath(const std::string& str) { | 32 FilePath UTF8ToFilePath(const std::string& str) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 base::MessageLoopProxy::current(), | 148 base::MessageLoopProxy::current(), |
| 149 base::MessageLoopProxy::current(), | 149 base::MessageLoopProxy::current(), |
| 150 NULL /* special storage policy */); | 150 NULL /* special storage policy */); |
| 151 | 151 |
| 152 // Every time we create a new helper, it creates another context, which | 152 // Every time we create a new helper, it creates another context, which |
| 153 // creates another path manager, another sandbox_mount_point_provider, and | 153 // creates another path manager, another sandbox_mount_point_provider, and |
| 154 // another OFU. We need to pass in the context to skip all that. | 154 // another OFU. We need to pass in the context to skip all that. |
| 155 file_system_context_ = new FileSystemContext( | 155 file_system_context_ = new FileSystemContext( |
| 156 base::MessageLoopProxy::current(), | 156 base::MessageLoopProxy::current(), |
| 157 base::MessageLoopProxy::current(), | 157 base::MessageLoopProxy::current(), |
| 158 new quota::MockSpecialStoragePolicy(), | 158 make_scoped_refptr(new quota::MockSpecialStoragePolicy()), |
| 159 quota_manager_->proxy(), | 159 quota_manager_->proxy(), |
| 160 data_dir_.path(), | 160 data_dir_.path(), |
| 161 false /* incognito */, | 161 new MockFileSystemOptions()); |
| 162 true /* allow_file_access_from_files */, | |
| 163 NULL /* path_manager */); | |
| 164 | 162 |
| 165 obfuscated_file_util_ = static_cast<ObfuscatedFileUtil*>( | 163 obfuscated_file_util_ = static_cast<ObfuscatedFileUtil*>( |
| 166 file_system_context_->path_manager()->GetFileUtil(type_)); | 164 file_system_context_->GetFileUtil(type_)); |
| 167 | 165 |
| 168 test_helper_.SetUp(file_system_context_.get(), | 166 test_helper_.SetUp(file_system_context_.get(), |
| 169 obfuscated_file_util_.get()); | 167 obfuscated_file_util_.get()); |
| 170 } | 168 } |
| 171 | 169 |
| 172 FileSystemOperationContext* NewContext(FileSystemTestOriginHelper* helper) { | 170 FileSystemOperationContext* NewContext(FileSystemTestOriginHelper* helper) { |
| 173 FileSystemOperationContext* context; | 171 FileSystemOperationContext* context; |
| 174 if (helper) | 172 if (helper) |
| 175 context = helper->NewOperationContext(); | 173 context = helper->NewOperationContext(); |
| 176 else | 174 else |
| (...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestampForCopyAndMove) { | 1694 TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestampForCopyAndMove) { |
| 1697 TestDirectoryTimestampHelper( | 1695 TestDirectoryTimestampHelper( |
| 1698 FilePath(FILE_PATH_LITERAL("copy overwrite")), true, true); | 1696 FilePath(FILE_PATH_LITERAL("copy overwrite")), true, true); |
| 1699 TestDirectoryTimestampHelper( | 1697 TestDirectoryTimestampHelper( |
| 1700 FilePath(FILE_PATH_LITERAL("copy non-overwrite")), true, false); | 1698 FilePath(FILE_PATH_LITERAL("copy non-overwrite")), true, false); |
| 1701 TestDirectoryTimestampHelper( | 1699 TestDirectoryTimestampHelper( |
| 1702 FilePath(FILE_PATH_LITERAL("move overwrite")), false, true); | 1700 FilePath(FILE_PATH_LITERAL("move overwrite")), false, true); |
| 1703 TestDirectoryTimestampHelper( | 1701 TestDirectoryTimestampHelper( |
| 1704 FilePath(FILE_PATH_LITERAL("move non-overwrite")), false, false); | 1702 FilePath(FILE_PATH_LITERAL("move non-overwrite")), false, false); |
| 1705 } | 1703 } |
| OLD | NEW |