OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 class ObfuscatedFileUtilTest : public testing::Test { | 144 class ObfuscatedFileUtilTest : public testing::Test { |
145 public: | 145 public: |
146 ObfuscatedFileUtilTest() | 146 ObfuscatedFileUtilTest() |
147 : origin_(GURL("http://www.example.com")), | 147 : origin_(GURL("http://www.example.com")), |
148 type_(storage::kFileSystemTypeTemporary), | 148 type_(storage::kFileSystemTypeTemporary), |
149 weak_factory_(this), | 149 weak_factory_(this), |
150 sandbox_file_system_(origin_, type_), | 150 sandbox_file_system_(origin_, type_), |
151 quota_status_(storage::kQuotaStatusUnknown), | 151 quota_status_(storage::kQuotaStatusUnknown), |
152 usage_(-1) {} | 152 usage_(-1) {} |
153 | 153 |
154 virtual void SetUp() { | 154 void SetUp() override { |
155 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 155 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
156 | 156 |
157 storage_policy_ = new MockSpecialStoragePolicy(); | 157 storage_policy_ = new MockSpecialStoragePolicy(); |
158 | 158 |
159 quota_manager_ = | 159 quota_manager_ = |
160 new storage::QuotaManager(false /* is_incognito */, | 160 new storage::QuotaManager(false /* is_incognito */, |
161 data_dir_.path(), | 161 data_dir_.path(), |
162 base::MessageLoopProxy::current().get(), | 162 base::MessageLoopProxy::current().get(), |
163 base::MessageLoopProxy::current().get(), | 163 base::MessageLoopProxy::current().get(), |
164 storage_policy_.get()); | 164 storage_policy_.get()); |
165 | 165 |
166 // Every time we create a new sandbox_file_system helper, | 166 // Every time we create a new sandbox_file_system helper, |
167 // it creates another context, which creates another path manager, | 167 // it creates another context, which creates another path manager, |
168 // another sandbox_backend, and another OFU. | 168 // another sandbox_backend, and another OFU. |
169 // We need to pass in the context to skip all that. | 169 // We need to pass in the context to skip all that. |
170 file_system_context_ = CreateFileSystemContextForTesting( | 170 file_system_context_ = CreateFileSystemContextForTesting( |
171 quota_manager_->proxy(), | 171 quota_manager_->proxy(), |
172 data_dir_.path()); | 172 data_dir_.path()); |
173 | 173 |
174 sandbox_file_system_.SetUp(file_system_context_.get()); | 174 sandbox_file_system_.SetUp(file_system_context_.get()); |
175 | 175 |
176 change_observers_ = | 176 change_observers_ = |
177 storage::MockFileChangeObserver::CreateList(&change_observer_); | 177 storage::MockFileChangeObserver::CreateList(&change_observer_); |
178 } | 178 } |
179 | 179 |
180 virtual void TearDown() { | 180 void TearDown() override { |
181 quota_manager_ = NULL; | 181 quota_manager_ = NULL; |
182 sandbox_file_system_.TearDown(); | 182 sandbox_file_system_.TearDown(); |
183 } | 183 } |
184 | 184 |
185 scoped_ptr<FileSystemOperationContext> LimitedContext( | 185 scoped_ptr<FileSystemOperationContext> LimitedContext( |
186 int64 allowed_bytes_growth) { | 186 int64 allowed_bytes_growth) { |
187 scoped_ptr<FileSystemOperationContext> context( | 187 scoped_ptr<FileSystemOperationContext> context( |
188 sandbox_file_system_.NewOperationContext()); | 188 sandbox_file_system_.NewOperationContext()); |
189 context->set_allowed_bytes_growth(allowed_bytes_growth); | 189 context->set_allowed_bytes_growth(allowed_bytes_growth); |
190 return context.Pass(); | 190 return context.Pass(); |
(...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2443 false /* exclusive */, | 2443 false /* exclusive */, |
2444 true /* recursive */)); | 2444 true /* recursive */)); |
2445 ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY, | 2445 ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY, |
2446 ofu()->CreateDirectory(UnlimitedContext().get(), | 2446 ofu()->CreateDirectory(UnlimitedContext().get(), |
2447 path_in_file_in_file, | 2447 path_in_file_in_file, |
2448 false /* exclusive */, | 2448 false /* exclusive */, |
2449 true /* recursive */)); | 2449 true /* recursive */)); |
2450 } | 2450 } |
2451 | 2451 |
2452 } // namespace content | 2452 } // namespace content |
OLD | NEW |