Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Unified Diff: components/sync/device_info/device_info_data_type_controller_unittest.cc

Issue 2846723005: Use ScopedTaskEnvironment instead of MessageLoopForUI in components tests. (Closed)
Patch Set: fix-test-errors Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync/device_info/device_info_data_type_controller_unittest.cc
diff --git a/components/sync/device_info/device_info_data_type_controller_unittest.cc b/components/sync/device_info/device_info_data_type_controller_unittest.cc
index 27c572f20ec7102e44e9bb3685135b2e7da8c1f3..b519f5c534b5d69a62f64ad6b666b2d0cdc1a11b 100644
--- a/components/sync/device_info/device_info_data_type_controller_unittest.cc
+++ b/components/sync/device_info/device_info_data_type_controller_unittest.cc
@@ -9,6 +9,7 @@
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
+#include "base/test/scoped_task_environment.h"
#include "base/threading/thread_task_runner_handle.h"
#include "components/sync/base/model_type.h"
#include "components/sync/device_info/local_device_info_provider_mock.h"
@@ -23,7 +24,9 @@ namespace {
class DeviceInfoDataTypeControllerTest : public testing::Test {
public:
DeviceInfoDataTypeControllerTest()
- : load_finished_(false),
+ : scoped_task_environment_(
+ base::test::ScopedTaskEnvironment::MainThreadType::UI),
+ load_finished_(false),
last_type_(UNSPECIFIED),
weak_ptr_factory_(this) {}
~DeviceInfoDataTypeControllerTest() override {}
@@ -78,13 +81,15 @@ class DeviceInfoDataTypeControllerTest : public testing::Test {
return testing::AssertionSuccess();
}
+ private:
+ base::test::ScopedTaskEnvironment scoped_task_environment_;
+
protected:
std::unique_ptr<DeviceInfoDataTypeController> controller_;
std::unique_ptr<LocalDeviceInfoProviderMock> local_device_;
bool load_finished_;
private:
- base::MessageLoopForUI message_loop_;
ModelType last_type_;
SyncError last_error_;
FakeSyncClient sync_client_;
« no previous file with comments | « components/rappor/log_uploader_unittest.cc ('k') | components/sync/driver/async_directory_type_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698