summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2019-09-23 18:16:53 +0200
committerSzabolcs David <davidsz@inf.u-szeged.hu>2019-09-30 13:49:48 +0000
commitcf7e52018a95f4a73fdb191147c4d5281edb13af (patch)
tree97e374da52d2f80bb21a5759f9bb76291cd6330b /tests
parent35b00ef95fe05dbda8af6e35dbefefc0de17a1dd (diff)
Support qrc protocol in @match rules of user scripts
Pulls in the following Chromium changes: 7ac85fb4cc6 Fix building with pulseaudio 13 7956dfb8d20 Support qrc protocol in UrlPattern 9af3b1bf632 Fix pressure of tablet events Task-number: QTBUG-76173 Change-Id: Iffc21ed6eb0a99e2b96780ce4f11629d38f8b47e Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
index 90361f2c9..2e8687d9b 100644
--- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
+++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
@@ -71,6 +71,7 @@ private Q_SLOTS:
#endif
void noTransportWithoutWebChannel();
void scriptsInNestedIframes();
+ void matchQrcUrl();
};
void tst_QWebEngineScript::domEditing()
@@ -589,6 +590,33 @@ void tst_QWebEngineScript::webChannelWithBadString()
QCOMPARE(host.text(), data);
}
#endif
+
+void tst_QWebEngineScript::matchQrcUrl()
+{
+ QWebEnginePage page;
+ QWebEngineView view;
+ view.setPage(&page);
+ QWebEngineScript s;
+ s.setInjectionPoint(QWebEngineScript::DocumentReady);
+ s.setWorldId(QWebEngineScript::MainWorld);
+
+
+ s.setSourceCode(QStringLiteral(R"(
+// ==UserScript==
+// @match qrc:/*main.html
+// ==/UserScript==
+
+document.title = 'New title';
+ )"));
+
+ page.scripts().insert(s);
+ page.load(QUrl("qrc:/resources/test_iframe_main.html"));
+ view.show();
+ QSignalSpy spyFinished(&page, &QWebEnginePage::loadFinished);
+ QVERIFY(spyFinished.wait());
+ QCOMPARE(page.title(), "New title");
+}
+
QTEST_MAIN(tst_QWebEngineScript)
#include "tst_qwebenginescript.moc"