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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 base::MessageLoopProxy::current(), | 116 base::MessageLoopProxy::current(), |
117 base::MessageLoopProxy::current(), | 117 base::MessageLoopProxy::current(), |
118 storage_policy); | 118 storage_policy); |
119 | 119 |
120 // Every time we create a new helper, it creates another context, which | 120 // Every time we create a new helper, it creates another context, which |
121 // creates another path manager, another sandbox_mount_point_provider, and | 121 // creates another path manager, another sandbox_mount_point_provider, and |
122 // another OFU. We need to pass in the context to skip all that. | 122 // another OFU. We need to pass in the context to skip all that. |
123 file_system_context_ = new FileSystemContext( | 123 file_system_context_ = new FileSystemContext( |
124 base::MessageLoopProxy::current(), | 124 base::MessageLoopProxy::current(), |
125 base::MessageLoopProxy::current(), | 125 base::MessageLoopProxy::current(), |
| 126 base::MessageLoopProxy::current(), |
126 storage_policy, | 127 storage_policy, |
127 quota_manager_->proxy(), | 128 quota_manager_->proxy(), |
128 data_dir_.path(), | 129 data_dir_.path(), |
129 CreateAllowFileAccessOptions()); | 130 CreateAllowFileAccessOptions()); |
130 | 131 |
131 obfuscated_file_util_ = static_cast<ObfuscatedFileUtil*>( | 132 obfuscated_file_util_ = static_cast<ObfuscatedFileUtil*>( |
132 file_system_context_->GetFileUtil(type_)); | 133 file_system_context_->GetFileUtil(type_)); |
133 | 134 |
134 test_helper_.SetUp(file_system_context_.get(), | 135 test_helper_.SetUp(file_system_context_.get(), |
135 obfuscated_file_util_); | 136 obfuscated_file_util_); |
(...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2210 | 2211 |
2211 // Opening it with TRUNCATED flag, which should truncate the file size. | 2212 // Opening it with TRUNCATED flag, which should truncate the file size. |
2212 ASSERT_EQ(base::PLATFORM_FILE_OK, | 2213 ASSERT_EQ(base::PLATFORM_FILE_OK, |
2213 ofu()->CreateOrOpen( | 2214 ofu()->CreateOrOpen( |
2214 AllowUsageIncrease(-length)->context(), file, | 2215 AllowUsageIncrease(-length)->context(), file, |
2215 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, | 2216 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, |
2216 &file_handle, &created)); | 2217 &file_handle, &created)); |
2217 ASSERT_EQ(0, ComputeTotalFileSize()); | 2218 ASSERT_EQ(0, ComputeTotalFileSize()); |
2218 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); | 2219 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); |
2219 } | 2220 } |
OLD | NEW |