Commit ed85a7b6 authored by Carlos Caballero's avatar Carlos Caballero Committed by Commit Bot

Use ScopedTaskEnvironment instead of MessageLoop

MessageLoop will go away, eventually.

ScopedTaskEnvironment will per default start a ThreadPool, which should
be fine in most of the cases. If you belive your test needs to make sure
that no ThreadPool runs let me know and I will update the patch.

BUG=891670
This CL was uploaded by git cl split.

R=sammc@chromium.org

Change-Id: I4b3b1b6e59ca65ecdce281818234353955e5ff78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1636352Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Commit-Queue: Sam McNally <sammc@chromium.org>
Auto-Submit: Carlos Caballero <carlscab@google.com>
Cr-Commit-Position: refs/heads/master@{#664706}
parent af98fe51
......@@ -7,8 +7,8 @@
#include <utility>
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "base/values.h"
#include "components/prefs/in_memory_pref_store.h"
#include "mojo/public/cpp/bindings/binding_set.h"
......@@ -73,7 +73,7 @@ class PersistentPrefStoreImplTest : public testing::Test {
PersistentPrefStore* pref_store() { return pref_store_.get(); }
private:
base::MessageLoop message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_;
std::unique_ptr<PersistentPrefStoreImpl> impl_;
......
......@@ -8,8 +8,8 @@
#include "base/bind_helpers.h"
#include "base/containers/circular_deque.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "base/values.h"
#include "components/prefs/in_memory_pref_store.h"
#include "components/prefs/pref_notifier_impl.h"
......@@ -202,7 +202,7 @@ class PersistentPrefStoreConsistencyTest : public testing::Test {
private:
scoped_refptr<PersistentPrefStore> pref_store_;
std::unique_ptr<PersistentPrefStoreImpl> pref_store_impl_;
base::MessageLoop message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_;
};
TEST_F(PersistentPrefStoreConsistencyTest, TwoPrefs) {
......
......@@ -7,8 +7,8 @@
#include <utility>
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "base/values.h"
#include "components/prefs/value_map_pref_store.h"
#include "mojo/public/cpp/bindings/binding_set.h"
......@@ -102,7 +102,7 @@ class PrefStoreImplTest : public testing::Test {
PrefStore* pref_store() { return pref_store_.get(); }
private:
base::MessageLoop message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_;
std::unique_ptr<PrefStoreImpl> impl_;
......
......@@ -9,8 +9,8 @@
#include "base/bind_helpers.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/values.h"
#include "components/prefs/pref_notifier_impl.h"
......@@ -102,7 +102,7 @@ class PersistentPrefStoreClientTest : public testing::Test,
void ClearMutableValues() override {}
void OnStoreDeletionFromDisk() override {}
base::MessageLoop message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_;
std::unique_ptr<PrefService> pref_service_;
......
......@@ -5,8 +5,8 @@
#include "services/preferences/public/cpp/pref_store_client.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "base/values.h"
#include "services/preferences/public/mojom/preferences.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
......@@ -66,7 +66,7 @@ class PrefStoreClientTest : public testing::Test {
scoped_refptr<PrefStoreClient> store_;
// Required by mojo binding code within PrefStoreClient.
base::MessageLoop message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_;
DISALLOW_COPY_AND_ASSIGN(PrefStoreClientTest);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment