| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // Note that this file only tests the basic behavior of the cache counter, as in | 5 // Note that this file only tests the basic behavior of the cache counter, as in |
| 6 // when it counts and when not, when result is nonzero and when not. It does not | 6 // when it counts and when not, when result is nonzero and when not. It does not |
| 7 // test whether the result of the counting is correct. This is the | 7 // test whether the result of the counting is correct. This is the |
| 8 // responsibility of a lower layer, and is tested in | 8 // responsibility of a lower layer, and is tested in |
| 9 // DiskCacheBackendTest.CalculateSizeOfAllEntries in net_unittests. | 9 // DiskCacheBackendTest.CalculateSizeOfAllEntries in net_unittests. |
| 10 | 10 |
| 11 #include "ios/chrome/browser/browsing_data/cache_counter.h" | 11 #include "ios/chrome/browser/browsing_data/cache_counter.h" |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "components/browsing_data/core/browsing_data_utils.h" | 17 #include "components/browsing_data/core/browsing_data_utils.h" |
| 18 #include "components/browsing_data/core/pref_names.h" | 18 #include "components/browsing_data/core/pref_names.h" |
| 19 #include "components/prefs/pref_registry_simple.h" | 19 #include "components/prefs/pref_registry_simple.h" |
| 20 #include "components/prefs/testing_pref_service.h" | 20 #include "components/prefs/testing_pref_service.h" |
| 21 #include "ios/web/public/test/test_browser_state.h" | 21 #include "ios/web/public/test/fakes/test_browser_state.h" |
| 22 #include "ios/web/public/test/test_web_thread_bundle.h" | 22 #include "ios/web/public/test/test_web_thread_bundle.h" |
| 23 #include "ios/web/public/web_thread.h" | 23 #include "ios/web/public/web_thread.h" |
| 24 #include "net/disk_cache/disk_cache.h" | 24 #include "net/disk_cache/disk_cache.h" |
| 25 #include "net/http/http_cache.h" | 25 #include "net/http/http_cache.h" |
| 26 #include "net/http/http_transaction_factory.h" | 26 #include "net/http/http_transaction_factory.h" |
| 27 #include "net/url_request/url_request_context.h" | 27 #include "net/url_request/url_request_context.h" |
| 28 #include "net/url_request/url_request_context_getter.h" | 28 #include "net/url_request/url_request_context_getter.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 SetDeletionPeriodPref(browsing_data::FOUR_WEEKS); | 317 SetDeletionPeriodPref(browsing_data::FOUR_WEEKS); |
| 318 WaitForIOThread(); | 318 WaitForIOThread(); |
| 319 EXPECT_EQ(result, GetResult()); | 319 EXPECT_EQ(result, GetResult()); |
| 320 | 320 |
| 321 SetDeletionPeriodPref(browsing_data::ALL_TIME); | 321 SetDeletionPeriodPref(browsing_data::ALL_TIME); |
| 322 WaitForIOThread(); | 322 WaitForIOThread(); |
| 323 EXPECT_EQ(result, GetResult()); | 323 EXPECT_EQ(result, GetResult()); |
| 324 } | 324 } |
| 325 | 325 |
| 326 } // namespace | 326 } // namespace |
| OLD | NEW |