summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-16 13:09:44 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-16 17:01:24 +0100
commit819e00f71e37f5230b9b2c2ff756db4cc4cfda5e (patch)
treeed8f247651f06581c462c6cbefde4fa097000946 /tests/auto
parent9ed734bfdd7b70f4f7f8e78529ead40031607f99 (diff)
parent2620f6baa55dc13d65ea0d4b09a23ddfae580279 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/3rdparty src/core/web_contents_adapter.cpp src/webengine/api/qquickwebengineprofile.cpp src/webenginewidgets/api/qwebengineprofile.cpp tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp Change-Id: I56c093ebab5ee8b577783ce71761719159cd3ddd
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp21
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp19
2 files changed, 36 insertions, 4 deletions
diff --git a/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp b/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp
index 7094c8e4b..83e8d1101 100644
--- a/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp
+++ b/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp
@@ -431,6 +431,13 @@ void tst_QWebEngineDownloads::downloadLink()
void tst_QWebEngineDownloads::downloadTwoLinks()
{
HttpServer server;
+ QSignalSpy requestSpy(&server, &HttpServer::newRequest);
+ QList<HttpReqRep*> results;
+ connect(&server, &HttpServer::newRequest, [&](HttpReqRep *rr) {
+ rr->setParent(nullptr);
+ results.append(rr);
+ });
+
QWebEngineProfile profile;
QWebEnginePage page(&profile);
QWebEngineView view;
@@ -438,7 +445,8 @@ void tst_QWebEngineDownloads::downloadTwoLinks()
view.load(server.url());
view.show();
- auto indexRR = waitForRequest(&server);
+ QTRY_COMPARE(requestSpy.count(), 1);
+ std::unique_ptr<HttpReqRep> indexRR(results.takeFirst());
QVERIFY(indexRR);
QCOMPARE(indexRR->requestMethod(), QByteArrayLiteral("GET"));
QCOMPARE(indexRR->requestPath(), QByteArrayLiteral("/"));
@@ -449,19 +457,24 @@ void tst_QWebEngineDownloads::downloadTwoLinks()
QVERIFY(waitForSignal(&page, &QWebEnginePage::loadFinished, [&](bool ok){ loadOk = ok; }));
QVERIFY(loadOk);
- auto favIconRR = waitForFaviconRequest(&server);
+ QTRY_COMPARE(requestSpy.count(), 2);
+ std::unique_ptr<HttpReqRep> favIconRR(results.takeFirst());
QVERIFY(favIconRR);
+ favIconRR->setResponseStatus(404);
+ favIconRR->sendResponse();
QTRY_VERIFY(view.focusWidget());
QWidget *renderWidget = view.focusWidget();
QTest::mouseClick(renderWidget, Qt::LeftButton, {}, QPoint(10, 10));
QTest::mouseClick(renderWidget, Qt::LeftButton, {}, QPoint(10, 30));
- auto file1RR = waitForRequest(&server);
+ QTRY_VERIFY(requestSpy.count() >= 3);
+ std::unique_ptr<HttpReqRep> file1RR(results.takeFirst());
QVERIFY(file1RR);
QCOMPARE(file1RR->requestMethod(), QByteArrayLiteral("GET"));
QCOMPARE(file1RR->requestPath(), QByteArrayLiteral("/file1"));
- auto file2RR = waitForRequest(&server);
+ QTRY_COMPARE(requestSpy.count(), 4);
+ std::unique_ptr<HttpReqRep> file2RR(results.takeFirst());
QVERIFY(file2RR);
QCOMPARE(file2RR->requestMethod(), QByteArrayLiteral("GET"));
QCOMPARE(file2RR->requestPath(), QByteArrayLiteral("/file2"));
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 1c9b668ae..54cf27066 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -29,6 +29,7 @@
#include <QMainWindow>
#include <QMenu>
#include <QMimeDatabase>
+#include <QNetworkProxy>
#include <QOpenGLWidget>
#include <QPaintEngine>
#include <QPushButton>
@@ -215,6 +216,7 @@ private Q_SLOTS:
void viewSource();
void viewSourceURL_data();
void viewSourceURL();
+ void proxyConfigWithUnexpectedHostPortPair();
private:
static QPoint elementCenter(QWebEnginePage *page, const QString &id);
@@ -4528,6 +4530,23 @@ void tst_QWebEnginePage::viewSourceURL()
QVERIFY(!page.action(QWebEnginePage::ViewSource)->isEnabled());
}
+Q_DECLARE_METATYPE(QNetworkProxy::ProxyType);
+
+void tst_QWebEnginePage::proxyConfigWithUnexpectedHostPortPair()
+{
+ // Chromium expects a proxy of type NoProxy to not have a host or port set.
+
+ QNetworkProxy proxy;
+ proxy.setType(QNetworkProxy::NoProxy);
+ proxy.setHostName(QStringLiteral("127.0.0.1"));
+ proxy.setPort(244);
+ QNetworkProxy::setApplicationProxy(proxy);
+
+ QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
+ m_page->load(QStringLiteral("http://127.0.0.1:245/"));
+ QTRY_COMPARE(loadFinishedSpy.count(), 1);
+}
+
static QByteArrayList params = {QByteArrayLiteral("--use-fake-device-for-media-stream")};
W_QTEST_MAIN(tst_QWebEnginePage, params)