summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index f82c58264..bf68fb048 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -3,6 +3,7 @@
#include "testwindow.h"
#include "quickutil.h"
+#include "util.h"
#include <QScopedPointer>
#include <QtCore/qelapsedtimer.h>
@@ -1295,7 +1296,10 @@ void tst_QQuickWebEngineView::savePage()
const QString filePath = tempDir.path() + "/saved_page.html";
QQuickWebEngineView *view = webEngineView();
- connect(view->profile(), &QQuickWebEngineProfile::downloadRequested,
+ int acceptedCount = 0;
+ int finishedCount = 0;
+ ScopedConnection sc1 = connect(
+ view->profile(), &QQuickWebEngineProfile::downloadRequested,
[&](QQuickWebEngineDownloadRequest *downloadRequest) {
QCOMPARE(downloadRequest->state(),
QQuickWebEngineDownloadRequest::DownloadInProgress);
@@ -1320,8 +1324,9 @@ void tst_QQuickWebEngineView::savePage()
.filePath(downloadRequest->downloadFileName()),
filePath);
QCOMPARE(downloadRequest->url(), view->url());
- QTestEventLoop::instance().exitLoop();
+ finishedCount++;
});
+ acceptedCount++;
});
const QString originalData = QStringLiteral("Basic page");
@@ -1333,7 +1338,8 @@ void tst_QQuickWebEngineView::savePage()
// Save the loaded page as HTML.
view->save(filePath, savePageFormat);
- QTestEventLoop::instance().enterLoop(10);
+ QTRY_COMPARE(acceptedCount, 1);
+ QTRY_COMPARE(finishedCount, 1);
QFile file(filePath);
QVERIFY(file.exists());