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 25 matching lines...) Expand all Loading... |
36 ASSERT_EQ(expected, actual); | 36 ASSERT_EQ(expected, actual); |
37 } | 37 } |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 class LocalFileSystemQuotaTest | 41 class LocalFileSystemQuotaTest |
42 : public testing::Test, | 42 : public testing::Test, |
43 public base::SupportsWeakPtr<LocalFileSystemQuotaTest> { | 43 public base::SupportsWeakPtr<LocalFileSystemQuotaTest> { |
44 public: | 44 public: |
45 LocalFileSystemQuotaTest() | 45 LocalFileSystemQuotaTest() |
46 : weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 46 : weak_factory_(this), |
47 next_unique_path_suffix_(0), | 47 next_unique_path_suffix_(0), |
48 status_(kFileOperationStatusNotSet), | 48 status_(kFileOperationStatusNotSet), |
49 quota_status_(quota::kQuotaStatusUnknown), | 49 quota_status_(quota::kQuotaStatusUnknown), |
50 usage_(-1), | 50 usage_(-1), |
51 quota_(-1) {} | 51 quota_(-1) {} |
52 | 52 |
53 virtual void SetUp() OVERRIDE { | 53 virtual void SetUp() OVERRIDE { |
54 ASSERT_TRUE(work_dir_.CreateUniqueTempDir()); | 54 ASSERT_TRUE(work_dir_.CreateUniqueTempDir()); |
55 base::FilePath filesystem_dir_path = | 55 base::FilePath filesystem_dir_path = |
56 work_dir_.path().AppendASCII("filesystem"); | 56 work_dir_.path().AppendASCII("filesystem"); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 338 |
339 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, ActualFileSize()); | 339 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, ActualFileSize()); |
340 EXPECT_EQ(expected_usage, SizeByQuotaUtil()); | 340 EXPECT_EQ(expected_usage, SizeByQuotaUtil()); |
341 GetUsageAndQuotaFromQuotaManager(); | 341 GetUsageAndQuotaFromQuotaManager(); |
342 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); | 342 EXPECT_EQ(quota::kQuotaStatusOk, quota_status()); |
343 EXPECT_EQ(expected_usage, usage()); | 343 EXPECT_EQ(expected_usage, usage()); |
344 ASSERT_LT(expected_usage, quota()); | 344 ASSERT_LT(expected_usage, quota()); |
345 } | 345 } |
346 | 346 |
347 } // namespace fileapi | 347 } // namespace fileapi |
OLD | NEW |