| 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 <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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace | 136 } // namespace |
| 137 | 137 |
| 138 class QuotaTemporaryStorageEvictorTest : public testing::Test { | 138 class QuotaTemporaryStorageEvictorTest : public testing::Test { |
| 139 public: | 139 public: |
| 140 QuotaTemporaryStorageEvictorTest() | 140 QuotaTemporaryStorageEvictorTest() |
| 141 : num_get_usage_and_quota_for_eviction_(0), | 141 : num_get_usage_and_quota_for_eviction_(0), |
| 142 weak_factory_(this) {} | 142 weak_factory_(this) {} |
| 143 | 143 |
| 144 virtual void SetUp() { | 144 void SetUp() override { |
| 145 quota_eviction_handler_.reset(new MockQuotaEvictionHandler(this)); | 145 quota_eviction_handler_.reset(new MockQuotaEvictionHandler(this)); |
| 146 | 146 |
| 147 // Run multiple evictions in a single RunUntilIdle() when interval_ms == 0 | 147 // Run multiple evictions in a single RunUntilIdle() when interval_ms == 0 |
| 148 temporary_storage_evictor_.reset(new QuotaTemporaryStorageEvictor( | 148 temporary_storage_evictor_.reset(new QuotaTemporaryStorageEvictor( |
| 149 quota_eviction_handler_.get(), 0)); | 149 quota_eviction_handler_.get(), 0)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 virtual void TearDown() { | 152 void TearDown() override { |
| 153 temporary_storage_evictor_.reset(); | 153 temporary_storage_evictor_.reset(); |
| 154 quota_eviction_handler_.reset(); | 154 quota_eviction_handler_.reset(); |
| 155 base::RunLoop().RunUntilIdle(); | 155 base::RunLoop().RunUntilIdle(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void TaskForRepeatedEvictionTest( | 158 void TaskForRepeatedEvictionTest( |
| 159 const std::pair<GURL, int64>& origin_to_be_added, | 159 const std::pair<GURL, int64>& origin_to_be_added, |
| 160 const GURL& origin_to_be_accessed, | 160 const GURL& origin_to_be_accessed, |
| 161 int expected_usage_after_first, | 161 int expected_usage_after_first, |
| 162 int expected_usage_after_second) { | 162 int expected_usage_after_second) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 EXPECT_EQ(150 + 300, quota_eviction_handler()->GetUsage()); | 403 EXPECT_EQ(150 + 300, quota_eviction_handler()->GetUsage()); |
| 404 | 404 |
| 405 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); | 405 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); |
| 406 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota); | 406 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota); |
| 407 EXPECT_EQ(2, statistics().num_evicted_origins); | 407 EXPECT_EQ(2, statistics().num_evicted_origins); |
| 408 EXPECT_EQ(1, statistics().num_eviction_rounds); | 408 EXPECT_EQ(1, statistics().num_eviction_rounds); |
| 409 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds); | 409 EXPECT_EQ(0, statistics().num_skipped_eviction_rounds); |
| 410 } | 410 } |
| 411 | 411 |
| 412 } // namespace content | 412 } // namespace content |
| OLD | NEW |