Commit 04979ddd authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa Committed by Commit Bot

Stop using std::unique_ptr for PlatformSensorAndProviderLinuxTest::disallow_blocking_

This fixes a TODO item I added for myself back in commit dd9b04ee ("sensors:
Remove bogus DCHECK from SensorReader::Create()").

Commit 9d8348e5 ("sensors: Clean up sequence, task and thread handling in
the Linux implementation") got rid of PlatformSensorProviderLinux's polling
thread altogether, so we can finally make |disallow_blocking_| a regular
member variable that is used for the entirety of
PlatformSensorAndProviderLinuxTest's lifetime.

Change-Id: Ic78bc2d4d2ad64ea4be7a2e2cf39315a87d96e9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1546102
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646403}
parent 18e6a17f
......@@ -149,21 +149,17 @@ class PlatformSensorAndProviderLinuxTest : public ::testing::Test {
manager_ = manager.get();
provider_->SetSensorDeviceManagerForTesting(std::move(manager));
ASSERT_TRUE(sensors_dir_.CreateUniqueTempDir());
disallow_blocking_.reset(new base::ScopedDisallowBlocking);
{
base::ScopedAllowBlockingForTesting allow_blocking;
ASSERT_TRUE(sensors_dir_.CreateUniqueTempDir());
}
}
void TearDown() override {
// TODO(rakuco): It should be possible to make |disallow_blocking_| a
// regular, non-std::unique_ptr member once we port
// PlatformSensorProviderLinux and accompanying APIs to base::PostTask().
// At the moment we need to turn |disallow_blocking_| off here because
// stopping PlatformSensorProviderLinux's polling thread is a blocking
// operation.
disallow_blocking_.reset(nullptr);
ASSERT_TRUE(sensors_dir_.Delete());
{
base::ScopedAllowBlockingForTesting allow_blocking;
ASSERT_TRUE(sensors_dir_.Delete());
}
base::RunLoop().RunUntilIdle();
}
......@@ -322,7 +318,7 @@ class PlatformSensorAndProviderLinuxTest : public ::testing::Test {
// Used to simulate the non-test scenario where we're running in an IO thread
// that forbids blocking operations.
std::unique_ptr<base::ScopedDisallowBlocking> disallow_blocking_;
base::ScopedDisallowBlocking disallow_blocking_;
};
// Tests sensor is not returned if not implemented.
......
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