Commit 9ebd41fe authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Backport some tests in /components/storage_monitor to SingleThreadTaskEnvironment

These tests were previously migrated from single-threaded MessageLoop to
a multi-threaded TaskEnvironment (then named ScopedTaskEnvironment) as
part of crbug.com/891670.

//base OWNERS decided in retrospect that it was better to keep a
single-threaded option for TaskEnvironment and introduced
SingleThreadTaskEnvironment. This CL retrofits that decision for
/components/storage_monitor.

This CL is a no-op if it passes CQ.

This CL was uploaded by git cl split.

R=tommycli@chromium.org

Bug: 891670
Change-Id: I34456e867324f407da9ea91221db343c7daa6f84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787105
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694574}
parent fd2e5328
...@@ -24,7 +24,7 @@ void SetLatch(bool* called) { ...@@ -24,7 +24,7 @@ void SetLatch(bool* called) {
namespace storage_monitor { namespace storage_monitor {
TEST(StorageMonitorTest, TestInitialize) { TEST(StorageMonitorTest, TestInitialize) {
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
TestStorageMonitor::Destroy(); TestStorageMonitor::Destroy();
TestStorageMonitor monitor; TestStorageMonitor monitor;
EXPECT_FALSE(monitor.init_called()); EXPECT_FALSE(monitor.init_called());
...@@ -39,7 +39,7 @@ TEST(StorageMonitorTest, TestInitialize) { ...@@ -39,7 +39,7 @@ TEST(StorageMonitorTest, TestInitialize) {
TEST(StorageMonitorTest, DeviceAttachDetachNotifications) { TEST(StorageMonitorTest, DeviceAttachDetachNotifications) {
TestStorageMonitor::Destroy(); TestStorageMonitor::Destroy();
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
const std::string kDeviceId1 = "dcim:UUID:FFF0-0001"; const std::string kDeviceId1 = "dcim:UUID:FFF0-0001";
const std::string kDeviceId2 = "dcim:UUID:FFF0-0002"; const std::string kDeviceId2 = "dcim:UUID:FFF0-0002";
MockRemovableStorageObserver observer1; MockRemovableStorageObserver observer1;
...@@ -82,7 +82,7 @@ TEST(StorageMonitorTest, DeviceAttachDetachNotifications) { ...@@ -82,7 +82,7 @@ TEST(StorageMonitorTest, DeviceAttachDetachNotifications) {
TEST(StorageMonitorTest, GetAllAvailableStoragesEmpty) { TEST(StorageMonitorTest, GetAllAvailableStoragesEmpty) {
TestStorageMonitor::Destroy(); TestStorageMonitor::Destroy();
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
TestStorageMonitor monitor; TestStorageMonitor monitor;
std::vector<StorageInfo> devices = monitor.GetAllAvailableStorages(); std::vector<StorageInfo> devices = monitor.GetAllAvailableStorages();
EXPECT_EQ(0U, devices.size()); EXPECT_EQ(0U, devices.size());
...@@ -90,7 +90,7 @@ TEST(StorageMonitorTest, GetAllAvailableStoragesEmpty) { ...@@ -90,7 +90,7 @@ TEST(StorageMonitorTest, GetAllAvailableStoragesEmpty) {
TEST(StorageMonitorTest, GetAllAvailableStorageAttachDetach) { TEST(StorageMonitorTest, GetAllAvailableStorageAttachDetach) {
TestStorageMonitor::Destroy(); TestStorageMonitor::Destroy();
base::test::TaskEnvironment task_environment; base::test::SingleThreadTaskEnvironment task_environment;
TestStorageMonitor monitor; TestStorageMonitor monitor;
const std::string kDeviceId1 = "dcim:UUID:FFF0-0042"; const std::string kDeviceId1 = "dcim:UUID:FFF0-0042";
const base::FilePath kDevicePath1(FILE_PATH_LITERAL("/testfoo")); const base::FilePath kDevicePath1(FILE_PATH_LITERAL("/testfoo"));
......
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