OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "content/public/test/mock_special_storage_policy.h" | 7 #include "content/public/test/mock_special_storage_policy.h" |
8 #include "net/base/net_util.h" | 8 #include "net/base/net_util.h" |
9 #include "storage/browser/quota/usage_tracker.h" | 9 #include "storage/browser/quota/usage_tracker.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 }; | 123 }; |
124 | 124 |
125 class UsageTrackerTest : public testing::Test { | 125 class UsageTrackerTest : public testing::Test { |
126 public: | 126 public: |
127 UsageTrackerTest() | 127 UsageTrackerTest() |
128 : storage_policy_(new MockSpecialStoragePolicy()), | 128 : storage_policy_(new MockSpecialStoragePolicy()), |
129 usage_tracker_(GetUsageTrackerList(), kStorageTypeTemporary, | 129 usage_tracker_(GetUsageTrackerList(), kStorageTypeTemporary, |
130 storage_policy_.get(), NULL) { | 130 storage_policy_.get(), NULL) { |
131 } | 131 } |
132 | 132 |
133 virtual ~UsageTrackerTest() {} | 133 ~UsageTrackerTest() override {} |
134 | 134 |
135 UsageTracker* usage_tracker() { | 135 UsageTracker* usage_tracker() { |
136 return &usage_tracker_; | 136 return &usage_tracker_; |
137 } | 137 } |
138 | 138 |
139 void UpdateUsage(const GURL& origin, int64 delta) { | 139 void UpdateUsage(const GURL& origin, int64 delta) { |
140 quota_client_.UpdateUsage(origin, delta); | 140 quota_client_.UpdateUsage(origin, delta); |
141 usage_tracker_.UpdateUsageCache(quota_client_.id(), origin, delta); | 141 usage_tracker_.UpdateUsageCache(quota_client_.id(), origin, delta); |
142 base::RunLoop().RunUntilIdle(); | 142 base::RunLoop().RunUntilIdle(); |
143 } | 143 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 GetGlobalLimitedUsage(&limited_usage); | 326 GetGlobalLimitedUsage(&limited_usage); |
327 GetGlobalUsage(&total_usage, &unlimited_usage); | 327 GetGlobalUsage(&total_usage, &unlimited_usage); |
328 EXPECT_EQ(1 + 16, limited_usage); | 328 EXPECT_EQ(1 + 16, limited_usage); |
329 EXPECT_EQ(1 + 2 + 16 + 32, total_usage); | 329 EXPECT_EQ(1 + 2 + 16 + 32, total_usage); |
330 EXPECT_EQ(2 + 32, unlimited_usage); | 330 EXPECT_EQ(2 + 32, unlimited_usage); |
331 } | 331 } |
332 | 332 |
333 | 333 |
334 } // namespace content | 334 } // namespace content |
OLD | NEW |