diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-06-11 17:18:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-06-11 18:34:14 +0200 |
commit | 6c2a111f8c82b56388abf409a61a3e0d56a52156 (patch) | |
tree | 0f5a7ad320f034233c065fc994980b10afe434ad /tests/auto/widgets/qwebenginepage | |
parent | c4fc323d0771e24ae726065cdce9eafef2c09c41 (diff) | |
parent | d6e3ba85138a6147b9b34a1c3363b2d3b20ba284 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ib010ede9756fb02992a3276ae7ec90ef1ab56a00
Diffstat (limited to 'tests/auto/widgets/qwebenginepage')
-rw-r--r-- | tests/auto/widgets/qwebenginepage/BLACKLIST | 6 | ||||
-rw-r--r-- | tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 18 |
2 files changed, 8 insertions, 16 deletions
diff --git a/tests/auto/widgets/qwebenginepage/BLACKLIST b/tests/auto/widgets/qwebenginepage/BLACKLIST index b48e77a50..fcd36ba83 100644 --- a/tests/auto/widgets/qwebenginepage/BLACKLIST +++ b/tests/auto/widgets/qwebenginepage/BLACKLIST @@ -1,8 +1,2 @@ [macCopyUnicodeToClipboard] osx - -[getUserMediaRequest] -windows - -[setHtmlWithImageResource] -* diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 8c9161790..dbaa63f86 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -3955,28 +3955,26 @@ void tst_QWebEnginePage::setHtml() void tst_QWebEnginePage::setHtmlWithImageResource() { - // By default, only security origins of local files can load local resources. - // So we should specify baseUrl to be a local file in order to get a proper origin and load the local image. + // We allow access to qrc resources from any security origin, including local and anonymous QLatin1String html("<html><body><p>hello world</p><img src='qrc:/resources/image.png'/></body></html>"); QWebEnginePage page; - page.setHtml(html, QUrl(QLatin1String("file:///path/to/file"))); - waitForSignal(&page, SIGNAL(loadFinished(bool))); + QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); + page.setHtml(html, QUrl("file:///path/to/file")); + QTRY_COMPARE(spy.count(), 1); QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1); QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 128); QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].height").toInt(), 128); - // Now we test the opposite: without a baseUrl as a local file, we cannot request local resources. + // Now we test the opposite: without a baseUrl as a local file, we can still request qrc resources. page.setHtml(html); - waitForSignal(&page, SIGNAL(loadFinished(bool))); + QTRY_COMPARE(spy.count(), 2); QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1); - QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118659", Continue); - QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 0); - QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118659", Continue); - QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].height").toInt(), 0); + QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 128); + QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].height").toInt(), 128); } void tst_QWebEnginePage::setHtmlWithStylesheetResource() |