| 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 15 matching lines...) Expand all Loading... |
| 26 #include "webkit/quota/mock_special_storage_policy.h" | 26 #include "webkit/quota/mock_special_storage_policy.h" |
| 27 #include "webkit/quota/quota_manager.h" | 27 #include "webkit/quota/quota_manager.h" |
| 28 | 28 |
| 29 namespace fileapi { | 29 namespace fileapi { |
| 30 | 30 |
| 31 const int kFileOperationStatusNotSet = 1; | 31 const int kFileOperationStatusNotSet = 1; |
| 32 | 32 |
| 33 class FileSystemQuotaTest : public testing::Test { | 33 class FileSystemQuotaTest : public testing::Test { |
| 34 public: | 34 public: |
| 35 FileSystemQuotaTest() | 35 FileSystemQuotaTest() |
| 36 : quota_file_util_(QuotaFileUtil::GetInstance()), | 36 : quota_file_util_(QuotaFileUtil::CreateDefault()), |
| 37 local_file_util_(new LocalFileSystemFileUtil(quota_file_util_)), | 37 local_file_util_(new LocalFileSystemFileUtil(quota_file_util_)), |
| 38 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 38 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 39 file_path_cost_(0), | 39 file_path_cost_(0), |
| 40 status_(kFileOperationStatusNotSet), | 40 status_(kFileOperationStatusNotSet), |
| 41 quota_status_(quota::kQuotaStatusUnknown), | 41 quota_status_(quota::kQuotaStatusUnknown), |
| 42 usage_(-1), | 42 usage_(-1), |
| 43 quota_(-1) {} | 43 quota_(-1) {} |
| 44 | 44 |
| 45 FileSystemOperation* operation(); | 45 FileSystemOperation* operation(); |
| 46 | 46 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |