From d1d2d6a532b44f8d58af68e600b3df68a87b84e0 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 26 Jun 2023 13:48:34 +0300 Subject: [PATCH] tests: Fix timing issue with DownloadTest.ClickedInvalid --- tests/ceftests/download_unittest.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/ceftests/download_unittest.cc b/tests/ceftests/download_unittest.cc index cfa85c2a9..50028ac4f 100644 --- a/tests/ceftests/download_unittest.cc +++ b/tests/ceftests/download_unittest.cc @@ -274,14 +274,6 @@ class DownloadTestHandler : public TestHandler { // ALT key will trigger download of custom protocol links. SendClick(browser, test_mode_ == CLICKED_INVALID ? EVENTFLAG_ALT_DOWN : 0); - - if (is_clicked() && !is_clicked_and_downloaded()) { - // Destroy the test after a bit because there will be no further - // callbacks. - CefPostDelayedTask( - TID_UI, base::BindOnce(&DownloadTestHandler::DestroyTest, this), - 200); - } } else { // Begin the download progammatically. browser->GetHost()->StartDownload(kTestDownloadUrl); @@ -339,6 +331,13 @@ class DownloadTestHandler : public TestHandler { EXPECT_STREQ(download_url_.c_str(), url.ToString().c_str()); EXPECT_STREQ("GET", request_method.ToString().c_str()); + if (is_clicked() && !is_clicked_and_downloaded()) { + // Destroy the test after a bit because there will be no further + // callbacks. + CefPostDelayedTask( + TID_UI, base::BindOnce(&DownloadTestHandler::DestroyTest, this), 200); + } + return test_mode_ != CLICKED_BLOCKED; }