| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 temporary_storage_evictor()->Start(); | 325 temporary_storage_evictor()->Start(); |
| 326 MessageLoop::current()->RunAllPending(); | 326 MessageLoop::current()->RunAllPending(); |
| 327 EXPECT_EQ(initial_total_size - d_size, | 327 EXPECT_EQ(initial_total_size - d_size, |
| 328 quota_eviction_handler()->GetUsage()); | 328 quota_eviction_handler()->GetUsage()); |
| 329 EXPECT_EQ(4, num_get_usage_and_quota_for_eviction()); | 329 EXPECT_EQ(4, num_get_usage_and_quota_for_eviction()); |
| 330 | 330 |
| 331 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); | 331 EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); |
| 332 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota); | 332 EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota); |
| 333 EXPECT_EQ(1, statistics().num_evicted_origins); | 333 EXPECT_EQ(1, statistics().num_evicted_origins); |
| 334 EXPECT_EQ(3, statistics().num_eviction_rounds); | 334 EXPECT_EQ(3, statistics().num_eviction_rounds); |
| 335 EXPECT_EQ(1, statistics().num_skipped_eviction_rounds); | 335 EXPECT_EQ(2, statistics().num_skipped_eviction_rounds); |
| 336 } | 336 } |
| 337 | 337 |
| 338 TEST_F(QuotaTemporaryStorageEvictorTest, RepeatedEvictionWithAccessOriginTest) { | 338 TEST_F(QuotaTemporaryStorageEvictorTest, RepeatedEvictionWithAccessOriginTest) { |
| 339 const int64 a_size = 400; | 339 const int64 a_size = 400; |
| 340 const int64 b_size = 150; | 340 const int64 b_size = 150; |
| 341 const int64 c_size = 120; | 341 const int64 c_size = 120; |
| 342 const int64 d_size = 292; | 342 const int64 d_size = 292; |
| 343 const int64 initial_total_size = a_size + b_size + c_size + d_size; | 343 const int64 initial_total_size = a_size + b_size + c_size + d_size; |
| 344 const int64 e_size = 275; | 344 const int64 e_size = 275; |
| 345 | 345 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 quota_eviction_handler()->set_available_space(1000000000); | 400 quota_eviction_handler()->set_available_space(1000000000); |
| 401 EXPECT_EQ(3000 + 200 + 500000, quota_eviction_handler()->GetUsage()); | 401 EXPECT_EQ(3000 + 200 + 500000, quota_eviction_handler()->GetUsage()); |
| 402 set_repeated_eviction(false); | 402 set_repeated_eviction(false); |
| 403 temporary_storage_evictor()->Start(); | 403 temporary_storage_evictor()->Start(); |
| 404 MessageLoop::current()->RunAllPending(); | 404 MessageLoop::current()->RunAllPending(); |
| 405 // Nothing should have been evicted. | 405 // Nothing should have been evicted. |
| 406 EXPECT_EQ(3000 + 200 + 500000, quota_eviction_handler()->GetUsage()); | 406 EXPECT_EQ(3000 + 200 + 500000, quota_eviction_handler()->GetUsage()); |
| 407 } | 407 } |
| 408 | 408 |
| 409 } // namespace quota | 409 } // namespace quota |
| OLD | NEW |