Commit 5cccc44f authored by danakj's avatar danakj Committed by Commit Bot

Avoid RepeatingClosure for the QuitClosure in BookmarkBrowsertest

Since the test uses a RunLoop now instead of MessageLoopRunner, the
Quit action will exit the RunLoop immediately, terminating the timer
and preventing CheckAnimation() from running again. We could pass a
OnceClosure in, but since RunLoop is on the stack, passing a pointer
to it is slightly more straightforward with less indirection.

R=vasilii@chromium.org

Bug: 1030275
Change-Id: I27efc585f8d63f7d9204288b45ed2d4b22b77b43
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1947559Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721547}
parent 6b10d6d5
......@@ -81,20 +81,20 @@ class BookmarkBrowsertest : public InProcessBrowserTest {
return browser()->bookmark_bar_state() == BookmarkBar::SHOW;
}
static void CheckAnimation(Browser* browser, base::RepeatingClosure quit) {
static void CheckAnimation(Browser* browser, base::RunLoop* loop) {
if (!browser->window()->IsBookmarkBarAnimating())
quit.Run();
loop->Quit();
}
base::TimeDelta WaitForBookmarkBarAnimationToFinish() {
base::Time start(base::Time::Now());
base::RunLoop loop;
base::RepeatingTimer timer;
timer.Start(
FROM_HERE, base::TimeDelta::FromMilliseconds(15),
base::BindRepeating(&CheckAnimation, browser(), loop.QuitClosure()));
loop.Run();
{
base::RunLoop loop;
base::RepeatingTimer timer;
timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(15),
base::BindRepeating(&CheckAnimation, browser(), &loop));
loop.Run();
}
return base::Time::Now() - start;
}
......
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