| 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 // 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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 FilePath PlatformPath(const FilePath& virtual_path) { | 81 FilePath PlatformPath(const FilePath& virtual_path) { |
| 82 return test_helper_.GetLocalPath(virtual_path); | 82 return test_helper_.GetLocalPath(virtual_path); |
| 83 } | 83 } |
| 84 | 84 |
| 85 int64 ActualFileSize() { | 85 int64 ActualFileSize() { |
| 86 return test_helper_.ComputeCurrentOriginUsage() - | 86 return test_helper_.ComputeCurrentOriginUsage() - |
| 87 test_helper_.ComputeCurrentDirectoryDatabaseUsage(); | 87 test_helper_.ComputeCurrentDirectoryDatabaseUsage(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 int64 SizeByQuotaUtil() { | 90 int64 SizeByQuotaUtil() { |
| 91 MessageLoop::current()->RunUntilIdle(); |
| 91 return test_helper_.GetCachedOriginUsage(); | 92 return test_helper_.GetCachedOriginUsage(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 void GetUsageAndQuotaFromQuotaManager() { | 95 void GetUsageAndQuotaFromQuotaManager() { |
| 95 quota_manager_->GetUsageAndQuota( | 96 quota_manager_->GetUsageAndQuota( |
| 96 test_helper_.origin(), test_helper_.storage_type(), | 97 test_helper_.origin(), test_helper_.storage_type(), |
| 97 base::Bind(&LocalFileSystemQuotaTest::OnGetUsageAndQuota, | 98 base::Bind(&LocalFileSystemQuotaTest::OnGetUsageAndQuota, |
| 98 weak_factory_.GetWeakPtr())); | 99 weak_factory_.GetWeakPtr())); |
| 99 MessageLoop::current()->RunUntilIdle(); | 100 MessageLoop::current()->RunUntilIdle(); |
| 100 } | 101 } |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 341 |
| 341 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, ActualFileSize()); | 342 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, ActualFileSize()); |
| 342 EXPECT_EQ(expected_usage, SizeByQuotaUtil()); | 343 EXPECT_EQ(expected_usage, SizeByQuotaUtil()); |
| 343 GetUsageAndQuotaFromQuotaManager(); | 344 GetUsageAndQuotaFromQuotaManager(); |
| 344 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); | 345 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); |
| 345 EXPECT_EQ(expected_usage, usage()); | 346 EXPECT_EQ(expected_usage, usage()); |
| 346 ASSERT_LT(expected_usage, quota()); | 347 ASSERT_LT(expected_usage, quota()); |
| 347 } | 348 } |
| 348 | 349 |
| 349 } // namespace fileapi | 350 } // namespace fileapi |
| OLD | NEW |