| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| 310 | 310 |
| 311 void DidGetHostQuota(QuotaStatusCode status, | 311 void DidGetHostQuota(QuotaStatusCode status, |
| 312 const std::string& host, | |
| 313 StorageType type, | |
| 314 int64 quota) { | 312 int64 quota) { |
| 315 quota_status_ = status; | 313 quota_status_ = status; |
| 316 host_ = host; | |
| 317 type_ = type; | |
| 318 quota_ = quota; | 314 quota_ = quota; |
| 319 } | 315 } |
| 320 | 316 |
| 321 void DidGetGlobalUsage(StorageType type, int64 usage, | 317 void DidGetGlobalUsage(StorageType type, int64 usage, |
| 322 int64 unlimited_usage) { | 318 int64 unlimited_usage) { |
| 323 type_ = type; | 319 type_ = type; |
| 324 usage_ = usage; | 320 usage_ = usage; |
| 325 unlimited_usage_ = unlimited_usage; | 321 unlimited_usage_ = unlimited_usage; |
| 326 } | 322 } |
| 327 | 323 |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 | 918 |
| 923 quota_manager()->NotifyOriginNoLongerInUse(kFooOrigin); | 919 quota_manager()->NotifyOriginNoLongerInUse(kFooOrigin); |
| 924 EXPECT_FALSE(quota_manager()->IsOriginInUse(kFooOrigin)); | 920 EXPECT_FALSE(quota_manager()->IsOriginInUse(kFooOrigin)); |
| 925 } | 921 } |
| 926 | 922 |
| 927 TEST_F(QuotaManagerTest, GetAndSetPerststentHostQuota) { | 923 TEST_F(QuotaManagerTest, GetAndSetPerststentHostQuota) { |
| 928 RegisterClient(CreateClient(NULL, 0, QuotaClient::kFileSystem)); | 924 RegisterClient(CreateClient(NULL, 0, QuotaClient::kFileSystem)); |
| 929 | 925 |
| 930 GetPersistentHostQuota("foo.com"); | 926 GetPersistentHostQuota("foo.com"); |
| 931 MessageLoop::current()->RunAllPending(); | 927 MessageLoop::current()->RunAllPending(); |
| 932 EXPECT_EQ("foo.com", host()); | |
| 933 EXPECT_EQ(kPerm, type()); | |
| 934 EXPECT_EQ(0, quota()); | 928 EXPECT_EQ(0, quota()); |
| 935 | 929 |
| 936 SetPersistentHostQuota("foo.com", 100); | 930 SetPersistentHostQuota("foo.com", 100); |
| 937 MessageLoop::current()->RunAllPending(); | 931 MessageLoop::current()->RunAllPending(); |
| 938 EXPECT_EQ(100, quota()); | 932 EXPECT_EQ(100, quota()); |
| 939 | 933 |
| 940 GetPersistentHostQuota("foo.com"); | 934 GetPersistentHostQuota("foo.com"); |
| 941 SetPersistentHostQuota("foo.com", 200); | 935 SetPersistentHostQuota("foo.com", 200); |
| 942 GetPersistentHostQuota("foo.com"); | 936 GetPersistentHostQuota("foo.com"); |
| 943 SetPersistentHostQuota("foo.com", 300000000000ll); | 937 SetPersistentHostQuota("foo.com", 300000000000ll); |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); | 2046 EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); |
| 2053 | 2047 |
| 2054 DeleteHostData("foo.com", kTemp, | 2048 DeleteHostData("foo.com", kTemp, |
| 2055 QuotaClient::kDatabase | QuotaClient::kIndexedDatabase); | 2049 QuotaClient::kDatabase | QuotaClient::kIndexedDatabase); |
| 2056 MessageLoop::current()->RunAllPending(); | 2050 MessageLoop::current()->RunAllPending(); |
| 2057 GetHostUsage("foo.com", kTemp); | 2051 GetHostUsage("foo.com", kTemp); |
| 2058 MessageLoop::current()->RunAllPending(); | 2052 MessageLoop::current()->RunAllPending(); |
| 2059 EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); | 2053 EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); |
| 2060 } | 2054 } |
| 2061 } // namespace quota | 2055 } // namespace quota |
| OLD | NEW |