Changeset 102959 in webkit
- Timestamp:
- Dec 15, 2011 10:39:51 AM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r102954 r102959 1 2011-12-15 Rafael Brandao <rafael.lobo@openbossa.org> 2 3 [Qt][WK2] Add test for download policy on navigation request 4 https://bugs.webkit.org/show_bug.cgi?id=74541 5 6 Reviewed by Tor Arne Vestbø. 7 8 * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml: 9 * UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml: Make it wait for a 10 downloadFinished signal to finish the test. 11 1 12 2011-12-15 Anders Carlsson <andersca@apple.com> 2 13 -
trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml
r101162 r102959 4 4 5 5 Item { 6 property int expectedLength: 0 7 property int totalBytes: 0 8 property bool shouldDownload: false 9 6 10 DesktopWebView { 7 11 id: webView 8 12 width: 200 9 13 height: 200 14 15 signal downloadFinished() 16 10 17 onNavigationRequested: { 11 if (request.button == Qt.MiddleButton && request.modifiers & Qt.ControlModifier) { 18 if (shouldDownload) 19 request.action = WebView.DownloadRequest 20 else if (request.button == Qt.MiddleButton && request.modifiers & Qt.ControlModifier) { 12 21 otherWebView.load(request.url) 13 22 request.action = WebView.IgnoreRequest 23 } 24 } 25 26 experimental.onDownloadRequested: { 27 download.target = downloadItem 28 expectedLength = downloadItem.expectedContentLength 29 downloadItem.destinationPath = downloadItem.suggestedFilename 30 downloadItem.start() 31 } 32 33 Connections { 34 id: download 35 ignoreUnknownSignals: true 36 onSucceeded: { 37 totalBytes = download.target.totalBytesReceived 38 webView.downloadFinished() 14 39 } 15 40 } … … 32 57 } 33 58 59 SignalSpy { 60 id: downloadSpy 61 target: webView.experimental 62 signalName: "downloadRequested" 63 } 64 65 SignalSpy { 66 id: downloadFinishedSpy 67 target: webView 68 signalName: "downloadFinished" 69 } 70 34 71 TestCase { 35 72 name: "DesktopWebViewNavigationRequested" … … 42 79 interval: 1 43 80 onTriggered: parent.when = true 81 } 82 83 function init() { 84 spy.clear() 85 otherSpy.clear() 86 downloadSpy.clear() 87 downloadFinishedSpy.clear() 88 shouldDownload = false 44 89 } 45 90 … … 66 111 compare(otherWebView.title, "Test page 1") 67 112 } 113 114 function test_downloadPolicy() { 115 webView.load(Qt.resolvedUrl("../common/test2.html")) 116 spy.wait() 117 spy.clear() 118 compare(spy.count, 0) 119 downloadSpy.clear() 120 downloadFinishedSpy.clear() 121 expectedLength = 0 122 shouldDownload = true 123 mouseClick(webView, 100, 100, Qt.LeftButton) 124 downloadSpy.wait() 125 compare(downloadSpy.count, 1) 126 downloadFinishedSpy.wait() 127 compare(downloadFinishedSpy.count, 1) 128 compare(totalBytes, expectedLength) 129 } 68 130 } 69 131 } -
trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml
r101103 r102959 10 10 11 11 property int expectedLength: 0 12 property bool downloadFinished: false13 12 property int totalBytes: 0 13 14 signal downloadFinished() 14 15 15 16 SignalSpy { … … 17 18 target: experimental 18 19 signalName: "downloadRequested" 20 } 21 22 SignalSpy { 23 id: downloadFinishedSpy 24 target: webView 25 signalName: "downloadFinished" 19 26 } 20 27 … … 30 37 ignoreUnknownSignals: true 31 38 onSucceeded: { 32 downloadFinished = true33 39 totalBytes = download.target.totalBytesReceived 40 webView.downloadFinished() 34 41 } 35 42 } … … 49 56 function init() { 50 57 spy.clear() 58 downloadFinishedSpy.clear() 51 59 expectedLength = 0 52 downloadFinished = false53 60 } 54 61 … … 73 80 spy.wait() 74 81 compare(spy.count, 1) 75 verify(downloadFinished)82 downloadFinishedSpy.wait() 76 83 compare(totalBytes, expectedLength) 77 84 }
Note: See TracChangeset
for help on using the changeset viewer.