Skip to content

Commit

Permalink
TestMockTimeTaskRunner: Remove just added CHECKs on posts to dead one
Browse files Browse the repository at this point in the history
Turns out these are just too hard to avoid when TestMockTimeTaskRunner
is used in a browser test.

Bug: 860092
Change-Id: I11e3dcfacf073549c56a40eb6840de1df4a52896
Reviewed-on: https://chromium-review.googlesource.com/1127930
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Jacob Dufault <jdufault@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573565}
  • Loading branch information
Maks Orlovich authored and Commit Bot committed Jul 10, 2018
1 parent 5fb8a32 commit d479013
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
19 changes: 12 additions & 7 deletions base/test/test_mock_time_task_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,29 @@ class TestMockTimeTaskRunner::NonOwningProxyTaskRunner
return target_->RunsTasksInCurrentSequence();
return thread_checker_.CalledOnValidThread();
}

bool PostDelayedTask(const Location& from_here,
OnceClosure task,
TimeDelta delay) override {
AutoLock scoped_lock(lock_);
CHECK(target_)
<< "Attempt to post a task on a deleted TestMockTimeTaskRunner";
if (target_)
return target_->PostDelayedTask(from_here, std::move(task), delay);

return target_->PostDelayedTask(from_here, std::move(task), delay);
// The associated TestMockTimeTaskRunner is dead, so fail this PostTask.
return false;
}

bool PostNonNestableDelayedTask(const Location& from_here,
OnceClosure task,
TimeDelta delay) override {
AutoLock scoped_lock(lock_);
CHECK(target_)
<< "Attempt to post a task on a deleted TestMockTimeTaskRunner";
if (target_) {
return target_->PostNonNestableDelayedTask(from_here, std::move(task),
delay);
}

return target_->PostNonNestableDelayedTask(from_here, std::move(task),
delay);
// The associated TestMockTimeTaskRunner is dead, so fail this PostTask.
return false;
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1626,9 +1626,8 @@ IN_PROC_BROWSER_TEST_F(WizardControllerDeviceStateWithInitialEnrollmentTest,
5 /* NotRequiredInEmbargoPeriod*/, 1 /* count */);
}

// Disabled because it's flaky: crbug.com/860092.
IN_PROC_BROWSER_TEST_F(WizardControllerDeviceStateWithInitialEnrollmentTest,
DISABLED_ControlFlowWaitSystemClockSyncTimeout) {
ControlFlowWaitSystemClockSyncTimeout) {
auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>();

base::TestMockTimeTaskRunner::ScopedContext scoped_context(task_runner);
Expand Down

0 comments on commit d479013

Please sign in to comment.