OLD | NEW |
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 <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" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 void SetUp() { | 109 void SetUp() { |
110 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 110 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
111 | 111 |
112 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = | 112 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = |
113 new quota::MockSpecialStoragePolicy(); | 113 new quota::MockSpecialStoragePolicy(); |
114 | 114 |
115 quota_manager_ = new quota::QuotaManager( | 115 quota_manager_ = new quota::QuotaManager( |
116 false /* is_incognito */, | 116 false /* is_incognito */, |
117 data_dir_.path(), | 117 data_dir_.path(), |
118 base::MessageLoopProxy::current(), | 118 base::MessageLoopProxy::current().get(), |
119 base::MessageLoopProxy::current(), | 119 base::MessageLoopProxy::current().get(), |
120 storage_policy); | 120 storage_policy.get()); |
121 | 121 |
122 // Every time we create a new helper, it creates another context, which | 122 // Every time we create a new helper, it creates another context, which |
123 // creates another path manager, another sandbox_mount_point_provider, and | 123 // creates another path manager, another sandbox_mount_point_provider, and |
124 // another OFU. We need to pass in the context to skip all that. | 124 // another OFU. We need to pass in the context to skip all that. |
125 file_system_context_ = new FileSystemContext( | 125 file_system_context_ = new FileSystemContext( |
126 FileSystemTaskRunners::CreateMockTaskRunners(), | 126 FileSystemTaskRunners::CreateMockTaskRunners(), |
127 storage_policy, | 127 storage_policy.get(), |
128 quota_manager_->proxy(), | 128 quota_manager_->proxy(), |
129 data_dir_.path(), | 129 data_dir_.path(), |
130 CreateAllowFileAccessOptions()); | 130 CreateAllowFileAccessOptions()); |
131 | 131 |
132 obfuscated_file_util_ = static_cast<ObfuscatedFileUtil*>( | 132 obfuscated_file_util_ = static_cast<ObfuscatedFileUtil*>( |
133 file_system_context_->GetFileUtil(type_)); | 133 file_system_context_->GetFileUtil(type_)); |
134 | 134 |
135 test_helper_.SetUp(file_system_context_.get(), | 135 test_helper_.SetUp(file_system_context_.get(), |
136 obfuscated_file_util_); | 136 obfuscated_file_util_); |
137 | 137 |
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2270 ASSERT_EQ(base::PLATFORM_FILE_OK, | 2270 ASSERT_EQ(base::PLATFORM_FILE_OK, |
2271 ofu()->CreateOrOpen( | 2271 ofu()->CreateOrOpen( |
2272 AllowUsageIncrease(-length)->context(), file, | 2272 AllowUsageIncrease(-length)->context(), file, |
2273 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, | 2273 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, |
2274 &file_handle, &created)); | 2274 &file_handle, &created)); |
2275 ASSERT_EQ(0, ComputeTotalFileSize()); | 2275 ASSERT_EQ(0, ComputeTotalFileSize()); |
2276 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); | 2276 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); |
2277 } | 2277 } |
2278 | 2278 |
2279 } // namespace fileapi | 2279 } // namespace fileapi |
OLD | NEW |