summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp')
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp326
1 files changed, 184 insertions, 142 deletions
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 1629ec617..0b6354cc2 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -43,6 +43,7 @@
#include <qnetworkreply.h>
#include <qnetworkrequest.h>
#include <qpa/qplatforminputcontext.h>
+#include <qwebenginedownloaditem.h>
#include <qwebenginefullscreenrequest.h>
#include <qwebenginehistory.h>
#include <qwebenginepage.h>
@@ -154,15 +155,13 @@ private Q_SLOTS:
void consoleOutput();
void inputMethods_data();
void inputMethods();
- void inputMethodsTextFormat_data();
- void inputMethodsTextFormat();
- void defaultTextEncoding();
void errorPageExtension();
void errorPageExtensionLoadFinished();
void userAgentNewlineStripping();
void undoActionHaveCustomText();
void renderWidgetHostViewNotShowTopLevel();
void getUserMediaRequest();
+ void savePage();
void crashTests_LazyInitializationOfMainFrame();
@@ -183,7 +182,6 @@ private Q_SLOTS:
// [Qt] tst_QWebEnginePage::infiniteLoopJS() timeouts with DFG JIT
// https://bugs.webkit.org/show_bug.cgi?id=79040
// void infiniteLoopJS();
- void navigatorCookieEnabled();
void deleteQWebEngineViewTwice();
void renderOnRepaintRequestedShouldNotRecurse();
void loadSignalsOrder_data();
@@ -242,6 +240,9 @@ private Q_SLOTS:
void mouseButtonTranslation();
void printToPdf();
+ void viewSource();
+ void viewSourceURL_data();
+ void viewSourceURL();
private:
static QPoint elementCenter(QWebEnginePage *page, const QString &id);
@@ -295,6 +296,7 @@ void tst_QWebEnginePage::cleanupFiles()
void tst_QWebEnginePage::initTestCase()
{
+ QLocale::setDefault(QLocale("en"));
cleanupFiles(); // In case there are old files from previous runs
// Set custom path since the CI doesn't install test plugins.
@@ -331,25 +333,25 @@ protected:
void tst_QWebEnginePage::acceptNavigationRequest()
{
- QSignalSpy loadSpy(m_view, SIGNAL(loadFinished(bool)));
+ QWebEngineView *view = new QWebEngineView();
+ QSignalSpy loadSpy(view, SIGNAL(loadFinished(bool)));
- NavigationRequestOverride* newPage = new NavigationRequestOverride(m_view, false);
- m_view->setPage(newPage);
+ NavigationRequestOverride* newPage = new NavigationRequestOverride(view, false);
+ view->setPage(newPage);
- m_view->setHtml(QString("<html><body><form name='tstform' action='data:text/html,foo'method='get'>"
+ view->setHtml(QString("<html><body><form name='tstform' action='data:text/html,foo'method='get'>"
"<input type='text'><input type='submit'></form></body></html>"), QUrl());
QTRY_COMPARE(loadSpy.count(), 1);
- evaluateJavaScriptSync(m_view->page(), "tstform.submit();");
+ evaluateJavaScriptSync(view->page(), "tstform.submit();");
newPage->m_acceptNavigationRequest = true;
- evaluateJavaScriptSync(m_view->page(), "tstform.submit();");
+ evaluateJavaScriptSync(view->page(), "tstform.submit();");
QTRY_COMPARE(loadSpy.count(), 2);
- QCOMPARE(toPlainTextSync(m_view->page()), QString("foo?"));
+ QCOMPARE(toPlainTextSync(view->page()), QString("foo?"));
- // Restore default page
- m_view->setPage(0);
+ delete view;
}
class JSTestPage : public QWebEnginePage
@@ -416,7 +418,7 @@ void tst_QWebEnginePage::geolocationRequestJS()
newPage, SLOT(requestPermission(const QUrl&, QWebEnginePage::Feature)));
QSignalSpy spyLoadFinished(newPage, SIGNAL(loadFinished(bool)));
- newPage->setHtml(QString("<html><body>test</body></html>"), QUrl());
+ newPage->setHtml(QString("<html><body>test</body></html>"), QUrl("qrc://secure/origin"));
QTRY_COMPARE(spyLoadFinished.count(), 1);
if (evaluateJavaScriptSync(newPage, QLatin1String("!navigator.geolocation")).toBool()) {
delete view;
@@ -460,12 +462,10 @@ void tst_QWebEnginePage::loadFinished()
void tst_QWebEnginePage::actionStates()
{
- QWebEnginePage* page = m_view->page();
+ m_page->load(QUrl("qrc:///resources/script.html"));
- page->load(QUrl("qrc:///resources/script.html"));
-
- QAction* reloadAction = page->action(QWebEnginePage::Reload);
- QAction* stopAction = page->action(QWebEnginePage::Stop);
+ QAction* reloadAction = m_page->action(QWebEnginePage::Reload);
+ QAction* stopAction = m_page->action(QWebEnginePage::Stop);
QTRY_VERIFY(reloadAction->isEnabled());
QTRY_VERIFY(!stopAction->isEnabled());
@@ -557,10 +557,15 @@ public:
virtual QWebEnginePage* createWindow(WebWindowType) {
TestPage* page = new TestPage(this);
createdWindows.append(page);
+ emit windowCreated();
return page;
}
QRect requestedGeometry;
+
+signals:
+ void windowCreated();
+
private Q_SLOTS:
void slotGeometryChangeRequested(const QRect& geom) {
requestedGeometry = geom;
@@ -606,20 +611,26 @@ void tst_QWebEnginePage::acceptNavigationRequestNavigationType()
void tst_QWebEnginePage::popupFormSubmission()
{
TestPage page;
+ QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
+ QSignalSpy windowCreatedSpy(&page, SIGNAL(windowCreated()));
+
page.settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
- page.setHtml("<form name=form1 method=get action='' target=myNewWin>"\
- "<input type=hidden name=foo value='bar'>"\
- "</form>");
- page.runJavaScript("window.open('', 'myNewWin', 'width=500,height=300,toolbar=0')");
+ page.setHtml("<form name='form1' method=get action='' target='myNewWin'>"
+ " <input type='hidden' name='foo' value='bar'>"
+ "</form>");
+ QTRY_COMPARE(loadFinishedSpy.count(), 1);
+
+ page.runJavaScript("window.open('', 'myNewWin', 'width=500,height=300,toolbar=0');");
evaluateJavaScriptSync(&page, "document.form1.submit();");
+ QTRY_COMPARE(windowCreatedSpy.count(), 1);
- QTest::qWait(500);
// The number of popup created should be one.
QVERIFY(page.createdWindows.size() == 1);
- QString url = page.createdWindows.takeFirst()->url().toString();
+ QTRY_VERIFY(!page.createdWindows[0]->url().isEmpty());
+ QString url = page.createdWindows[0]->url().toString();
+
// Check if the form submission was OK.
- QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118597", Continue);
QVERIFY(url.contains("?foo=bar"));
}
@@ -1412,7 +1423,7 @@ void tst_QWebEnginePage::cursorMovements()
void tst_QWebEnginePage::textSelection()
{
QWebEngineView *view = new QWebEngineView;
- CursorTrackedPage *page = new CursorTrackedPage;
+ CursorTrackedPage *page = new CursorTrackedPage(view);
QString content("<html><body><p id=one>The quick brown fox</p>" \
"<p id=two>jumps over the lazy dog</p>" \
"<p>May the source<br/>be with you!</p></body></html>");
@@ -1512,7 +1523,6 @@ void tst_QWebEnginePage::textSelection()
QCOMPARE(page->action(QWebEnginePage::SelectEndOfDocument)->isEnabled(), true);
#endif
- delete page;
delete view;
}
@@ -2391,61 +2401,6 @@ void tst_QWebEnginePage::inputMethods()
#endif
}
-void tst_QWebEnginePage::inputMethodsTextFormat_data()
-{
- QTest::addColumn<QString>("string");
- QTest::addColumn<int>("start");
- QTest::addColumn<int>("length");
-
- QTest::newRow("") << QString("") << 0 << 0;
- QTest::newRow("Q") << QString("Q") << 0 << 1;
- QTest::newRow("Qt") << QString("Qt") << 0 << 1;
- QTest::newRow("Qt") << QString("Qt") << 0 << 2;
- QTest::newRow("Qt") << QString("Qt") << 1 << 1;
- QTest::newRow("Qt ") << QString("Qt ") << 0 << 1;
- QTest::newRow("Qt ") << QString("Qt ") << 1 << 1;
- QTest::newRow("Qt ") << QString("Qt ") << 2 << 1;
- QTest::newRow("Qt ") << QString("Qt ") << 2 << -1;
- QTest::newRow("Qt ") << QString("Qt ") << -2 << 3;
- QTest::newRow("Qt ") << QString("Qt ") << 0 << 3;
- QTest::newRow("Qt by") << QString("Qt by") << 0 << 1;
- QTest::newRow("Qt by Nokia") << QString("Qt by Nokia") << 0 << 1;
-}
-
-
-void tst_QWebEnginePage::inputMethodsTextFormat()
-{
-#if !defined(QINPUTMETHODEVENT_TEXTFORMAT)
- QSKIP("QINPUTMETHODEVENT_TEXTFORMAT");
-#else
- QWebEnginePage* page = new QWebEnginePage;
- QWebEngineView* view = new QWebEngineView;
- view->setPage(page);
- page->settings()->setFontFamily(QWebEngineSettings::SerifFont, "FooSerifFont");
- page->setHtml("<html><body>" \
- "<input type='text' id='input1' style='font-family: serif' value='' maxlength='20'/>");
- evaluateJavaScriptSync(page, "document.getElementById('input1').focus()");
- page->mainFrame()->setFocus();
- view->show();
-
- QFETCH(QString, string);
- QFETCH(int, start);
- QFETCH(int, length);
-
- QList<QInputMethodEvent::Attribute> attrs;
- QTextCharFormat format;
- format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
- format.setUnderlineColor(Qt::red);
- attrs.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, start, length, format));
- QInputMethodEvent im(string, attrs);
- page->event(&im);
-
- QTest::qWait(1000);
-
- delete view;
-#endif
-}
-
void tst_QWebEnginePage::protectBindingsRuntimeObjectsFromCollector()
{
#if !defined(QWEBENGINEPAGE_CREATEPLUGIN)
@@ -2614,30 +2569,6 @@ void tst_QWebEnginePage::testEnablePersistentStorage()
#endif
}
-void tst_QWebEnginePage::defaultTextEncoding()
-{
- QString defaultCharset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
- QVERIFY(!defaultCharset.isEmpty());
- QCOMPARE(QWebEngineSettings::globalSettings()->defaultTextEncoding(), defaultCharset);
-
- m_page->settings()->setDefaultTextEncoding(QString("utf-8"));
- QCoreApplication::processEvents();
- QString charset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
- QCOMPARE(charset, QString("utf-8"));
- QCOMPARE(m_page->settings()->defaultTextEncoding(), charset);
-
- m_page->settings()->setDefaultTextEncoding(QString());
- QCoreApplication::processEvents();
- charset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
- QVERIFY(!charset.isEmpty());
- QCOMPARE(charset, defaultCharset);
-
- QWebEngineSettings::globalSettings()->setDefaultTextEncoding(QString("utf-8"));
- QCoreApplication::processEvents();
- charset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
- QCOMPARE(charset, QString("utf-8"));
- QCOMPARE(QWebEngineSettings::globalSettings()->defaultTextEncoding(), charset);
-}
#if defined(QWEBENGINEPAGE_ERRORPAGEEXTENSION)
class ErrorPage : public QWebEnginePage
@@ -3070,22 +3001,6 @@ void tst_QWebEnginePage::supportedContentType()
#endif
}
-
-void tst_QWebEnginePage::navigatorCookieEnabled()
-{
-#if !defined(QWEBENGINEPAGE_NETWORKACCESSMANAGER)
- QSKIP("QWEBENGINEPAGE_NETWORKACCESSMANAGER");
-#else
- m_page->networkAccessManager()->setCookieJar(0);
- QVERIFY(!m_page->networkAccessManager()->cookieJar());
- QVERIFY(!evaluateJavaScriptSync(m_page, "navigator.cookieEnabled").toBool());
-
- m_page->networkAccessManager()->setCookieJar(new QNetworkCookieJar());
- QVERIFY(m_page->networkAccessManager()->cookieJar());
- QVERIFY(evaluateJavaScriptSync(m_page, "navigator.cookieEnabled").toBool());
-#endif
-}
-
void tst_QWebEnginePage::thirdPartyCookiePolicy()
{
#if !defined(DUMPRENDERTREESUPPORTQT)
@@ -3500,7 +3415,9 @@ void tst_QWebEnginePage::getUserMediaRequest()
GetUserMediaTestPage *page = new GetUserMediaTestPage();
// We need to load content from a resource in order for the securityOrigin to be valid.
+ QSignalSpy loadSpy(page, SIGNAL(loadFinished(bool)));
page->load(QUrl("qrc:///resources/content.html"));
+ QTRY_COMPARE(loadSpy.count(), 1);
QVERIFY(evaluateJavaScriptSync(page, QStringLiteral("!!navigator.webkitGetUserMedia")).toBool());
evaluateJavaScriptSync(page, QStringLiteral("navigator.webkitGetUserMedia({audio: true}, function() {}, function(){})"));
@@ -3517,9 +3434,45 @@ void tst_QWebEnginePage::getUserMediaRequest()
delete page;
}
+void tst_QWebEnginePage::savePage()
+{
+ QWebEngineView view;
+ QWebEnginePage *page = view.page();
+
+ connect(page->profile(), &QWebEngineProfile::downloadRequested,
+ [] (QWebEngineDownloadItem *item)
+ {
+ connect(item, &QWebEngineDownloadItem::finished,
+ &QTestEventLoop::instance(), &QTestEventLoop::exitLoop, Qt::QueuedConnection);
+ });
+
+ const QString urlPrefix = QStringLiteral("data:text/html,<h1>");
+ const QString text = QStringLiteral("There is Thingumbob shouting!");
+ page->load(QUrl(urlPrefix + text));
+ waitForSignal(page, SIGNAL(loadFinished(bool)));
+ QCOMPARE(toPlainTextSync(page), text);
+
+ // Save the loaded page as HTML.
+ QTemporaryDir tempDir(QDir::tempPath() + "/tst_qwebengineview-XXXXXX");
+ const QString filePath = tempDir.path() + "/thingumbob.html";
+ page->save(filePath, QWebEngineDownloadItem::CompleteHtmlSaveFormat);
+ QTestEventLoop::instance().enterLoop(10);
+
+ // Load something else.
+ page->load(QUrl(urlPrefix + QLatin1String("It's a Snark!")));
+ waitForSignal(page, SIGNAL(loadFinished(bool)));
+ QVERIFY(toPlainTextSync(page) != text);
+
+ // Load the saved page and compare the contents.
+ page->load(QUrl::fromLocalFile(filePath));
+ waitForSignal(page, SIGNAL(loadFinished(bool)));
+ QCOMPARE(toPlainTextSync(page), text);
+}
+
void tst_QWebEnginePage::openWindowDefaultSize()
{
TestPage page;
+ QSignalSpy windowCreatedSpy(&page, SIGNAL(windowCreated()));
QWebEngineView view;
page.setView(&view);
view.show();
@@ -3527,11 +3480,11 @@ void tst_QWebEnginePage::openWindowDefaultSize()
page.settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
// Open a default window.
page.runJavaScript("window.open()");
- QTest::qWait(200);
+ QTRY_COMPARE(windowCreatedSpy.count(), 1);
// Open a too small window.
evaluateJavaScriptSync(&page, "window.open('','about:blank','width=10,height=10')");
+ QTRY_COMPARE(windowCreatedSpy.count(), 2);
- QTest::qWait(200);
// The number of popups created should be two.
QCOMPARE(page.createdWindows.size(), 2);
@@ -3751,9 +3704,8 @@ void tst_QWebEnginePage::runJavaScript()
void tst_QWebEnginePage::fullScreenRequested()
{
JavaScriptCallbackWatcher watcher;
- QWebEnginePage* page = new QWebEnginePage;
QWebEngineView* view = new QWebEngineView;
- view->setPage(page);
+ QWebEnginePage* page = view->page();
view->show();
page->settings()->setAttribute(QWebEngineSettings::FullScreenSupportEnabled, true);
@@ -3773,7 +3725,7 @@ void tst_QWebEnginePage::fullScreenRequested()
if (acceptRequest) request.accept(); else request.reject();
});
- QTest::keyPress(qApp->focusWindow(), Qt::Key_Space);
+ QTest::keyPress(view->focusProxy(), Qt::Key_Space);
QTRY_VERIFY(evaluateJavaScriptSync(page, "document.webkitIsFullScreen").toBool());
page->runJavaScript("document.webkitExitFullscreen()", JavaScriptCallbackUndefined());
QVERIFY(watcher.wait());
@@ -3781,13 +3733,12 @@ void tst_QWebEnginePage::fullScreenRequested()
acceptRequest = false;
page->runJavaScript("document.webkitFullscreenEnabled", JavaScriptCallback(true));
- QTest::keyPress(qApp->focusWindow(), Qt::Key_Space);
+ QTest::keyPress(view->focusProxy(), Qt::Key_Space);
QVERIFY(watcher.wait());
page->runJavaScript("document.webkitIsFullScreen", JavaScriptCallback(false));
QVERIFY(watcher.wait());
delete view;
- delete page;
}
void tst_QWebEnginePage::symmetricUrl()
@@ -4344,23 +4295,39 @@ void tst_QWebEnginePage::horizontalScrollAfterBack()
#endif
}
+class WebView : public QWebEngineView
+{
+ Q_OBJECT
+signals:
+ void repaintRequested();
+
+protected:
+ bool event(QEvent *event) {
+ if (event->type() == QEvent::UpdateRequest)
+ emit repaintRequested();
+
+ return QWebEngineView::event(event);
+ }
+};
+
void tst_QWebEnginePage::evaluateWillCauseRepaint()
{
-#if !defined(QWEBENGINEPAGE_EVALUATEJAVASCRIPT)
- QSKIP("QWEBENGINEPAGE_EVALUATEJAVASCRIPT");
-#else
- QWebEngineView view;
- QString html("<html><body>top<div id=\"junk\" style=\"display: block;\">"
- "junk</div>bottom</body></html>");
- view.setHtml(html);
+ WebView view;
view.show();
-
QTest::qWaitForWindowExposed(&view);
- view.page()->evaluateJavaScript(
- "document.getElementById('junk').style.display = 'none';");
- ::waitForSignal(view.page(), SIGNAL(repaintRequested(QRect)));
-#endif
+ QString html("<html><body>"
+ " top"
+ " <div id=\"junk\" style=\"display: block;\">junk</div>"
+ " bottom"
+ "</body></html>");
+
+ QSignalSpy loadSpy(&view, SIGNAL(loadFinished(bool)));
+ view.setHtml(html);
+ QTRY_COMPARE(loadSpy.count(), 1);
+
+ evaluateJavaScriptSync(view.page(), "document.getElementById('junk').style.display = 'none';");
+ ::waitForSignal(&view, SIGNAL(repaintRequested()));
}
void tst_QWebEnginePage::setContent_data()
@@ -5009,5 +4976,80 @@ QPoint tst_QWebEnginePage::elementCenter(QWebEnginePage *page, const QString &id
return QPoint(rectList.at(0).toInt(), rectList.at(1).toInt());
}
+void tst_QWebEnginePage::viewSource()
+{
+ TestPage page;
+ QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
+ QSignalSpy windowCreatedSpy(&page, SIGNAL(windowCreated()));
+ const QUrl url("qrc:/resources/test1.html");
+
+ page.load(url);
+ QTRY_COMPARE(loadFinishedSpy.count(), 1);
+ QCOMPARE(page.title(), QStringLiteral("Test page 1"));
+ QVERIFY(page.action(QWebEnginePage::ViewSource)->isEnabled());
+
+ page.triggerAction(QWebEnginePage::ViewSource);
+ QTRY_COMPARE(windowCreatedSpy.count(), 1);
+ QCOMPARE(page.createdWindows.size(), 1);
+
+ QTRY_COMPARE(page.createdWindows[0]->url().toString(), QStringLiteral("view-source:%1").arg(url.toString()));
+ // The requested URL should not be about:blank if the qrc scheme is supported
+ QTRY_COMPARE(page.createdWindows[0]->requestedUrl(), url);
+ QTRY_COMPARE(page.createdWindows[0]->title(), QStringLiteral("view-source:%1").arg(url.toString()));
+ QVERIFY(!page.createdWindows[0]->action(QWebEnginePage::ViewSource)->isEnabled());
+}
+
+void tst_QWebEnginePage::viewSourceURL_data()
+{
+ QTest::addColumn<QUrl>("userInputUrl");
+ QTest::addColumn<bool>("loadSucceed");
+ QTest::addColumn<QUrl>("url");
+ QTest::addColumn<QUrl>("requestedUrl");
+ QTest::addColumn<QString>("title");
+
+ QTest::newRow("view-source:") << QUrl("view-source:") << true << QUrl("view-source:") << QUrl("about:blank") << QString("view-source:");
+ QTest::newRow("view-source:about:blank") << QUrl("view-source:about:blank") << true << QUrl("view-source:about:blank") << QUrl("about:blank") << QString("view-source:about:blank");
+
+ QString localFilePath = QString("%1qwebenginepage/resources/test1.html").arg(TESTS_SOURCE_DIR);
+ QUrl testLocalUrl = QUrl(QString("view-source:%1").arg(QUrl::fromLocalFile(localFilePath).toString()));
+ QUrl testLocalUrlWithoutScheme = QUrl(QString("view-source:%1").arg(localFilePath));
+ QTest::newRow(testLocalUrl.toString().toStdString().c_str()) << testLocalUrl << true << testLocalUrl << QUrl::fromLocalFile(localFilePath) << QString("test1.html");
+ QTest::newRow(testLocalUrlWithoutScheme.toString().toStdString().c_str()) << testLocalUrlWithoutScheme << true << testLocalUrl << QUrl::fromLocalFile(localFilePath) << QString("test1.html");
+
+ QString resourcePath = QLatin1String("qrc:/resources/test1.html");
+ QUrl testResourceUrl = QUrl(QString("view-source:%1").arg(resourcePath));
+ QTest::newRow(testResourceUrl.toString().toStdString().c_str()) << testResourceUrl << true << testResourceUrl << QUrl(resourcePath) << testResourceUrl.toString();
+
+ QTest::newRow("view-source:http://non.existent") << QUrl("view-source:non.existent") << false << QUrl("view-source:http://non.existent/") << QUrl("http://non.existent/") << QString("http://non.existent/ is not available");
+ QTest::newRow("view-source:non.existent") << QUrl("view-source:non.existent") << false << QUrl("view-source:http://non.existent/") << QUrl("http://non.existent/") << QString("http://non.existent/ is not available");
+}
+
+void tst_QWebEnginePage::viewSourceURL()
+{
+ if (!QDir(TESTS_SOURCE_DIR).exists())
+ W_QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
+
+ QFETCH(QUrl, userInputUrl);
+ QFETCH(bool, loadSucceed);
+ QFETCH(QUrl, url);
+ QFETCH(QUrl, requestedUrl);
+ QFETCH(QString, title);
+
+ QWebEnginePage *page = new QWebEnginePage;
+ QSignalSpy loadFinishedSpy(page, SIGNAL(loadFinished(bool)));
+
+ page->load(userInputUrl);
+ QTRY_COMPARE(loadFinishedSpy.count(), 1);
+ QList<QVariant> arguments = loadFinishedSpy.takeFirst();
+
+ QCOMPARE(arguments.at(0).toBool(), loadSucceed);
+ QCOMPARE(page->url(), url);
+ QCOMPARE(page->requestedUrl(), requestedUrl);
+ QCOMPARE(page->title(), title);
+ QVERIFY(!page->action(QWebEnginePage::ViewSource)->isEnabled());
+
+ delete page;
+}
+
QTEST_MAIN(tst_QWebEnginePage)
#include "tst_qwebenginepage.moc"