Commit cfb85619 authored by Becca Hughes's avatar Becca Hughes Committed by Commit Bot

[Media History] Deflake browser test

Deflake the browser test by using wait for db.

BUG=1052605,1058563

Change-Id: Iba71c6a5b6c1145f777d028ded4638b404434b44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2122614Reviewed-by: default avatarTommy Steimel <steimel@chromium.org>
Commit-Queue: Becca Hughes <beccahughes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753759}
parent 60d10623
...@@ -276,7 +276,7 @@ class MediaHistoryBrowserTest : public InProcessBrowserTest, ...@@ -276,7 +276,7 @@ class MediaHistoryBrowserTest : public InProcessBrowserTest,
ui_test_utils::NavigateToURL(browser, embedded_test_server()->base_url()); ui_test_utils::NavigateToURL(browser, embedded_test_server()->base_url());
// Wait until the session has finished saving. // Wait until the session has finished saving.
content::RunAllTasksUntilIdle(); WaitForDB(GetMediaHistoryService(browser));
} }
const GURL GetTestURL() const { const GURL GetTestURL() const {
...@@ -301,6 +301,12 @@ class MediaHistoryBrowserTest : public InProcessBrowserTest, ...@@ -301,6 +301,12 @@ class MediaHistoryBrowserTest : public InProcessBrowserTest,
browser->profile()->GetOffTheRecordProfile()); browser->profile()->GetOffTheRecordProfile());
} }
static void WaitForDB(MediaHistoryKeyedService* service) {
base::RunLoop run_loop;
service->PostTaskToDBForTest(run_loop.QuitClosure());
run_loop.Run();
}
Browser* CreateBrowserFromParam() { Browser* CreateBrowserFromParam() {
if (GetParam() == TestState::kIncognito) { if (GetParam() == TestState::kIncognito) {
return CreateIncognitoBrowser(); return CreateIncognitoBrowser();
......
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