5f565a3ccbeee675806848e3b580b7a70d94473a
[WebKit.git] / Source / WebKit2 / UIProcess / API / qt / tests / qmltests / WebView / tst_loadFail.qml
1 import QtQuick 2.0
2 import QtTest 1.0
3 import QtWebKit 3.0
4
5 WebView {
6     id: webView
7     width: 400
8     height: 300
9
10     property variant testUrl
11
12     SignalSpy {
13         id: spy
14         target: webView
15         signalName: "loadFailed"
16     }
17
18     TestCase {
19         id: test
20         name: "WebViewLoadFail"
21         function test_fail() {
22             compare(spy.count, 0)
23             testUrl = Qt.resolvedUrl("file_that_does_not_exist.html")
24             webView.load(testUrl)
25             spy.wait()
26             compare(spy.count, 1)
27         }
28     }
29
30     onLoadFailed: {
31         test.compare(url, testUrl)
32         test.compare(errorCode, NetworkReply.ContentNotFoundError)
33         test.compare(errorType, WebView.NetworkError)
34     }
35 }