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 <list> | 5 #include <list> |
6 #include <map> | 6 #include <map> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 base::Closure task_for_get_usage_and_quota_; | 137 base::Closure task_for_get_usage_and_quota_; |
138 }; | 138 }; |
139 | 139 |
140 } // anonymous namespace | 140 } // anonymous namespace |
141 | 141 |
142 class QuotaTemporaryStorageEvictorTest : public testing::Test { | 142 class QuotaTemporaryStorageEvictorTest : public testing::Test { |
143 public: | 143 public: |
144 QuotaTemporaryStorageEvictorTest() | 144 QuotaTemporaryStorageEvictorTest() |
145 : num_get_usage_and_quota_for_eviction_(0), | 145 : num_get_usage_and_quota_for_eviction_(0), |
146 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} | 146 weak_factory_(this) {} |
147 | 147 |
148 virtual void SetUp() { | 148 virtual void SetUp() { |
149 quota_eviction_handler_.reset(new MockQuotaEvictionHandler(this)); | 149 quota_eviction_handler_.reset(new MockQuotaEvictionHandler(this)); |
150 | 150 |
151 // Run multiple evictions in a single RunUntilIdle() when interval_ms == 0 | 151 // Run multiple evictions in a single RunUntilIdle() when interval_ms == 0 |
152 temporary_storage_evictor_.reset(new QuotaTemporaryStorageEvictor( | 152 temporary_storage_evictor_.reset(new QuotaTemporaryStorageEvictor( |
153 quota_eviction_handler_.get(), 0)); | 153 quota_eviction_handler_.get(), 0)); |
154 } | 154 } |
155 | 155 |
156 virtual void TearDown() { | 156 virtual void TearDown() { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 quota_eviction_handler()->set_available_space(1000000000); | 423 quota_eviction_handler()->set_available_space(1000000000); |
424 EXPECT_EQ(3000 + 200 + 500000, quota_eviction_handler()->GetUsage()); | 424 EXPECT_EQ(3000 + 200 + 500000, quota_eviction_handler()->GetUsage()); |
425 set_repeated_eviction(false); | 425 set_repeated_eviction(false); |
426 temporary_storage_evictor()->Start(); | 426 temporary_storage_evictor()->Start(); |
427 MessageLoop::current()->RunUntilIdle(); | 427 MessageLoop::current()->RunUntilIdle(); |
428 // Nothing should have been evicted. | 428 // Nothing should have been evicted. |
429 EXPECT_EQ(3000 + 200 + 500000, quota_eviction_handler()->GetUsage()); | 429 EXPECT_EQ(3000 + 200 + 500000, quota_eviction_handler()->GetUsage()); |
430 } | 430 } |
431 | 431 |
432 } // namespace quota | 432 } // namespace quota |
OLD | NEW |