summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-12-08 18:49:34 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-12-10 09:59:35 +0000
commita736ef46564ca88a96370f1ac41b7f4b82cb2462 (patch)
tree0882f0a24eef6a6322a6bcd3dcaa0ef9ec825cbd
parent04b30d974aee4fc556249b1bfa62c7cb79b839c5 (diff)
Stabilize tst_download.qml
Connect to WebEngineViewDownloadItem.stateChanged to collect state changes. This makes sure that state changes from tests that ran before do not interfere with the current test. Change-Id: I360ac325711bf041f82375b3714a9cfe7a42398c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
-rw-r--r--tests/auto/quick/qmltests/data/tst_download.qml12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_download.qml b/tests/auto/quick/qmltests/data/tst_download.qml
index ffd7041e3..415318ed7 100644
--- a/tests/auto/quick/qmltests/data/tst_download.qml
+++ b/tests/auto/quick/qmltests/data/tst_download.qml
@@ -66,23 +66,26 @@ TestWebEngineView {
signalName: "downloadFinished"
}
+ Connections {
+ id: downloadItemConnections
+ onStateChanged: downloadState.push(target.state)
+ }
+
WebEngineProfile {
id: testDownloadProfile
onDownloadRequested: {
downloadState.push(download.state)
+ downloadItemConnections.target = download
if (cancelDownload) {
download.cancel()
- downloadState.push(download.state)
} else {
totalBytes = download.totalBytes
download.path = "testfile.zip"
download.accept()
- downloadState.push(download.state)
}
}
onDownloadFinished: {
- downloadState.push(download.state)
receivedBytes = download.receivedBytes;
}
}
@@ -96,6 +99,7 @@ TestWebEngineView {
totalBytes = 0
receivedBytes = 0
cancelDownload = false
+ downloadItemConnections.target = null
downloadState = []
}
@@ -133,7 +137,7 @@ TestWebEngineView {
downLoadRequestedSpy.wait()
compare(downLoadRequestedSpy.count, 1)
compare(downloadFinishedSpy.count, 1)
- compare(downloadState[2], WebEngineDownloadItem.DownloadCancelled)
+ compare(downloadState[1], WebEngineDownloadItem.DownloadCancelled)
}
}
}