summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp23
-rw-r--r--tests/auto/quick/qquickwebengineview/BLACKLIST4
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp40
-rw-r--r--tests/auto/widgets/proxypac/proxypac.pro24
-rw-r--r--tests/auto/widgets/qwebengineview/BLACKLIST3
-rw-r--r--tests/auto/widgets/widgets.pro6
6 files changed, 55 insertions, 45 deletions
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
index 7b7fec6f4..5629998fd 100644
--- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
@@ -107,6 +107,7 @@ public:
void interceptRequest(QWebEngineUrlRequestInfo &info) override
{
+ QVERIFY(QThread::currentThread() == QCoreApplication::instance()->thread());
// Since 63 we also intercept some unrelated blob requests..
if (info.requestUrl().scheme() == QLatin1String("blob"))
return;
@@ -167,7 +168,7 @@ void tst_QWebEngineUrlRequestInterceptor::interceptRequest()
QWebEngineProfile profile;
profile.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
TestRequestInterceptor interceptor(/* intercept */ true);
- profile.setRequestInterceptor(&interceptor);
+ profile.setUrlRequestInterceptor(&interceptor);
QWebEnginePage page(&profile);
QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
@@ -197,7 +198,7 @@ void tst_QWebEngineUrlRequestInterceptor::interceptRequest()
// Make sure that registering an observer does not modify the request.
TestRequestInterceptor observer(/* intercept */ false);
- profile.setRequestInterceptor(&observer);
+ profile.setUrlRequestInterceptor(&observer);
page.load(QUrl("qrc:///resources/__placeholder__"));
QTRY_COMPARE(loadSpy.count(), 1);
success = loadSpy.takeFirst().takeFirst();
@@ -230,7 +231,7 @@ void tst_QWebEngineUrlRequestInterceptor::ipv6HostEncoding()
{
QWebEngineProfile profile;
LocalhostContentProvider contentProvider;
- profile.setRequestInterceptor(&contentProvider);
+ profile.setUrlRequestInterceptor(&contentProvider);
QWebEnginePage page(&profile);
QSignalSpy spyLoadFinished(&page, SIGNAL(loadFinished(bool)));
@@ -264,11 +265,11 @@ void tst_QWebEngineUrlRequestInterceptor::requestedUrl()
profile.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
TestRequestInterceptor interceptor(/* intercept */ true);
if (!interceptInPage)
- profile.setRequestInterceptor(&interceptor);
+ profile.setUrlRequestInterceptor(&interceptor);
QWebEnginePage page(&profile);
if (interceptInPage)
- page.setRequestInterceptor(&interceptor);
+ page.setUrlRequestInterceptor(&interceptor);
QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
page.setUrl(QUrl("qrc:///resources/__placeholder__"));
@@ -303,11 +304,11 @@ void tst_QWebEngineUrlRequestInterceptor::setUrlSameUrl()
QWebEngineProfile profile;
TestRequestInterceptor interceptor(/* intercept */ true);
if (!interceptInPage)
- profile.setRequestInterceptor(&interceptor);
+ profile.setUrlRequestInterceptor(&interceptor);
QWebEnginePage page(&profile);
if (interceptInPage)
- page.setRequestInterceptor(&interceptor);
+ page.setUrlRequestInterceptor(&interceptor);
QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
page.setUrl(QUrl("qrc:///resources/__placeholder__"));
@@ -336,7 +337,7 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrl()
{
QWebEngineProfile profile;
TestRequestInterceptor interceptor(/* intercept */ false);
- profile.setRequestInterceptor(&interceptor);
+ profile.setUrlRequestInterceptor(&interceptor);
QWebEnginePage page(&profile);
QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
@@ -370,7 +371,7 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlNestedIframes()
QWebEngineProfile profile;
TestRequestInterceptor interceptor(/* intercept */ false);
- profile.setRequestInterceptor(&interceptor);
+ profile.setUrlRequestInterceptor(&interceptor);
QWebEnginePage page(&profile);
QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
@@ -431,7 +432,7 @@ void tst_QWebEngineUrlRequestInterceptor::requestInterceptorByResourceType()
QWebEngineProfile profile;
TestRequestInterceptor interceptor(/* intercept */ false);
- profile.setRequestInterceptor(&interceptor);
+ profile.setUrlRequestInterceptor(&interceptor);
QWebEnginePage page(&profile);
QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
@@ -449,7 +450,7 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlHttp()
{
QWebEngineProfile profile;
TestRequestInterceptor interceptor(/* intercept */ false);
- profile.setRequestInterceptor(&interceptor);
+ profile.setUrlRequestInterceptor(&interceptor);
QWebEnginePage page(&profile);
QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
diff --git a/tests/auto/quick/qquickwebengineview/BLACKLIST b/tests/auto/quick/qquickwebengineview/BLACKLIST
index 5bb38576a..166a6894e 100644
--- a/tests/auto/quick/qquickwebengineview/BLACKLIST
+++ b/tests/auto/quick/qquickwebengineview/BLACKLIST
@@ -15,7 +15,3 @@ opensuse-leap
[javascriptClipboard:canPaste]
opensuse-leap
-
-[changeLocale]
-*
-
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index d467cd8ae..9817e7d6c 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -1001,6 +1001,7 @@ void tst_QQuickWebEngineView::changeLocale()
viewDE->setUrl(url);
QVERIFY(waitForLoadFailed(viewDE.data()));
+ QTRY_VERIFY(!evaluateJavaScriptSync(viewDE.data(), "document.body").isNull());
QTRY_VERIFY(!evaluateJavaScriptSync(viewDE.data(), "document.body.innerText").isNull());
errorLines = evaluateJavaScriptSync(viewDE.data(), "document.body.innerText").toString().split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
QCOMPARE(errorLines.first().toUtf8(), QByteArrayLiteral("Die Website ist nicht erreichbar Die Server-IP-Adresse von non.existent wurde nicht gefunden."));
@@ -1010,9 +1011,10 @@ void tst_QQuickWebEngineView::changeLocale()
viewEN->setUrl(url);
QVERIFY(waitForLoadFailed(viewEN.data()));
+ QTRY_VERIFY(!evaluateJavaScriptSync(viewEN.data(), "document.body").isNull());
QTRY_VERIFY(!evaluateJavaScriptSync(viewEN.data(), "document.body.innerText").isNull());
errorLines = evaluateJavaScriptSync(viewEN.data(), "document.body.innerText").toString().split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
- QCOMPARE(errorLines.first().toUtf8(), QByteArrayLiteral("This site can\xE2\x80\x99t be reached"));
+ QCOMPARE(errorLines.first().toUtf8(), QByteArrayLiteral("This site can\xE2\x80\x99t be reached non.existent\xE2\x80\x99s server IP address could not be found."));
// Reset error page
viewDE->setUrl(QUrl("about:blank"));
@@ -1022,9 +1024,10 @@ void tst_QQuickWebEngineView::changeLocale()
viewDE->setUrl(url);
QVERIFY(waitForLoadFailed(viewDE.data()));
+ QTRY_VERIFY(!evaluateJavaScriptSync(viewDE.data(), "document.body").isNull());
QTRY_VERIFY(!evaluateJavaScriptSync(viewDE.data(), "document.body.innerText").isNull());
errorLines = evaluateJavaScriptSync(viewDE.data(), "document.body.innerText").toString().split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts);
- QCOMPARE(errorLines.first().toUtf8(), QByteArrayLiteral("Die Website ist nicht erreichbar"));
+ QCOMPARE(errorLines.first().toUtf8(), QByteArrayLiteral("Die Website ist nicht erreichbar Die Server-IP-Adresse von non.existent wurde nicht gefunden."));
}
void tst_QQuickWebEngineView::userScripts()
@@ -1110,6 +1113,39 @@ void tst_QQuickWebEngineView::javascriptClipboard()
QCOMPARE(evaluateJavaScriptSync(view, "document.execCommand('paste')").toBool(), pasteResult);
QCOMPARE(evaluateJavaScriptSync(view, "document.getElementById('myInput').value").toString(),
(pasteResult ? QString("AnotherText") : QString("OriginalText")));
+
+ // Test settings on clipboard permissions
+ evaluateJavaScriptSync(view,
+ QStringLiteral(
+ "var accessGranted = false;"
+ "var accessDenied = false;"
+ "var accessPrompt = false;"
+ "navigator.permissions.query({name:'clipboard-write'})"
+ ".then(result => {"
+ "if (result.state == 'granted') accessGranted = true;"
+ "if (result.state == 'denied') accessDenied = true;"
+ "if (result.state == 'prompt') accessPrompt = true;"
+ "})"));
+
+ QTRY_COMPARE(evaluateJavaScriptSync(view, "accessGranted").toBool(), copyResult);
+ QTRY_COMPARE(evaluateJavaScriptSync(view, "accessDenied").toBool(), !javascriptCanAccessClipboard);
+ QTRY_COMPARE(evaluateJavaScriptSync(view, "accessPrompt").toBool(), false);
+
+ evaluateJavaScriptSync(view,
+ QStringLiteral(
+ "accessGranted = false;"
+ "accessDenied = false;"
+ "accessPrompt = false;"
+ "navigator.permissions.query({name:'clipboard-read'})"
+ ".then(result => {"
+ "if (result.state == 'granted') accessGranted = true;"
+ "if (result.state == 'denied') accessDenied = true;"
+ "if (result.state == 'prompt') accessPrompt = true;"
+ "})"));
+
+ QTRY_COMPARE(evaluateJavaScriptSync(view, "accessGranted").toBool(), pasteResult);
+ QTRY_COMPARE(evaluateJavaScriptSync(view, "accessDenied").toBool(), !javascriptCanAccessClipboard || !javascriptCanPaste);
+ QTRY_COMPARE(evaluateJavaScriptSync(view, "accessPrompt").toBool(), false);
}
QTEST_MAIN(tst_QQuickWebEngineView)
diff --git a/tests/auto/widgets/proxypac/proxypac.pro b/tests/auto/widgets/proxypac/proxypac.pro
index 00ae90977..1c2958d3a 100644
--- a/tests/auto/widgets/proxypac/proxypac.pro
+++ b/tests/auto/widgets/proxypac/proxypac.pro
@@ -3,26 +3,8 @@ QT += webengine
HEADERS += proxyserver.h
SOURCES += proxyserver.cpp
-# QTBUG-71229
-xgd_desktop.name=XDG_CURRENT_DESKTOP
-xgd_desktop.value=KDE
-QT_TOOL_ENV += xgd_desktop
+proxy_pac.name = QTWEBENGINE_CHROMIUM_FLAGS
+proxy_pac.value = --proxy-pac-url="file://$$PWD/proxy.pac"
-kde_home.name=KDEHOME
-kde_home.value=$$OUT_PWD
-QT_TOOL_ENV += kde_home
-
-PROXY_CONFIG= \
- "[Proxy Settings]" \
- "Proxy Config Script=$$PWD/proxy.pac" \
- "ProxyType=2"
-
-mkpath($$OUT_PWD/share/config)
-KDE_FILE = $$OUT_PWD/share/config/kioslaverc
-
-!build_pass {
- write_file($$KDE_FILE, PROXY_CONFIG)
-}
-
-QMAKE_DISTCLEAN += $$KDE_FILE
+QT_TOOL_ENV += proxy_pac
diff --git a/tests/auto/widgets/qwebengineview/BLACKLIST b/tests/auto/widgets/qwebengineview/BLACKLIST
index e8758abcc..7c86a72d6 100644
--- a/tests/auto/widgets/qwebengineview/BLACKLIST
+++ b/tests/auto/widgets/qwebengineview/BLACKLIST
@@ -6,6 +6,3 @@ osx
[textSelectionOutOfInputField]
*
-
-[changeLocale]
-*
diff --git a/tests/auto/widgets/widgets.pro b/tests/auto/widgets/widgets.pro
index eec8bb389..0addb9671 100644
--- a/tests/auto/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets.pro
@@ -9,6 +9,7 @@ SUBDIRS += \
faviconmanager \
loadsignals \
origins \
+ proxypac \
schemes \
shutdown \
qwebenginedownloaditem \
@@ -27,9 +28,6 @@ qtConfig(webengine-printing-and-pdf) {
SUBDIRS += printing
}
-# QTBUG-71229
-linux:!boot2qt: SUBDIRS += proxypac
-
qtConfig(webengine-spellchecker):!cross_compile {
!qtConfig(webengine-native-spellchecker) {
SUBDIRS += spellchecking
@@ -43,4 +41,4 @@ boot2qt: SUBDIRS -= accessibility defaultsurfaceformat devtools \
faviconmanager qwebenginepage qwebenginehistory \
qwebengineprofile qwebenginescript \
qwebengineview qwebenginedownloaditem qwebenginesettings \
- schemes origins loadsignals
+ schemes origins loadsignals proxypac