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

Side by Side Diff: content/browser/fileapi/obfuscated_file_util_unittest.cc

Issue 1782053004: Change how the quota system computes the total poolsize for temporary storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 2 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
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <limits> 8 #include <limits>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 weak_factory_(this) {} 160 weak_factory_(this) {}
161 161
162 void SetUp() override { 162 void SetUp() override {
163 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 163 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
164 164
165 storage_policy_ = new MockSpecialStoragePolicy(); 165 storage_policy_ = new MockSpecialStoragePolicy();
166 166
167 quota_manager_ = new storage::QuotaManager( 167 quota_manager_ = new storage::QuotaManager(
168 false /* is_incognito */, data_dir_.GetPath(), 168 false /* is_incognito */, data_dir_.GetPath(),
169 base::ThreadTaskRunnerHandle::Get().get(), 169 base::ThreadTaskRunnerHandle::Get().get(),
170 base::ThreadTaskRunnerHandle::Get().get(), storage_policy_.get()); 170 base::ThreadTaskRunnerHandle::Get().get(), storage_policy_.get(),
171 storage::GetTemporaryStorageConfigurationFunc());
172 storage::TemporaryStorageConfiguration config;
173 config.per_host_quota = 25 * 1024 * 1024;
174 config.pool_size = config.per_host_quota * 5;
175 config.must_remain_available = 10 * 1024 * 1024;
176 config.refresh_interval = base::TimeDelta::Max();
177 quota_manager_->SetTemporaryStorageConfiguration(config);
171 178
172 // Every time we create a new sandbox_file_system helper, 179 // Every time we create a new sandbox_file_system helper,
173 // it creates another context, which creates another path manager, 180 // it creates another context, which creates another path manager,
174 // another sandbox_backend, and another OFU. 181 // another sandbox_backend, and another OFU.
175 // We need to pass in the context to skip all that. 182 // We need to pass in the context to skip all that.
176 file_system_context_ = CreateFileSystemContextForTesting( 183 file_system_context_ = CreateFileSystemContextForTesting(
177 quota_manager_->proxy(), data_dir_.GetPath()); 184 quota_manager_->proxy(), data_dir_.GetPath());
178 185
179 sandbox_file_system_.SetUp(file_system_context_.get()); 186 sandbox_file_system_.SetUp(file_system_context_.get());
180 187
(...skipping 2386 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 ofu()->GetDirectoryForOriginAndType( 2574 ofu()->GetDirectoryForOriginAndType(
2568 origin2, GetTypeString(kFileSystemTypeTemporary), false, &error); 2575 origin2, GetTypeString(kFileSystemTypeTemporary), false, &error);
2569 ASSERT_EQ(base::File::FILE_OK, error); 2576 ASSERT_EQ(base::File::FILE_OK, error);
2570 error = base::File::FILE_ERROR_FAILED; 2577 error = base::File::FILE_ERROR_FAILED;
2571 ofu()->GetDirectoryForOriginAndType( 2578 ofu()->GetDirectoryForOriginAndType(
2572 origin2, GetTypeString(kFileSystemTypePersistent), false, &error); 2579 origin2, GetTypeString(kFileSystemTypePersistent), false, &error);
2573 ASSERT_EQ(base::File::FILE_OK, error); 2580 ASSERT_EQ(base::File::FILE_OK, error);
2574 } 2581 }
2575 2582
2576 } // namespace content 2583 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698