28dcbd4662d82fff3dcc22cd7d98de1de50e973d
[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
8     property variant testUrl
9
10     SignalSpy {
11         id: spy
12         target: webView
13         signalName: "loadFailed"
14     }
15
16     TestCase {
17         id: test
18         name: "WebViewLoadFail"
19         function test_fail() {
20             compare(spy.count, 0)
21             testUrl = Qt.resolvedUrl("file_that_does_not_exist.html")
22             webView.load(testUrl)
23             spy.wait()
24             compare(spy.count, 1)
25         }
26     }
27
28     onLoadFailed: {
29         test.compare(url, testUrl)
30         test.compare(errorCode, NetworkReply.ContentNotFoundError)
31         test.compare(errorType, WebView.NetworkError)
32     }
33 }