| 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 #include <set> | 5 #include <set> |
| 6 #include <sstream> | 6 #include <sstream> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 quota_manager_->GetUsageAndQuota( | 101 quota_manager_->GetUsageAndQuota( |
| 102 origin, type, base::Bind(&QuotaManagerTest::DidGetUsageAndQuota, | 102 origin, type, base::Bind(&QuotaManagerTest::DidGetUsageAndQuota, |
| 103 weak_factory_.GetWeakPtr())); | 103 weak_factory_.GetWeakPtr())); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void GetTemporaryGlobalQuota() { | 106 void GetTemporaryGlobalQuota() { |
| 107 quota_status_ = kQuotaStatusUnknown; | 107 quota_status_ = kQuotaStatusUnknown; |
| 108 quota_ = -1; | 108 quota_ = -1; |
| 109 quota_manager_->GetTemporaryGlobalQuota( | 109 quota_manager_->GetTemporaryGlobalQuota( |
| 110 base::Bind(&QuotaManagerTest::DidGetQuota, | 110 base::Bind(&QuotaManagerTest::DidGetQuota, |
| 111 weak_factory_.GetWeakPtr())); | 111 weak_factory_.GetWeakPtr(), quota::kStorageTypeTemporary)); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void SetTemporaryGlobalQuota(int64 new_quota) { | 114 void SetTemporaryGlobalQuota(int64 new_quota) { |
| 115 quota_status_ = kQuotaStatusUnknown; | 115 quota_status_ = kQuotaStatusUnknown; |
| 116 quota_ = -1; | 116 quota_ = -1; |
| 117 quota_manager_->SetTemporaryGlobalOverrideQuota( | 117 quota_manager_->SetTemporaryGlobalOverrideQuota( |
| 118 new_quota, | 118 new_quota, |
| 119 base::Bind(&QuotaManagerTest::DidGetQuota, | 119 base::Bind(&QuotaManagerTest::DidGetQuota, |
| 120 weak_factory_.GetWeakPtr())); | 120 weak_factory_.GetWeakPtr(), quota::kStorageTypeTemporary)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void GetPersistentHostQuota(const std::string& host) { | 123 void GetPersistentHostQuota(const std::string& host) { |
| 124 quota_status_ = kQuotaStatusUnknown; | 124 quota_status_ = kQuotaStatusUnknown; |
| 125 host_.clear(); | 125 host_.clear(); |
| 126 type_ = kStorageTypeUnknown; | 126 type_ = kStorageTypeUnknown; |
| 127 quota_ = -1; | 127 quota_ = -1; |
| 128 quota_manager_->GetPersistentHostQuota( | 128 quota_manager_->GetPersistentHostQuota( |
| 129 host, | 129 host, |
| 130 base::Bind(&QuotaManagerTest::DidGetHostQuota, | 130 base::Bind(&QuotaManagerTest::DidGetHostQuota, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 void DidGetUsageInfo(const UsageInfoEntries& entries) { | 288 void DidGetUsageInfo(const UsageInfoEntries& entries) { |
| 289 usage_info_.insert(usage_info_.begin(), entries.begin(), entries.end()); | 289 usage_info_.insert(usage_info_.begin(), entries.begin(), entries.end()); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void DidGetUsageAndQuota(QuotaStatusCode status, int64 usage, int64 quota) { | 292 void DidGetUsageAndQuota(QuotaStatusCode status, int64 usage, int64 quota) { |
| 293 quota_status_ = status; | 293 quota_status_ = status; |
| 294 usage_ = usage; | 294 usage_ = usage; |
| 295 quota_ = quota; | 295 quota_ = quota; |
| 296 } | 296 } |
| 297 | 297 |
| 298 void DidGetQuota(QuotaStatusCode status, | 298 void DidGetQuota(StorageType type, |
| 299 StorageType type, | 299 QuotaStatusCode status, |
| 300 int64 quota) { | 300 int64 quota) { |
| 301 quota_status_ = status; | 301 quota_status_ = status; |
| 302 type_ = type; | 302 type_ = type; |
| 303 quota_ = quota; | 303 quota_ = quota; |
| 304 } | 304 } |
| 305 | 305 |
| 306 void DidGetAvailableSpace(QuotaStatusCode status, int64 available_space) { | 306 void DidGetAvailableSpace(QuotaStatusCode status, int64 available_space) { |
| 307 quota_status_ = status; | 307 quota_status_ = status; |
| 308 available_space_ = available_space; | 308 available_space_ = available_space; |
| 309 } | 309 } |
| (...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2046 EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); | 2046 EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); |
| 2047 | 2047 |
| 2048 DeleteHostData("foo.com", kTemp, | 2048 DeleteHostData("foo.com", kTemp, |
| 2049 QuotaClient::kDatabase | QuotaClient::kIndexedDatabase); | 2049 QuotaClient::kDatabase | QuotaClient::kIndexedDatabase); |
| 2050 MessageLoop::current()->RunAllPending(); | 2050 MessageLoop::current()->RunAllPending(); |
| 2051 GetHostUsage("foo.com", kTemp); | 2051 GetHostUsage("foo.com", kTemp); |
| 2052 MessageLoop::current()->RunAllPending(); | 2052 MessageLoop::current()->RunAllPending(); |
| 2053 EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); | 2053 EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); |
| 2054 } | 2054 } |
| 2055 } // namespace quota | 2055 } // namespace quota |
| OLD | NEW |