Eliminate task runner injection from the configurator.
The new task scheduler API makes it possible to simplify the
configurator and avoid injecting task runners.
Bug: 740992
Change-Id: Iaabdc498993745372cee47193f16f1df4d09f7a2
Reviewed-on: https://chromium-review.googlesource.com/582030
Reviewed-by: David Roger <[email protected]>
Reviewed-by: Joshua Pawlicki <[email protected]>
Reviewed-by: Devlin <[email protected]>
Commit-Queue: Sorin Jianu <[email protected]>
Cr-Commit-Position: refs/heads/master@{#489528}
diff --git a/components/update_client/update_client_unittest.cc b/components/update_client/update_client_unittest.cc
index fca7137..05b872f 100644
--- a/components/update_client/update_client_unittest.cc
+++ b/components/update_client/update_client_unittest.cc
@@ -172,10 +172,12 @@
base::test::ScopedTaskEnvironment scoped_task_environment_;
base::RunLoop runloop_;
- base::Closure quit_closure_;
+ const base::Closure quit_closure_ = runloop_.QuitClosure();
- scoped_refptr<update_client::TestConfigurator> config_;
- std::unique_ptr<TestingPrefServiceSimple> pref_;
+ scoped_refptr<update_client::TestConfigurator> config_ =
+ base::MakeRefCounted<TestConfigurator>();
+ std::unique_ptr<TestingPrefServiceSimple> pref_ =
+ base::MakeUnique<TestingPrefServiceSimple>();
std::unique_ptr<update_client::PersistedData> metadata_;
DISALLOW_COPY_AND_ASSIGN(UpdateClientTest);
@@ -183,15 +185,7 @@
constexpr int UpdateClientTest::kNumWorkerThreads_;
-UpdateClientTest::UpdateClientTest()
- : scoped_task_environment_(
- base::test::ScopedTaskEnvironment::MainThreadType::UI),
- pref_(base::MakeUnique<TestingPrefServiceSimple>()) {
- quit_closure_ = runloop_.QuitClosure();
-
- config_ = base::MakeRefCounted<TestConfigurator>(
- base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()}),
- base::ThreadTaskRunnerHandle::Get());
+UpdateClientTest::UpdateClientTest() {
PersistedData::RegisterPrefs(pref_->registry());
metadata_ = base::MakeUnique<PersistedData>(pref_.get());
}