DescriptionDeflake Mac views_unittest's MenuRunnerCocoaTest.RunMenuAndCancel
The test occasionally fails with
menu_runner_cocoa_unittest.mm:182: Failure
Expected: (runner_->GetClosingEventTime())
<= (ui::EventTimeForNow() - base::TimeTicks())),
actual: 13647.4s vs 0.002s
It happens because menu_runner_impl_cocoa.mm uses
base::TimeTicks::Now(), but the test uses ui::EventTimeForNow() to set
expectations. Usually this isn't a problem, but if another unit test in
the same process has created a ui::EventGenerator, this sets a mock time
source with ui::SetEventTickClockForTesting(..) which isn't cleared when
the EventGenerator is destroyed.
Fix both problems. The EventGenerator destructor should reset the global
state it created, and menu_runner_impl_cocoa.mm should use
ui::EventTimeForNow() for better consistency.
BUG=623455, 624555
Committed: https://crrev.com/80f15fe17e9095bd4d6c11d94db8e1dd42556458
Cr-Commit-Position: refs/heads/master@{#403373}
Patch Set 1 #
Total comments: 1
Patch Set 2 : Clear ui::EventGenerator global state #Patch Set 3 : rebase #Patch Set 4 : rebase #Patch Set 5 : Lint #
Messages
Total messages: 13 (7 generated)
|