Commit e7e22942 authored by Wez's avatar Wez Committed by Commit Bot

Tweak ScopedTaskEnvironmentTest comments as per code-review requests.

Bug: 789712
TBR: gab
Change-Id: I16e059c18420a56e875c5564015531177bc213d3
Reviewed-on: https://chromium-review.googlesource.com/806815Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521434}
parent 917efa03
...@@ -136,6 +136,8 @@ TEST_P(ScopedTaskEnvironmentTest, ...@@ -136,6 +136,8 @@ TEST_P(ScopedTaskEnvironmentTest,
} }
TEST_P(ScopedTaskEnvironmentTest, DelayedTasks) { TEST_P(ScopedTaskEnvironmentTest, DelayedTasks) {
// Use a QUEUED execution-mode environment, so that no tasks are actually
// executed until RunUntilIdle()/FastForwardBy() are invoked.
ScopedTaskEnvironment scoped_task_environment( ScopedTaskEnvironment scoped_task_environment(
GetParam(), ScopedTaskEnvironment::ExecutionMode::QUEUED); GetParam(), ScopedTaskEnvironment::ExecutionMode::QUEUED);
...@@ -191,11 +193,8 @@ TEST_P(ScopedTaskEnvironmentTest, DelayedTasks) { ...@@ -191,11 +193,8 @@ TEST_P(ScopedTaskEnvironmentTest, DelayedTasks) {
}, },
Unretained(&counter))); Unretained(&counter)));
// Verify that tasks are not being processed asynchronously. Since scheduling // This expectation will fail flakily if the preceding PostTask() is executed
// is non-deterministic, we pause the main thread momentarily, to increase // asynchronously, indicating a problem with the QUEUED execution mode.
// the likelihood of the preceding PostTask() being run.
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10));
int expected_value = 0; int expected_value = 0;
EXPECT_EQ(expected_value, counter); EXPECT_EQ(expected_value, counter);
......
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