| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "net/base/net_util.h" | 7 #include "net/base/net_util.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "webkit/browser/quota/mock_special_storage_policy.h" | 9 #include "webkit/browser/quota/mock_special_storage_policy.h" |
| 10 #include "webkit/browser/quota/usage_tracker.h" | 10 #include "webkit/browser/quota/usage_tracker.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 virtual void DeleteOriginData(const GURL& origin, | 83 virtual void DeleteOriginData(const GURL& origin, |
| 84 StorageType type, | 84 StorageType type, |
| 85 const DeletionCallback& callback) OVERRIDE { | 85 const DeletionCallback& callback) OVERRIDE { |
| 86 EXPECT_EQ(kStorageTypeTemporary, type); | 86 EXPECT_EQ(kStorageTypeTemporary, type); |
| 87 usage_map_.erase(origin); | 87 usage_map_.erase(origin); |
| 88 base::MessageLoop::current()->PostTask( | 88 base::MessageLoop::current()->PostTask( |
| 89 FROM_HERE, base::Bind(callback, kQuotaStatusOk)); | 89 FROM_HERE, base::Bind(callback, kQuotaStatusOk)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 virtual bool DoesSupport(quota::StorageType type) const OVERRIDE { |
| 93 return type == quota::kStorageTypeTemporary; |
| 94 } |
| 95 |
| 92 int64 GetUsage(const GURL& origin) { | 96 int64 GetUsage(const GURL& origin) { |
| 93 UsageMap::const_iterator found = usage_map_.find(origin); | 97 UsageMap::const_iterator found = usage_map_.find(origin); |
| 94 if (found == usage_map_.end()) | 98 if (found == usage_map_.end()) |
| 95 return 0; | 99 return 0; |
| 96 return found->second; | 100 return found->second; |
| 97 } | 101 } |
| 98 | 102 |
| 99 void SetUsage(const GURL& origin, int64 usage) { | 103 void SetUsage(const GURL& origin, int64 usage) { |
| 100 usage_map_[origin] = usage; | 104 usage_map_[origin] = usage; |
| 101 } | 105 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 319 |
| 316 GetGlobalLimitedUsage(&limited_usage); | 320 GetGlobalLimitedUsage(&limited_usage); |
| 317 GetGlobalUsage(&total_usage, &unlimited_usage); | 321 GetGlobalUsage(&total_usage, &unlimited_usage); |
| 318 EXPECT_EQ(1 + 16, limited_usage); | 322 EXPECT_EQ(1 + 16, limited_usage); |
| 319 EXPECT_EQ(1 + 2 + 16 + 32, total_usage); | 323 EXPECT_EQ(1 + 2 + 16 + 32, total_usage); |
| 320 EXPECT_EQ(2 + 32, unlimited_usage); | 324 EXPECT_EQ(2 + 32, unlimited_usage); |
| 321 } | 325 } |
| 322 | 326 |
| 323 | 327 |
| 324 } // namespace quota | 328 } // namespace quota |
| OLD | NEW |