summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-11-16 11:52:15 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-11-16 11:52:15 (GMT)
commit15e2b2d753250bbe01a78d9ece37f0f0b08cd21c (patch)
treea37bb70124fdbecbbaf7e0e2a141a359eaf4f412 /src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp
parent3328e0ee94b94c83fe9d64f741bede6725f5c952 (diff)
parent7fdfa58b958b658feb7b20dd7a7322d235fe4bea (diff)
downloadQt-15e2b2d753250bbe01a78d9ece37f0f0b08cd21c.zip
Qt-15e2b2d753250bbe01a78d9ece37f0f0b08cd21c.tar.gz
Qt-15e2b2d753250bbe01a78d9ece37f0f0b08cd21c.tar.bz2
Merge branch '4.6' into mmfphonon
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp')
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp
index fda979e..27daf38 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp
@@ -20,6 +20,7 @@
*/
#include <qtest.h>
+#include "../util.h"
#include <qpainter.h>
#include <qwebview.h>
@@ -45,6 +46,8 @@ private slots:
void reusePage_data();
void reusePage();
+
+ void crashTests();
};
// This will be called before the first test function is executed.
@@ -148,6 +151,46 @@ void tst_QWebView::reusePage()
QDir::setCurrent(QApplication::applicationDirPath());
}
+// Class used in crashTests
+class WebViewCrashTest : public QObject {
+ Q_OBJECT
+ QWebView* m_view;
+public:
+ bool m_executed;
+
+
+ WebViewCrashTest(QWebView* view)
+ : m_view(view)
+ , m_executed(false)
+ {
+ view->connect(view, SIGNAL(loadProgress(int)), this, SLOT(loading(int)));
+ }
+
+private slots:
+ void loading(int progress)
+ {
+ if (progress >= 20 && progress < 90) {
+ QVERIFY(!m_executed);
+ m_view->stop();
+ m_executed = true;
+ }
+ }
+};
+
+
+// Should not crash.
+void tst_QWebView::crashTests()
+{
+ // Test if loading can be stopped in loadProgress handler without crash.
+ // Test page should have frames.
+ QWebView view;
+ WebViewCrashTest tester(&view);
+ QUrl url("qrc:///data/index.html");
+ view.load(url);
+ QTRY_VERIFY(tester.m_executed); // If fail it means that the test wasn't executed.
+}
+
+
QTEST_MAIN(tst_QWebView)
#include "tst_qwebview.moc"