Fix flickering test.
(cherry picked from commit 8a648f7eaa885854a98ffe3bb82e1dba42109859)