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

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

Issue 14096022: Make MountPointProvider pluggable from outside webkit/fileapi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix etc Created 7 years, 8 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
OLDNEW
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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/platform_file.h" 15 #include "base/platform_file.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "webkit/fileapi/async_file_test_helper.h" 17 #include "webkit/fileapi/async_file_test_helper.h"
18 #include "webkit/fileapi/external_mount_points.h" 18 #include "webkit/fileapi/external_mount_points.h"
19 #include "webkit/fileapi/file_system_context.h" 19 #include "webkit/fileapi/file_system_context.h"
20 #include "webkit/fileapi/file_system_mount_point_provider.h"
20 #include "webkit/fileapi/file_system_operation_context.h" 21 #include "webkit/fileapi/file_system_operation_context.h"
21 #include "webkit/fileapi/file_system_task_runners.h" 22 #include "webkit/fileapi/file_system_task_runners.h"
22 #include "webkit/fileapi/file_system_usage_cache.h" 23 #include "webkit/fileapi/file_system_usage_cache.h"
23 #include "webkit/fileapi/local_file_system_test_helper.h" 24 #include "webkit/fileapi/local_file_system_test_helper.h"
24 #include "webkit/fileapi/mock_file_change_observer.h" 25 #include "webkit/fileapi/mock_file_change_observer.h"
25 #include "webkit/fileapi/mock_file_system_options.h" 26 #include "webkit/fileapi/mock_file_system_context.h"
26 #include "webkit/fileapi/obfuscated_file_util.h" 27 #include "webkit/fileapi/obfuscated_file_util.h"
27 #include "webkit/fileapi/test_file_set.h" 28 #include "webkit/fileapi/test_file_set.h"
28 #include "webkit/quota/mock_special_storage_policy.h" 29 #include "webkit/quota/mock_special_storage_policy.h"
29 #include "webkit/quota/quota_manager.h" 30 #include "webkit/quota/quota_manager.h"
30 #include "webkit/quota/quota_types.h" 31 #include "webkit/quota/quota_types.h"
31 32
32 namespace fileapi { 33 namespace fileapi {
33 34
34 namespace { 35 namespace {
35 36
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 quota_manager_ = new quota::QuotaManager( 135 quota_manager_ = new quota::QuotaManager(
135 false /* is_incognito */, 136 false /* is_incognito */,
136 data_dir_.path(), 137 data_dir_.path(),
137 base::MessageLoopProxy::current(), 138 base::MessageLoopProxy::current(),
138 base::MessageLoopProxy::current(), 139 base::MessageLoopProxy::current(),
139 storage_policy); 140 storage_policy);
140 141
141 // Every time we create a new helper, it creates another context, which 142 // Every time we create a new helper, it creates another context, which
142 // creates another path manager, another sandbox_mount_point_provider, and 143 // creates another path manager, another sandbox_mount_point_provider, and
143 // another OFU. We need to pass in the context to skip all that. 144 // another OFU. We need to pass in the context to skip all that.
144 file_system_context_ = new FileSystemContext( 145 file_system_context_ = CreateFileSystemContextForTesting(
145 FileSystemTaskRunners::CreateMockTaskRunners(),
146 ExternalMountPoints::CreateRefCounted().get(),
147 storage_policy,
148 quota_manager_->proxy(), 146 quota_manager_->proxy(),
149 data_dir_.path(), 147 data_dir_.path());
150 CreateAllowFileAccessOptions());
151 148
152 test_helper_.SetUp(file_system_context_.get()); 149 test_helper_.SetUp(file_system_context_.get());
153 150
154 change_observers_ = MockFileChangeObserver::CreateList(&change_observer_); 151 change_observers_ = MockFileChangeObserver::CreateList(&change_observer_);
155 } 152 }
156 153
157 virtual void TearDown() { 154 virtual void TearDown() {
158 quota_manager_ = NULL; 155 quota_manager_ = NULL;
159 test_helper_.TearDown(); 156 test_helper_.TearDown();
160 } 157 }
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 ASSERT_EQ(base::PLATFORM_FILE_OK, 2244 ASSERT_EQ(base::PLATFORM_FILE_OK,
2248 ofu()->CreateOrOpen( 2245 ofu()->CreateOrOpen(
2249 AllowUsageIncrease(-length)->context(), file, 2246 AllowUsageIncrease(-length)->context(), file,
2250 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, 2247 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE,
2251 &file_handle, &created)); 2248 &file_handle, &created));
2252 ASSERT_EQ(0, ComputeTotalFileSize()); 2249 ASSERT_EQ(0, ComputeTotalFileSize());
2253 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); 2250 EXPECT_TRUE(base::ClosePlatformFile(file_handle));
2254 } 2251 }
2255 2252
2256 } // namespace fileapi 2253 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/mock_file_system_context.cc ('k') | webkit/fileapi/sandbox_mount_point_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698