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

Use ScopedTaskEnvironment instead of MessageLoopForUI in /ios/chrome/browser/ui/settings

MessageLoopForUI will go away, eventually.

ScopedTaskEnvironment will per default start a ThreadPool, which should
be fine in most of the cases. If you believe 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=sczs@chromium.org

Change-Id: Icff05dbcd5ffbea9419cd257203d739e5eb226f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1718026
Auto-Submit: Carlos Caballero <carlscab@google.com>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681897}
parent 675dd76b
......@@ -9,7 +9,7 @@
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/test/scoped_task_environment.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/sync_preferences/pref_service_mock_factory.h"
......@@ -57,7 +57,8 @@ class DataplanUsageTableViewControllerTest
sync_preferences::PrefServiceMockFactory factory;
base::FilePath path("DataplanUsageTableViewControllerTest.pref");
factory.SetUserPrefsFile(path, message_loop_.task_runner().get());
factory.SetUserPrefsFile(
path, scoped_task_environment_.GetMainThreadTaskRunner().get());
return factory.Create(registry.get());
}
......@@ -70,7 +71,8 @@ class DataplanUsageTableViewControllerTest
EXPECT_EQ(accessory_type, cell.accessoryType);
}
base::MessageLoopForUI message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_{
base::test::ScopedTaskEnvironment::MainThreadType::UI};
std::unique_ptr<PrefService> pref_service_;
DataplanUsageTableViewController* dataplanController_;
};
......
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