Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: webkit/fileapi/obfuscated_file_util_unittest.cc

Issue 9004019: Cleanup: Removing FileSystemPathManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/obfuscated_file_util.cc ('k') | webkit/fileapi/quota_file_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 type_(kFileSystemTypeTemporary), 135 type_(kFileSystemTypeTemporary),
136 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 136 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
137 test_helper_(origin_, type_), 137 test_helper_(origin_, type_),
138 quota_status_(quota::kQuotaStatusUnknown), 138 quota_status_(quota::kQuotaStatusUnknown),
139 usage_(-1) { 139 usage_(-1) {
140 } 140 }
141 141
142 void SetUp() { 142 void SetUp() {
143 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 143 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
144 144
145 scoped_refptr<quota::SpecialStoragePolicy> storage_policy =
146 new quota::MockSpecialStoragePolicy();
147
145 quota_manager_ = new quota::QuotaManager( 148 quota_manager_ = new quota::QuotaManager(
146 false /* is_incognito */, 149 false /* is_incognito */,
147 data_dir_.path(), 150 data_dir_.path(),
148 base::MessageLoopProxy::current(), 151 base::MessageLoopProxy::current(),
149 base::MessageLoopProxy::current(), 152 base::MessageLoopProxy::current(),
150 NULL /* special storage policy */); 153 storage_policy);
151 154
152 // Every time we create a new helper, it creates another context, which 155 // Every time we create a new helper, it creates another context, which
153 // creates another path manager, another sandbox_mount_point_provider, and 156 // creates another path manager, another sandbox_mount_point_provider, and
154 // another OFU. We need to pass in the context to skip all that. 157 // another OFU. We need to pass in the context to skip all that.
155 file_system_context_ = new FileSystemContext( 158 file_system_context_ = new FileSystemContext(
156 base::MessageLoopProxy::current(), 159 base::MessageLoopProxy::current(),
157 base::MessageLoopProxy::current(), 160 base::MessageLoopProxy::current(),
158 new quota::MockSpecialStoragePolicy(), 161 storage_policy,
159 quota_manager_->proxy(), 162 quota_manager_->proxy(),
160 data_dir_.path(), 163 data_dir_.path(),
161 false /* incognito */, 164 CreateAllowFileAccessOptions());
162 true /* allow_file_access_from_files */,
163 NULL /* path_manager */);
164 165
165 obfuscated_file_util_ = static_cast<ObfuscatedFileUtil*>( 166 obfuscated_file_util_ = static_cast<ObfuscatedFileUtil*>(
166 file_system_context_->path_manager()->GetFileUtil(type_)); 167 file_system_context_->GetFileUtil(type_));
167 168
168 test_helper_.SetUp(file_system_context_.get(), 169 test_helper_.SetUp(file_system_context_.get(),
169 obfuscated_file_util_.get()); 170 obfuscated_file_util_.get());
170 } 171 }
171 172
173 void TearDown() {
174 quota_manager_ = NULL;
175 test_helper_.TearDown();
176 }
177
172 FileSystemOperationContext* NewContext(FileSystemTestOriginHelper* helper) { 178 FileSystemOperationContext* NewContext(FileSystemTestOriginHelper* helper) {
173 FileSystemOperationContext* context; 179 FileSystemOperationContext* context;
174 if (helper) 180 if (helper)
175 context = helper->NewOperationContext(); 181 context = helper->NewOperationContext();
176 else 182 else
177 context = test_helper_.NewOperationContext(); 183 context = test_helper_.NewOperationContext();
178 context->set_allowed_bytes_growth(1024 * 1024); // Big enough for all tests. 184 context->set_allowed_bytes_growth(1024 * 1024); // Big enough for all tests.
179 return context; 185 return context;
180 } 186 }
181 187
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestampForCopyAndMove) { 1702 TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestampForCopyAndMove) {
1697 TestDirectoryTimestampHelper( 1703 TestDirectoryTimestampHelper(
1698 FilePath(FILE_PATH_LITERAL("copy overwrite")), true, true); 1704 FilePath(FILE_PATH_LITERAL("copy overwrite")), true, true);
1699 TestDirectoryTimestampHelper( 1705 TestDirectoryTimestampHelper(
1700 FilePath(FILE_PATH_LITERAL("copy non-overwrite")), true, false); 1706 FilePath(FILE_PATH_LITERAL("copy non-overwrite")), true, false);
1701 TestDirectoryTimestampHelper( 1707 TestDirectoryTimestampHelper(
1702 FilePath(FILE_PATH_LITERAL("move overwrite")), false, true); 1708 FilePath(FILE_PATH_LITERAL("move overwrite")), false, true);
1703 TestDirectoryTimestampHelper( 1709 TestDirectoryTimestampHelper(
1704 FilePath(FILE_PATH_LITERAL("move non-overwrite")), false, false); 1710 FilePath(FILE_PATH_LITERAL("move non-overwrite")), false, false);
1705 } 1711 }
OLDNEW
« no previous file with comments | « webkit/fileapi/obfuscated_file_util.cc ('k') | webkit/fileapi/quota_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698