Chromium Code Reviews| Index: net/disk_cache/disk_cache_test_base.cc |
| diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc |
| index 0776572622edd66caffce95efebce91f55bcfbe0..9b6b0edb01e0034c7a2dab669f3505809c85d343 100644 |
| --- a/net/disk_cache/disk_cache_test_base.cc |
| +++ b/net/disk_cache/disk_cache_test_base.cc |
| @@ -8,9 +8,13 @@ |
| #include "base/files/file_util.h" |
| #include "base/message_loop/message_loop.h" |
| +#include "base/metrics/field_trial.h" |
| +#include "base/metrics/field_trial_param_associator.h" |
| #include "base/path_service.h" |
| #include "base/run_loop.h" |
| #include "base/single_thread_task_runner.h" |
| +#include "base/test/mock_entropy_provider.h" |
| +#include "base/test/scoped_feature_list.h" |
| #include "base/threading/platform_thread.h" |
| #include "base/threading/thread_task_runner_handle.h" |
| #include "net/base/io_buffer.h" |
| @@ -22,6 +26,7 @@ |
| #include "net/disk_cache/disk_cache_test_util.h" |
| #include "net/disk_cache/memory/mem_backend_impl.h" |
| #include "net/disk_cache/simple/simple_backend_impl.h" |
| +#include "net/disk_cache/simple/simple_experiment.h" |
| #include "net/disk_cache/simple/simple_index.h" |
| #include "net/test/gtest_util.h" |
| #include "testing/gmock/include/gmock/gmock.h" |
| @@ -87,6 +92,21 @@ DiskCacheTestWithCache::DiskCacheTestWithCache() |
| integrity_(true), |
| use_current_thread_(false), |
| cache_thread_("CacheThread") { |
| + // Make sure to cover the prefetch path in SimpleCache. |
|
pasko
2017/07/18 14:02:56
doing work in constructors is generally discourage
morlovich
2017/07/18 14:32:31
Any keyword to search for/pointer for that mechani
pasko
2017/07/19 16:28:26
go/finch101 and search for "testing-config", but
Maks Orlovich
2017/07/25 16:06:29
Removed this from here (and added for the dedicate
|
| + field_trial_list_ = base::MakeUnique<base::FieldTrialList>( |
| + base::MakeUnique<base::MockEntropyProvider>()); |
| + scoped_refptr<base::FieldTrial> trial = |
| + base::FieldTrialList::CreateFieldTrial("UnitTest", "Group"); |
| + std::map<std::string, std::string> params; |
| + params[disk_cache::kSimplePrefetchBytesParam] = "32768"; |
| + base::FieldTrialParamAssociator::GetInstance()->AssociateFieldTrialParams( |
| + "UnitTest", "Group", params); |
| + |
| + std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| + feature_list->RegisterFieldTrialOverride( |
| + disk_cache::kSimpleCachePrefetchExperiment.name, |
| + base::FeatureList::OVERRIDE_ENABLE_FEATURE, trial.get()); |
| + scoped_feature_list_.InitWithFeatureList(std::move(feature_list)); |
| } |
| DiskCacheTestWithCache::~DiskCacheTestWithCache() {} |