summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-05 13:46:53 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-05 13:46:53 +0200
commit7e5c64b6badc6bda3991a1f016392c850f86640d (patch)
tree06b1110094886cff579cf0d4b731e1d52fed0f1f /tests/auto
parentf962cadf8dd0a7aee59573896148c0ea96bd5503 (diff)
parentd2fa5fd0f5b1972bd372510cc14509e85b972b23 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/quick/dialogs/BLACKLIST2
-rw-r--r--tests/auto/quick/dialogs/server.cpp13
-rw-r--r--tests/auto/quick/dialogs/server.h2
-rw-r--r--tests/auto/quick/dialogs/tst_dialogs.cpp17
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp3
-rw-r--r--tests/auto/quick/qmltests/data/tst_notification.qml2
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp2
-rw-r--r--tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp2
-rw-r--r--tests/auto/widgets/accessibility/tst_accessibility.cpp2
-rw-r--r--tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp2
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp40
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp6
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp6
13 files changed, 56 insertions, 43 deletions
diff --git a/tests/auto/quick/dialogs/BLACKLIST b/tests/auto/quick/dialogs/BLACKLIST
deleted file mode 100644
index 19380e01e..000000000
--- a/tests/auto/quick/dialogs/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[authenticationDialogRequested:Proxy Authentication Dialog]
-*
diff --git a/tests/auto/quick/dialogs/server.cpp b/tests/auto/quick/dialogs/server.cpp
index dc9cfe582..dfc7c97ad 100644
--- a/tests/auto/quick/dialogs/server.cpp
+++ b/tests/auto/quick/dialogs/server.cpp
@@ -33,7 +33,6 @@
Server::Server(QObject *parent) : QObject(parent)
{
- m_data.clear();
connect(&m_server, &QTcpServer::newConnection, this, &Server::handleNewConnection);
}
@@ -42,6 +41,11 @@ bool Server::isListening()
return m_server.isListening();
}
+void Server::setReply(const QByteArray &reply)
+{
+ m_reply = reply;
+}
+
void Server::run()
{
if (!m_server.listen(QHostAddress::LocalHost, 5555))
@@ -69,12 +73,7 @@ void Server::handleReadReady()
if (!m_data.endsWith("\r\n\r\n"))
return;
- if (m_data.contains(QByteArrayLiteral("OPEN_AUTH")))
- socket->write("HTTP/1.1 401 Unauthorized\nWWW-Authenticate: "
- "Basic realm=\"Very Restricted Area\"\r\n\r\n");
- if (m_data.contains(QByteArrayLiteral("OPEN_PROXY")))
- socket->write("HTTP/1.1 407 Proxy Auth Required\nProxy-Authenticate: "
- "Basic realm=\"Proxy requires authentication\"\r\n\r\n");
+ socket->write(m_reply);
m_data.clear();
socket->disconnectFromHost();
}
diff --git a/tests/auto/quick/dialogs/server.h b/tests/auto/quick/dialogs/server.h
index 24da47523..fa9a73811 100644
--- a/tests/auto/quick/dialogs/server.h
+++ b/tests/auto/quick/dialogs/server.h
@@ -40,6 +40,7 @@ public:
explicit Server(QObject *parent = nullptr);
bool isListening();
+ void setReply(const QByteArray &reply);
public slots:
void run();
@@ -50,6 +51,7 @@ private slots:
private:
QByteArray m_data;
+ QByteArray m_reply;
QTcpServer m_server;
};
diff --git a/tests/auto/quick/dialogs/tst_dialogs.cpp b/tests/auto/quick/dialogs/tst_dialogs.cpp
index cecea1831..26a0fe034 100644
--- a/tests/auto/quick/dialogs/tst_dialogs.cpp
+++ b/tests/auto/quick/dialogs/tst_dialogs.cpp
@@ -145,12 +145,19 @@ void tst_Dialogs::authenticationDialogRequested_data()
QTest::addColumn<QUrl>("url");
QTest::addColumn<QQuickWebEngineAuthenticationDialogRequest::AuthenticationType>("type");
QTest::addColumn<QString>("realm");
- QTest::newRow("Http Authentication Dialog") << QUrl("http://localhost:5555/OPEN_AUTH")
+ QTest::addColumn<QByteArray>("reply");
+ QTest::newRow("Http Authentication Dialog") << QUrl("http://localhost:5555/")
<< QQuickWebEngineAuthenticationDialogRequest::AuthenticationTypeHTTP
- << QStringLiteral("Very Restricted Area");
- QTest::newRow("Proxy Authentication Dialog") << QUrl("http://localhost.:5555/OPEN_PROXY")
+ << QStringLiteral("Very Restricted Area")
+ << QByteArrayLiteral("HTTP/1.1 401 Unauthorized\nWWW-Authenticate: "
+ "Basic realm=\"Very Restricted Area\"\r\n\r\n");
+ QTest::newRow("Proxy Authentication Dialog")<< QUrl("http://qt.io/")
<< QQuickWebEngineAuthenticationDialogRequest::AuthenticationTypeProxy
- << QStringLiteral("Proxy requires authentication");
+ << QStringLiteral("Proxy requires authentication")
+ << QByteArrayLiteral("HTTP/1.1 407 Proxy Auth Required\nProxy-Authenticate: "
+ "Basic realm=\"Proxy requires authentication\"\r\n"
+ "content-length: 0\r\n\r\n");
+
}
void tst_Dialogs::authenticationDialogRequested()
@@ -159,7 +166,9 @@ void tst_Dialogs::authenticationDialogRequested()
QFETCH(QQuickWebEngineAuthenticationDialogRequest::AuthenticationType, type);
QFETCH(QString, realm);
+ QFETCH(QByteArray, reply);
Server server;
+ server.setReply(reply);
server.run();
QTRY_VERIFY2(server.isListening(), "Could not setup authentication server");
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 3e5d24381..ed4a030df 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -332,7 +332,7 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void"
<< "QQuickWebEngineProfile.downloadPath --> QString"
<< "QQuickWebEngineProfile.downloadPathChanged() --> void"
- << "QQuickWebEngineProfile.userNotification(QWebEngineNotification*) --> void"
+ << "QQuickWebEngineProfile.presentNotification(QWebEngineNotification*) --> void"
<< "QQuickWebEngineProfile.httpAcceptLanguage --> QString"
<< "QQuickWebEngineProfile.httpAcceptLanguageChanged() --> void"
<< "QQuickWebEngineProfile.httpCacheMaximumSize --> int"
@@ -765,7 +765,6 @@ static const QStringList expectedAPI = QStringList()
<< "QWebEngineRegisterProtocolHandlerRequest.reject() --> void"
<< "QWebEngineRegisterProtocolHandlerRequest.scheme --> QString"
<< "QWebEngineNotification.origin --> QUrl"
- << "QWebEngineNotification.icon --> QIcon"
<< "QWebEngineNotification.title --> QString"
<< "QWebEngineNotification.message --> QString"
<< "QWebEngineNotification.tag --> QString"
diff --git a/tests/auto/quick/qmltests/data/tst_notification.qml b/tests/auto/quick/qmltests/data/tst_notification.qml
index af4aebafc..773bf4a8e 100644
--- a/tests/auto/quick/qmltests/data/tst_notification.qml
+++ b/tests/auto/quick/qmltests/data/tst_notification.qml
@@ -107,7 +107,7 @@ TestWebEngineView {
verify(permissionRequested)
let title = 'Title', message = 'Message', notification = null
- view.profile.userNotification.connect(function (n) { notification = n })
+ view.profile.presentNotification.connect(function (n) { notification = n })
view.runJavaScript('sendNotification("' + title + '", "' + message + '")')
tryVerify(function () { return notification !== null })
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index eb76be6db..74c04635f 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -878,7 +878,7 @@ public:
setAcceptHoverEvents(true);
}
- bool event(QEvent *event) Q_DECL_OVERRIDE
+ bool event(QEvent *event) override
{
switch (event->type()) {
case QEvent::TabletPress:
diff --git a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
index 2b9742b99..b587f3b27 100644
--- a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
+++ b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp
@@ -46,7 +46,7 @@ public:
Qt::QueuedConnection);
}
- virtual void exposeEvent(QExposeEvent *e) Q_DECL_OVERRIDE {
+ virtual void exposeEvent(QExposeEvent *e) override {
QQuickView::exposeEvent(e);
emit _q_exposeChanged();
}
diff --git a/tests/auto/widgets/accessibility/tst_accessibility.cpp b/tests/auto/widgets/accessibility/tst_accessibility.cpp
index 6efbf53ed..b0165cfbc 100644
--- a/tests/auto/widgets/accessibility/tst_accessibility.cpp
+++ b/tests/auto/widgets/accessibility/tst_accessibility.cpp
@@ -134,7 +134,7 @@ void tst_Accessibility::hierarchy()
QVERIFY(windowRect.contains(inputRect));
QPoint inputCenter = inputRect.center();
QAccessibleInterface *hitTest = view;
- QAccessibleInterface *child = Q_NULLPTR;
+ QAccessibleInterface *child = nullptr;
while (hitTest) {
child = hitTest;
hitTest = hitTest->childAt(inputCenter.x(), inputCenter.y());
diff --git a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp
index 8af559e21..8669c8f94 100644
--- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp
+++ b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp
@@ -920,7 +920,7 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilename()
void tst_QWebEngineDownloadItem::downloadUniqueFileNameWithTimeStamp()
{
#ifdef Q_OS_WIN
- QSKIP("QTBUG-74764: The download completes after the test fails thus would ruin subsequent tests on Windows.")
+ QSKIP("QTBUG-74764: The download completes after the test fails thus would ruin subsequent tests on Windows.");
#endif
// Set up HTTP server
QString baseName("test(1.test)");
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 3792b5522..9ba242e68 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -1550,7 +1550,7 @@ public:
JavaScriptCallback() { }
JavaScriptCallback(const QVariant& _expected) : expected(_expected) { }
- void check(const QVariant& result) Q_DECL_OVERRIDE
+ void check(const QVariant& result) override
{
QVERIFY(result.isValid());
QCOMPARE(result, expected);
@@ -1563,7 +1563,7 @@ private:
class JavaScriptCallbackNull : public JavaScriptCallbackBase
{
public:
- void check(const QVariant& result) Q_DECL_OVERRIDE
+ void check(const QVariant& result) override
{
QVERIFY(result.isNull());
// FIXME: Returned null values are currently invalid QVariants.
@@ -1574,7 +1574,7 @@ public:
class JavaScriptCallbackUndefined : public JavaScriptCallbackBase
{
public:
- void check(const QVariant& result) Q_DECL_OVERRIDE
+ void check(const QVariant& result) override
{
QVERIFY(result.isNull());
QVERIFY(!result.isValid());
@@ -3327,27 +3327,33 @@ void tst_QWebEnginePage::sendNotification()
QVERIFY(page.spyRequest.wasCalled());
QCOMPARE(page.getPermission(), "granted");
- CallbackSpy<QWebEngineNotification> presenter;
- page.profile()->setNotificationPresenter([callback = presenter.ref()] (const QWebEngineNotification &notification) mutable { callback(notification); });
+ std::unique_ptr<QWebEngineNotification> activeNotification;
+ CallbackSpy<bool> presenter;
+ page.profile()->setNotificationPresenter(
+ [&] (std::unique_ptr<QWebEngineNotification> notification)
+ {
+ activeNotification = std::move(notification);
+ presenter(true);
+ });
QString title("Title"), message("Message");
page.sendNotification(title, message);
- auto notification = presenter.waitForResult();
+ presenter.waitForResult();
QVERIFY(presenter.wasCalled());
- QVERIFY(notification.isValid());
- QCOMPARE(notification.title(), title);
- QCOMPARE(notification.message(), message);
- QCOMPARE(notification.origin(), origin);
- QCOMPARE(notification.direction(), Qt::RightToLeft);
- QCOMPARE(notification.language(), "de");
- QCOMPARE(notification.tag(), "tst");
-
- notification.show();
+ QVERIFY(activeNotification);
+ QCOMPARE(activeNotification->title(), title);
+ QCOMPARE(activeNotification->message(), message);
+ QCOMPARE(activeNotification->origin(), origin);
+ QCOMPARE(activeNotification->direction(), Qt::RightToLeft);
+ QCOMPARE(activeNotification->language(), "de");
+ QCOMPARE(activeNotification->tag(), "tst");
+
+ activeNotification->show();
QTRY_VERIFY2(page.messages.contains("onshow"), page.messages.join("\n").toLatin1().constData());
- notification.click();
+ activeNotification->click();
QTRY_VERIFY2(page.messages.contains("onclick"), page.messages.join("\n").toLatin1().constData());
- notification.close();
+ activeNotification->close();
QTRY_VERIFY2(page.messages.contains("onclose"), page.messages.join("\n").toLatin1().constData());
}
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index 8bd68bb97..ebd25e892 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -374,17 +374,17 @@ public:
{
}
- qint64 readData(char *, qint64) Q_DECL_OVERRIDE
+ qint64 readData(char *, qint64) override
{
m_job->fail(QWebEngineUrlRequestJob::RequestFailed);
return -1;
}
- qint64 writeData(const char *, qint64) Q_DECL_OVERRIDE
+ qint64 writeData(const char *, qint64) override
{
m_job->fail(QWebEngineUrlRequestJob::RequestFailed);
return -1;
}
- void close() Q_DECL_OVERRIDE
+ void close() override
{
QIODevice::close();
deleteLater();
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index 17177c7fb..16a3d32b6 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -588,8 +588,8 @@ class KeyEventRecordingWidget : public QWidget {
public:
QList<QKeyEvent> pressEvents;
QList<QKeyEvent> releaseEvents;
- void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE { pressEvents << *e; }
- void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE { releaseEvents << *e; }
+ void keyPressEvent(QKeyEvent *e) override { pressEvents << *e; }
+ void keyReleaseEvent(QKeyEvent *e) override { releaseEvents << *e; }
};
void tst_QWebEngineView::unhandledKeyEventPropagation()
@@ -879,7 +879,7 @@ public:
explicit KeyboardAndMouseEventRecordingWidget(QWidget *parent = 0) :
QWidget(parent), m_eventCounter(0) {}
- bool event(QEvent *event) Q_DECL_OVERRIDE
+ bool event(QEvent *event) override
{
QString eventString;
switch (event->type()) {