OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This test checks the entire behavior of FileSystem usage and quota, such as: | 5 // This test checks the entire behavior of FileSystem usage and quota, such as: |
6 // 1) the actual size of files on disk, | 6 // 1) the actual size of files on disk, |
7 // 2) the described size in .usage, and | 7 // 2) the described size in .usage, and |
8 // 3) the result of QuotaManager::GetUsageAndQuota. | 8 // 3) the result of QuotaManager::GetUsageAndQuota. |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } // namespace (anonymous) | 206 } // namespace (anonymous) |
207 | 207 |
208 void FileSystemQuotaTest::SetUp() { | 208 void FileSystemQuotaTest::SetUp() { |
209 ASSERT_TRUE(work_dir_.CreateUniqueTempDir()); | 209 ASSERT_TRUE(work_dir_.CreateUniqueTempDir()); |
210 FilePath filesystem_dir_path = work_dir_.path().AppendASCII("filesystem"); | 210 FilePath filesystem_dir_path = work_dir_.path().AppendASCII("filesystem"); |
211 file_util::CreateDirectory(filesystem_dir_path); | 211 file_util::CreateDirectory(filesystem_dir_path); |
212 | 212 |
213 quota_manager_ = new quota::QuotaManager( | 213 quota_manager_ = new quota::QuotaManager( |
214 false /* is_incognito */, | 214 false /* is_incognito */, |
215 filesystem_dir_path, | 215 filesystem_dir_path, |
216 base::MessageLoopProxy::CreateForCurrentThread(), | 216 base::MessageLoopProxy::current(), |
217 base::MessageLoopProxy::CreateForCurrentThread(), | 217 base::MessageLoopProxy::current(), |
218 NULL); | 218 NULL); |
219 | 219 |
220 test_helper_.SetUp(filesystem_dir_path, | 220 test_helper_.SetUp(filesystem_dir_path, |
221 false /* incognito */, | 221 false /* incognito */, |
222 false /* unlimited quota */, | 222 false /* unlimited quota */, |
223 quota_manager_->proxy(), | 223 quota_manager_->proxy(), |
224 local_file_util_.get()); | 224 local_file_util_.get()); |
225 } | 225 } |
226 | 226 |
227 void FileSystemQuotaTest::TearDown() { | 227 void FileSystemQuotaTest::TearDown() { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } | 377 } |
378 | 378 |
379 void FileSystemObfuscatedQuotaTest::SetUp() { | 379 void FileSystemObfuscatedQuotaTest::SetUp() { |
380 ASSERT_TRUE(work_dir_.CreateUniqueTempDir()); | 380 ASSERT_TRUE(work_dir_.CreateUniqueTempDir()); |
381 FilePath filesystem_dir_path = work_dir_.path().AppendASCII("filesystem"); | 381 FilePath filesystem_dir_path = work_dir_.path().AppendASCII("filesystem"); |
382 file_util::CreateDirectory(filesystem_dir_path); | 382 file_util::CreateDirectory(filesystem_dir_path); |
383 | 383 |
384 quota_manager_ = new quota::QuotaManager( | 384 quota_manager_ = new quota::QuotaManager( |
385 false /* is_incognito */, | 385 false /* is_incognito */, |
386 filesystem_dir_path, | 386 filesystem_dir_path, |
387 base::MessageLoopProxy::CreateForCurrentThread(), | 387 base::MessageLoopProxy::current(), |
388 base::MessageLoopProxy::CreateForCurrentThread(), | 388 base::MessageLoopProxy::current(), |
389 NULL); | 389 NULL); |
390 | 390 |
391 file_system_context_ = new FileSystemContext( | 391 file_system_context_ = new FileSystemContext( |
392 base::MessageLoopProxy::CreateForCurrentThread(), | 392 base::MessageLoopProxy::current(), |
393 base::MessageLoopProxy::CreateForCurrentThread(), | 393 base::MessageLoopProxy::current(), |
394 new quota::MockSpecialStoragePolicy(), | 394 new quota::MockSpecialStoragePolicy(), |
395 quota_manager_->proxy(), | 395 quota_manager_->proxy(), |
396 filesystem_dir_path, | 396 filesystem_dir_path, |
397 false /* incognito */, | 397 false /* incognito */, |
398 true /* allow_file_access_from_files */, | 398 true /* allow_file_access_from_files */, |
399 false /* unlimitedquota */, | 399 false /* unlimitedquota */, |
400 NULL); | 400 NULL); |
401 | 401 |
402 test_helper_.SetUp(file_system_context_, | 402 test_helper_.SetUp(file_system_context_, |
403 NULL /* sandbox_provider's internal file_util */); | 403 NULL /* sandbox_provider's internal file_util */); |
(...skipping 22 matching lines...) Expand all Loading... |
426 EXPECT_EQ(-1, SizeInUsageFile()); | 426 EXPECT_EQ(-1, SizeInUsageFile()); |
427 | 427 |
428 GetUsageAndQuotaFromQuotaManager(); | 428 GetUsageAndQuotaFromQuotaManager(); |
429 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); | 429 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); |
430 EXPECT_EQ(all_file_size + file_path_cost(), SizeInUsageFile()); | 430 EXPECT_EQ(all_file_size + file_path_cost(), SizeInUsageFile()); |
431 EXPECT_EQ(all_file_size + file_path_cost(), usage()); | 431 EXPECT_EQ(all_file_size + file_path_cost(), usage()); |
432 ASSERT_LT(all_file_size, quota()); | 432 ASSERT_LT(all_file_size, quota()); |
433 } | 433 } |
434 | 434 |
435 } // namespace fileapi | 435 } // namespace fileapi |
OLD | NEW |