14
14
property var latestCookies
15
15
property string latestMimeType: ""
16
16
property string latestReferrer: ""
17
property string latestUserAgent: ""
19
context.userAgentOverrideDelegate: WebContextDelegateWorker {
20
source: Qt.resolvedUrl("tst_WebView_downloadRequested.js");
18
23
onDownloadRequested: {
19
24
latestDownloadUrl = request.url;
21
26
latestMimeType = request.mimeType;
22
27
latestSuggestedFilename = request.suggestedFilename;
23
28
latestReferrer = request.referrer;
29
latestUserAgent = request.userAgent;
32
function cleanLatestData() {
33
latestDownloadUrl = "";
36
latestSuggestedFilename = "";
48
64
compare(webView.latestSuggestedFilename, "001.html")
67
function test_WebView_downloadRequestWithContentDispositionWithUserAgentOverride() {
68
webView.url = "http://testsuite/tst_WebView_downloadRequested.py?override"
69
verify(webView.waitForLoadStopped(),
70
"Timed out waiting for a successful load");
73
compare(webView.latestMimeType, "text/html")
74
compare(webView.latestCookies, "foo=bar, bar=bazz")
75
compare(webView.latestSuggestedFilename, "001.html")
76
compare(webView.latestUserAgent, "Override download user agent string");
79
function test_WebView_downloadAnchorRequest() {
80
webView.url = "http://testsuite/tst_WebView_downloadRequestedAnchor.html"
81
verify(webView.waitForLoadSucceeded(),
82
"Timed out waiting for a successful load");
84
var r = webView.getTestApi().getBoundingClientRectForSelector("#content");
85
mouseClick(webView, r.x + r.width / 2, r.y + r.height / 2, Qt.LeftButton);
89
compare(webView.latestSuggestedFilename, "MyDownload")
51
92
function test_WebView_downloadRequestUnhandledMimeType() {
52
93
webView.url = "http://testsuite/tst_WebView_downloadRequestedUnhandledMimeType.py"
53
94
verify(webView.waitForLoadStopped(),