summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-05-04 10:02:55 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-05-04 10:03:08 +0200
commitc2f7f09974959c252a5e2879adfffe6356543fff (patch)
treee4cbe144c4f12387082541d1fef0e6b8b903d7cf /tests
parentf58430945e302776e59fe107ae2eab1be76a9332 (diff)
parent662d721dbca23809e821b4d5945187c2969db9e2 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp168
-rw-r--r--tests/auto/quick/qmltests/data/favicon-multi-gray.html9
-rw-r--r--tests/auto/quick/qmltests/data/icons/grayicons.icobin0 -> 22150 bytes
-rw-r--r--tests/auto/quick/qmltests/data/localStorage.html9
-rw-r--r--tests/auto/quick/qmltests/data/tst_favicon.qml92
-rw-r--r--tests/auto/quick/qmltests/data/tst_faviconDownload.qml6
-rw-r--r--tests/auto/quick/qmltests/data/tst_settings.qml120
-rw-r--r--tests/auto/quick/qmltests/qmltests.pro4
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp65
-rw-r--r--tests/auto/quick/shared/testwindow.h45
-rw-r--r--tests/auto/quick/shared/util.h45
-rw-r--r--tests/auto/widgets/qwebengineinspector/tst_qwebengineinspector.cpp45
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp28
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp57
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp2
-rw-r--r--tests/auto/widgets/util.h46
16 files changed, 641 insertions, 100 deletions
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 381a707c2..34170da8a 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -202,6 +202,155 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.grantFeaturePermission(QUrl,Feature,bool) --> void"
<< "QQuickWebEngineView.setActiveFocusOnPress(bool) --> void"
<< "QQuickWebEngineView.triggerWebAction(WebAction) --> void"
+ << "QQuickWebEngineView.Unselect --> WebAction"
+ << "QQuickWebEngineView.SavePage --> WebAction"
+ << "QQuickWebEngineView.A4 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B5 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Letter --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Legal --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Executive --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A0 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A1 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A2 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A3 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A5 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A6 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A7 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A8 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A9 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B0 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B1 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B10 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B2 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B3 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B4 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B6 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B7 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B8 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B9 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.C5E --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Comm10E --> PrintedPageSizeId"
+ << "QQuickWebEngineView.DLE --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Folio --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Ledger --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Tabloid --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Custom --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A10 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A3Extra --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A4Extra --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A4Plus --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A4Small --> PrintedPageSizeId"
+ << "QQuickWebEngineView.A5Extra --> PrintedPageSizeId"
+ << "QQuickWebEngineView.B5Extra --> PrintedPageSizeId"
+ << "QQuickWebEngineView.JisB0 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.JisB1 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.JisB2 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.JisB3 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.JisB4 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.JisB5 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.JisB6 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.JisB7 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.JisB8 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.JisB9 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.JisB10 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.AnsiC --> PrintedPageSizeId"
+ << "QQuickWebEngineView.AnsiD --> PrintedPageSizeId"
+ << "QQuickWebEngineView.AnsiE --> PrintedPageSizeId"
+ << "QQuickWebEngineView.LegalExtra --> PrintedPageSizeId"
+ << "QQuickWebEngineView.LetterExtra --> PrintedPageSizeId"
+ << "QQuickWebEngineView.LetterPlus --> PrintedPageSizeId"
+ << "QQuickWebEngineView.LetterSmall --> PrintedPageSizeId"
+ << "QQuickWebEngineView.TabloidExtra --> PrintedPageSizeId"
+ << "QQuickWebEngineView.ArchA --> PrintedPageSizeId"
+ << "QQuickWebEngineView.ArchB --> PrintedPageSizeId"
+ << "QQuickWebEngineView.ArchC --> PrintedPageSizeId"
+ << "QQuickWebEngineView.ArchD --> PrintedPageSizeId"
+ << "QQuickWebEngineView.ArchE --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Imperial7x9 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Imperial8x10 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Imperial9x11 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Imperial9x12 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Imperial10x11 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Imperial10x13 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Imperial10x14 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Imperial12x11 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Imperial15x11 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.ExecutiveStandard --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Note --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Quarto --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Statement --> PrintedPageSizeId"
+ << "QQuickWebEngineView.SuperA --> PrintedPageSizeId"
+ << "QQuickWebEngineView.SuperB --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Postcard --> PrintedPageSizeId"
+ << "QQuickWebEngineView.DoublePostcard --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Prc16K --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Prc32K --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Prc32KBig --> PrintedPageSizeId"
+ << "QQuickWebEngineView.FanFoldUS --> PrintedPageSizeId"
+ << "QQuickWebEngineView.FanFoldGerman --> PrintedPageSizeId"
+ << "QQuickWebEngineView.FanFoldGermanLegal --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeB4 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeB5 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeB6 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeC0 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeC1 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeC2 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeC3 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeC4 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeC6 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeC65 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeC7 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Envelope9 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Envelope11 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Envelope12 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Envelope14 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeMonarch --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopePersonal --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeChou3 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeChou4 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeInvite --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeItalian --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeKaku2 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeKaku3 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopePrc1 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopePrc2 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopePrc3 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopePrc4 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopePrc5 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopePrc6 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopePrc7 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopePrc8 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopePrc9 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopePrc10 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeYou4 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.LastPageSize --> PrintedPageSizeId"
+ << "QQuickWebEngineView.NPageSize --> PrintedPageSizeId"
+ << "QQuickWebEngineView.NPaperSize --> PrintedPageSizeId"
+ << "QQuickWebEngineView.AnsiA --> PrintedPageSizeId"
+ << "QQuickWebEngineView.AnsiB --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeC5 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.EnvelopeDL --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Envelope10 --> PrintedPageSizeId"
+ << "QQuickWebEngineView.Portrait --> PrintedPageOrientation"
+ << "QQuickWebEngineView.Landscape --> PrintedPageOrientation"
+ << "QQuickWebEngineView.contentsSize --> QSizeF"
+ << "QQuickWebEngineView.scrollPosition --> QPointF"
+ << "QQuickWebEngineView.audioMuted --> bool"
+ << "QQuickWebEngineView.recentlyAudible --> bool"
+ << "QQuickWebEngineView.webChannelWorld --> uint"
+ << "QQuickWebEngineView.contentsSizeChanged(QSizeF) --> void"
+ << "QQuickWebEngineView.scrollPositionChanged(QPointF) --> void"
+ << "QQuickWebEngineView.audioMutedChanged(bool) --> void"
+ << "QQuickWebEngineView.recentlyAudibleChanged(bool) --> void"
+ << "QQuickWebEngineView.webChannelWorldChanged(uint) --> void"
+ << "QQuickWebEngineView.runJavaScript(QString,uint,QJSValue) --> void"
+ << "QQuickWebEngineView.runJavaScript(QString,uint) --> void"
+ << "QQuickWebEngineView.printToPdf(QString,PrintedPageSizeId,PrintedPageOrientation) --> void"
+ << "QQuickWebEngineView.printToPdf(QString,PrintedPageSizeId) --> void"
+ << "QQuickWebEngineView.printToPdf(QString) --> void"
+ << "QQuickWebEngineView.printToPdf(QJSValue,PrintedPageSizeId,PrintedPageOrientation) --> void"
+ << "QQuickWebEngineView.printToPdf(QJSValue,PrintedPageSizeId) --> void"
+ << "QQuickWebEngineView.printToPdf(QJSValue) --> void"
<< "QQuickWebEngineCertificateError.SslPinnedKeyNotInCertificateChain --> Error"
<< "QQuickWebEngineCertificateError.CertificateCommonNameInvalid --> Error"
<< "QQuickWebEngineCertificateError.CertificateDateInvalid --> Error"
@@ -240,6 +389,12 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineDownloadItem.pathChanged() --> void"
<< "QQuickWebEngineDownloadItem.accept() --> void"
<< "QQuickWebEngineDownloadItem.cancel() --> void"
+ << "QQuickWebEngineDownloadItem.UnknownSaveFormat --> SavePageFormat"
+ << "QQuickWebEngineDownloadItem.SingleHtmlSaveFormat --> SavePageFormat"
+ << "QQuickWebEngineDownloadItem.CompleteHtmlSaveFormat --> SavePageFormat"
+ << "QQuickWebEngineDownloadItem.MimeHtmlSaveFormat --> SavePageFormat"
+ << "QQuickWebEngineDownloadItem.savePageFormat --> SavePageFormat"
+ << "QQuickWebEngineDownloadItem.savePageFormatChanged() --> void"
<< "QQuickWebEngineHistory.items --> QQuickWebEngineHistoryListModel*"
<< "QQuickWebEngineHistory.backItems --> QQuickWebEngineHistoryListModel*"
<< "QQuickWebEngineHistory.forwardItems --> QQuickWebEngineHistoryListModel*"
@@ -281,6 +436,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineProfile.httpAcceptLanguageChanged() --> void"
<< "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void"
<< "QQuickWebEngineProfile.downloadFinished(QQuickWebEngineDownloadItem*) --> void"
+ << "QQuickWebEngineProfile.NoCache --> HttpCacheType"
<< "QQuickWebEngineScript.Deferred --> InjectionPoint"
<< "QQuickWebEngineScript.DocumentReady --> InjectionPoint"
<< "QQuickWebEngineScript.DocumentCreation --> InjectionPoint"
@@ -334,6 +490,18 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineSettings.pluginsEnabledChanged() --> void"
<< "QQuickWebEngineSettings.fullScreenSupportEnabledChanged() --> void"
<< "QQuickWebEngineSettings.defaultTextEncodingChanged() --> void"
+ << "QQuickWebEngineSettings.screenCaptureEnabled --> bool"
+ << "QQuickWebEngineSettings.webGLEnabled --> bool"
+ << "QQuickWebEngineSettings.webAudioEnabled --> bool"
+ << "QQuickWebEngineSettings.accelerated2dCanvasEnabled --> bool"
+ << "QQuickWebEngineSettings.autoLoadIconsForPage --> bool"
+ << "QQuickWebEngineSettings.touchIconsEnabled --> bool"
+ << "QQuickWebEngineSettings.screenCaptureEnabledChanged() --> void"
+ << "QQuickWebEngineSettings.webGLEnabledChanged() --> void"
+ << "QQuickWebEngineSettings.webAudioEnabledChanged() --> void"
+ << "QQuickWebEngineSettings.accelerated2dCanvasEnabledChanged() --> void"
+ << "QQuickWebEngineSettings.autoLoadIconsForPageChanged() --> void"
+ << "QQuickWebEngineSettings.touchIconsEnabledChanged() --> void"
<< "QQuickWebEngineFullScreenRequest.origin --> QUrl"
<< "QQuickWebEngineFullScreenRequest.toggleOn --> bool"
<< "QQuickWebEngineFullScreenRequest.accept() --> void"
diff --git a/tests/auto/quick/qmltests/data/favicon-multi-gray.html b/tests/auto/quick/qmltests/data/favicon-multi-gray.html
new file mode 100644
index 000000000..d6ac0909f
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/favicon-multi-gray.html
@@ -0,0 +1,9 @@
+<html>
+ <head>
+ <title>Gray Multi-sized Favicon Test</title>
+ <link rel="shortcut icon" href="icons/grayicons.ico" />
+ </head>
+ <body>
+ <h1>Gray Multi-sized Favicon Test</h1>
+ </body>
+</html>
diff --git a/tests/auto/quick/qmltests/data/icons/grayicons.ico b/tests/auto/quick/qmltests/data/icons/grayicons.ico
new file mode 100644
index 000000000..8d8fee839
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/icons/grayicons.ico
Binary files differ
diff --git a/tests/auto/quick/qmltests/data/localStorage.html b/tests/auto/quick/qmltests/data/localStorage.html
new file mode 100644
index 000000000..a4e395f48
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/localStorage.html
@@ -0,0 +1,9 @@
+<html>
+<head><title>Original Title</title></head>
+<body>
+<script type="text/javascript">
+document.title = localStorage.getItem('title');
+localStorage.setItem('title', 'New Title');
+</script>
+</body>
+</html>
diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests/data/tst_favicon.qml
index 26e39f48c..e959f19be 100644
--- a/tests/auto/quick/qmltests/data/tst_favicon.qml
+++ b/tests/auto/quick/qmltests/data/tst_favicon.qml
@@ -50,6 +50,10 @@ TestWebEngineView {
}
}
+ function removeFaviconProviderPrefix(url) {
+ return url.toString().substring(16)
+ }
+
SignalSpy {
id: iconChangedSpy
target: webEngineView
@@ -64,6 +68,7 @@ TestWebEngineView {
TestCase {
id: test
name: "WebEngineFavicon"
+ when: windowShown
function init() {
if (webEngineView.icon != '') {
@@ -185,7 +190,7 @@ TestWebEngineView {
iconChangedSpy.wait()
compare(iconChangedSpy.count, 1)
- iconUrl = webEngineView.icon
+ iconUrl = removeFaviconProviderPrefix(webEngineView.icon)
// Touch icon is ignored
compare(iconUrl, Qt.resolvedUrl("icons/qt32.ico"))
compare(favicon.width, 32)
@@ -199,13 +204,13 @@ TestWebEngineView {
iconChangedSpy.wait()
verify(iconChangedSpy.count >= 1)
- iconUrl = webEngineView.icon
+ iconUrl = removeFaviconProviderPrefix(webEngineView.icon)
// If the icon URL is empty we have to wait for
// the second iconChanged signal that propagates the expected URL
if (iconUrl == Qt.resolvedUrl("")) {
tryCompare(iconChangedSpy, "count", 2)
- iconUrl = webEngineView.icon
+ iconUrl = removeFaviconProviderPrefix(webEngineView.icon)
}
compare(iconUrl, Qt.resolvedUrl("icons/qt144.png"))
@@ -224,6 +229,21 @@ TestWebEngineView {
var iconUrl = webEngineView.icon
compare(iconUrl, Qt.resolvedUrl(""))
+ compare(favicon.width, 0)
+ compare(favicon.height, 0)
+
+ WebEngine.settings.touchIconsEnabled = true
+
+ url = Qt.resolvedUrl("favicon-touch.html")
+ webEngineView.url = url
+ verify(webEngineView.waitForLoadSucceeded())
+
+ iconChangedSpy.wait()
+ iconUrl = removeFaviconProviderPrefix(webEngineView.icon)
+ compare(iconUrl, Qt.resolvedUrl("icons/qt144.png"))
+ compare(iconChangedSpy.count, 1)
+ compare(favicon.width, 144)
+ compare(favicon.height, 144)
}
function test_multiIcon() {
@@ -235,11 +255,69 @@ TestWebEngineView {
iconChangedSpy.wait()
compare(iconChangedSpy.count, 1)
+ compare(favicon.width, 64)
+ compare(favicon.height, 64)
+ }
- // Image QML type does not support multi-sized icons thus
- // chooses the first size
- compare(favicon.width, 16)
- compare(favicon.height, 16)
+ function test_faviconProvider_data() {
+ return [
+ { tag: "8x8", size: 8, value: 16 },
+ { tag: "16x16", size: 16, value: 16 },
+ { tag: "17x17", size: 17, value: 32 },
+ { tag: "31x31", size: 31, value: 32 },
+ { tag: "32x32", size: 32, value: 32 },
+ { tag: "33x33", size: 33, value: 64 },
+ { tag: "64x64", size: 64, value: 64 },
+ { tag: "128x128", size: 128, value: 128 },
+ { tag: "255x255", size: 255, value: 255 },
+ { tag: "256x256", size: 256, value: 255 },
+ ];
+ }
+
+ function test_faviconProvider(row) {
+ var faviconImage = Qt.createQmlObject("
+ import QtQuick 2.5\n
+ Image { sourceSize: Qt.size(width, height) }", test)
+ var grabImage = Qt.createQmlObject("
+ import QtQuick 2.5\n
+ Image { }", test)
+ var faviconCanvas = Qt.createQmlObject("
+ import QtQuick 2.5\n
+ Canvas { }", test)
+
+ compare(iconChangedSpy.count, 0)
+
+ var url = Qt.resolvedUrl("favicon-multi-gray.html")
+ webEngineView.url = url
+ verify(webEngineView.waitForLoadSucceeded())
+
+ iconChangedSpy.wait()
+ compare(iconChangedSpy.count, 1)
+
+ faviconImage.width = row.size
+ faviconImage.height = row.size
+ faviconImage.source = webEngineView.icon
+ verify(_waitFor(function() { return faviconImage.status == Image.Ready } ))
+
+ faviconImage.grabToImage(function(result) {
+ grabImage.source = result.url
+ })
+ verify(_waitFor(function() { return grabImage.status == Image.Ready } ))
+
+ faviconCanvas.width = faviconImage.width
+ faviconCanvas.height = faviconImage.height
+ var ctx = faviconCanvas.getContext("2d")
+ ctx.drawImage(grabImage, 0, 0, grabImage.width, grabImage.height)
+
+ var center = Math.round(row.size/2)
+ var imageData = ctx.getImageData(center, center, center, center)
+ var pixel = imageData.data
+
+ compare(pixel[0], row.value)
+
+ faviconImage.destroy()
+ grabImage.destroy()
+ faviconCanvas.destroy()
}
}
}
diff --git a/tests/auto/quick/qmltests/data/tst_faviconDownload.qml b/tests/auto/quick/qmltests/data/tst_faviconDownload.qml
index e4dfb36aa..406dfa3ea 100644
--- a/tests/auto/quick/qmltests/data/tst_faviconDownload.qml
+++ b/tests/auto/quick/qmltests/data/tst_faviconDownload.qml
@@ -35,6 +35,10 @@ TestWebEngineView {
width: 200
height: 400
+ function removeFaviconProviderPrefix(url) {
+ return url.toString().substring(16)
+ }
+
SignalSpy {
id: iconChangedSpy
target: webEngineView
@@ -108,7 +112,7 @@ TestWebEngineView {
iconChangedSpy.wait()
compare(iconChangedSpy.count, 1)
- var iconUrl = webEngineView.icon
+ var iconUrl = removeFaviconProviderPrefix(webEngineView.icon)
compare(iconUrl, row.expectedIconUrl)
}
}
diff --git a/tests/auto/quick/qmltests/data/tst_settings.qml b/tests/auto/quick/qmltests/data/tst_settings.qml
new file mode 100644
index 000000000..aa3a6dc60
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/tst_settings.qml
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebEngine 1.2
+
+TestWebEngineView {
+ id: webEngineView
+ width: 400
+ height: 300
+
+ TestCase {
+ name: "WebEngineViewSettings"
+
+ function test_javascriptEnabled() {
+ webEngineView.settings.javascriptEnabled = true;
+
+ webEngineView.url = Qt.resolvedUrl("javascript.html");
+ verify(webEngineView.waitForLoadSucceeded());
+ compare(webEngineView.title, "New Title");
+ }
+
+ function test_javascriptDisabled() {
+ webEngineView.settings.javascriptEnabled = false;
+
+ webEngineView.url = Qt.resolvedUrl("javascript.html");
+ verify(webEngineView.waitForLoadSucceeded());
+ compare(webEngineView.title, "Original Title");
+ }
+
+ function test_localStorageDisabled() {
+ webEngineView.settings.javascriptEnabled = true;
+ webEngineView.settings.localStorageEnabled = false;
+
+ webEngineView.url = Qt.resolvedUrl("localStorage.html");
+ verify(webEngineView.waitForLoadSucceeded());
+ compare(webEngineView.title, "Original Title");
+ }
+
+ function test_localStorageEnabled() {
+ webEngineView.settings.localStorageEnabled = true;
+ webEngineView.settings.javascriptEnabled = true;
+
+ webEngineView.url = Qt.resolvedUrl("localStorage.html");
+ verify(webEngineView.waitForLoadSucceeded());
+ webEngineView.reload();
+ verify(webEngineView.waitForLoadSucceeded());
+ compare(webEngineView.title, "New Title");
+ }
+
+ function test_settingsAffectCurrentViewOnly() {
+ var webEngineView2 = Qt.createQmlObject('TestWebEngineView {width: 400; height: 300;}', webEngineView);
+
+ webEngineView.settings.javascriptEnabled = true;
+ webEngineView2.settings.javascriptEnabled = true;
+
+ var testUrl = Qt.resolvedUrl("javascript.html");
+
+ webEngineView.url = testUrl;
+ verify(webEngineView.waitForLoadSucceeded());
+ webEngineView2.url = testUrl;
+ verify(webEngineView2.waitForLoadSucceeded());
+
+ compare(webEngineView.title, "New Title");
+ compare(webEngineView2.title, "New Title");
+
+ webEngineView.settings.javascriptEnabled = false;
+
+ webEngineView.url = testUrl;
+ verify(webEngineView.waitForLoadSucceeded());
+ webEngineView2.url = testUrl;
+ verify(webEngineView2.waitForLoadSucceeded());
+
+ compare(webEngineView.title, "Original Title");
+ compare(webEngineView2.title, "New Title");
+
+ webEngineView2.destroy();
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro
index 257c1c4f6..b8f0f7df1 100644
--- a/tests/auto/quick/qmltests/qmltests.pro
+++ b/tests/auto/quick/qmltests/qmltests.pro
@@ -18,6 +18,7 @@ OTHER_FILES += \
$$PWD/data/favicon2.html \
$$PWD/data/favicon-misc.html \
$$PWD/data/favicon-multi.html \
+ $$PWD/data/favicon-multi-gray.html \
$$PWD/data/favicon-single.html \
$$PWD/data/favicon-shortcut.html \
$$PWD/data/favicon-touch.html \
@@ -26,6 +27,7 @@ OTHER_FILES += \
$$PWD/data/geolocation.html \
$$PWD/data/javascript.html \
$$PWD/data/link.html \
+ $$PWD/data/localStorage.html \
$$PWD/data/prompt.html \
$$PWD/data/multifileupload.html \
$$PWD/data/redirect.html \
@@ -60,8 +62,10 @@ OTHER_FILES += \
$$PWD/data/tst_unhandledKeyEventPropagation.qml \
$$PWD/data/tst_userScripts.qml \
$$PWD/data/tst_webchannel.qml \
+ $$PWD/data/tst_settings.qml \
$$PWD/data/tst_keyboardModifierMapping.qml \
$$PWD/data/icons/favicon.png \
+ $$PWD/data/icons/grayicons.ico \
$$PWD/data/icons/small-favicon.png \
$$PWD/data/icons/qt144.png \
$$PWD/data/icons/qt32.ico \
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index f2f5b31f9..0def76d6f 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -1,21 +1,30 @@
-/*
- Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#include "testwindow.h"
#include "util.h"
@@ -60,6 +69,7 @@ private Q_SLOTS:
void inputMethod();
void inputMethodHints();
void basicRenderingSanity();
+ void setZoomFactor();
void printToPdf();
private:
@@ -462,6 +472,25 @@ void tst_QQuickWebEngineView::inputMethodHints()
#endif
}
+void tst_QQuickWebEngineView::setZoomFactor()
+{
+ QQuickWebEngineView *view = webEngineView();
+
+ QVERIFY(qFuzzyCompare(view->zoomFactor(), 1.0));
+ view->setZoomFactor(2.5);
+ QVERIFY(qFuzzyCompare(view->zoomFactor(), 2.5));
+
+ view->setUrl(urlFromTestPath("html/basic_page.html"));
+ QVERIFY(waitForLoadSucceeded(view));
+ QVERIFY(qFuzzyCompare(view->zoomFactor(), 2.5));
+
+ view->setZoomFactor(0.1);
+ QVERIFY(qFuzzyCompare(view->zoomFactor(), 2.5));
+
+ view->setZoomFactor(5.5);
+ QVERIFY(qFuzzyCompare(view->zoomFactor(), 2.5));
+}
+
void tst_QQuickWebEngineView::printToPdf()
{
QTemporaryDir tempDir(QDir::tempPath() + "/tst_qwebengineview-XXXXXX");
diff --git a/tests/auto/quick/shared/testwindow.h b/tests/auto/quick/shared/testwindow.h
index f5181ee97..b57443c69 100644
--- a/tests/auto/quick/shared/testwindow.h
+++ b/tests/auto/quick/shared/testwindow.h
@@ -1,21 +1,30 @@
-/*
- Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#ifndef TESTWINDOW_H
#define TESTWINDOW_H
diff --git a/tests/auto/quick/shared/util.h b/tests/auto/quick/shared/util.h
index 66b42d010..063caa766 100644
--- a/tests/auto/quick/shared/util.h
+++ b/tests/auto/quick/shared/util.h
@@ -1,21 +1,30 @@
-/*
- Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#ifndef UTIL_H
#define UTIL_H
diff --git a/tests/auto/widgets/qwebengineinspector/tst_qwebengineinspector.cpp b/tests/auto/widgets/qwebengineinspector/tst_qwebengineinspector.cpp
index 8d7e41f0f..000214b9a 100644
--- a/tests/auto/widgets/qwebengineinspector/tst_qwebengineinspector.cpp
+++ b/tests/auto/widgets/qwebengineinspector/tst_qwebengineinspector.cpp
@@ -1,21 +1,30 @@
-/*
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#include <QtTest/QtTest>
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index e42af77c2..cc9b1838c 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2016 The Qt Company Ltd.
Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>
Copyright (C) 2010 Holger Hans Peter Freyther
@@ -236,6 +236,7 @@ private Q_SLOTS:
void restoreHistory();
void toPlainTextLoadFinishedRace_data();
void toPlainTextLoadFinishedRace();
+ void setZoomFactor();
void printToPdf();
@@ -4966,6 +4967,31 @@ void tst_QWebEnginePage::toPlainTextLoadFinishedRace()
QVERIFY(spy.count() == 3);
}
+void tst_QWebEnginePage::setZoomFactor()
+{
+ QWebEnginePage *page = new QWebEnginePage;
+
+ QVERIFY(qFuzzyCompare(page->zoomFactor(), 1.0));
+ page->setZoomFactor(2.5);
+ QVERIFY(qFuzzyCompare(page->zoomFactor(), 2.5));
+
+ const QUrl urlToLoad("qrc:/resources/test1.html");
+
+ QSignalSpy finishedSpy(m_page, SIGNAL(loadFinished(bool)));
+ m_page->setUrl(urlToLoad);
+ QTRY_COMPARE(finishedSpy.count(), 1);
+ QVERIFY(finishedSpy.at(0).first().toBool());
+ QVERIFY(qFuzzyCompare(page->zoomFactor(), 2.5));
+
+ page->setZoomFactor(5.5);
+ QVERIFY(qFuzzyCompare(page->zoomFactor(), 2.5));
+
+ page->setZoomFactor(0.1);
+ QVERIFY(qFuzzyCompare(page->zoomFactor(), 2.5));
+
+ delete page;
+}
+
void tst_QWebEnginePage::printToPdf()
{
QTemporaryDir tempDir(QDir::tempPath() + "/tst_qwebengineview-XXXXXX");
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index e73ab637b..95d5cf16a 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -47,6 +47,8 @@ private Q_SLOTS:
void disableCache();
void urlSchemeHandlers();
void urlSchemeHandlerFailRequest();
+ void customUserAgent();
+ void httpAcceptLanguage();
};
void tst_QWebEngineProfile::defaultProfile()
@@ -253,5 +255,60 @@ void tst_QWebEngineProfile::urlSchemeHandlerFailRequest()
QCOMPARE(toPlainTextSync(view.page()), QString());
}
+void tst_QWebEngineProfile::customUserAgent()
+{
+ QString defaultUserAgent = QWebEngineProfile::defaultProfile()->httpUserAgent();
+ QWebEnginePage page;
+ QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
+ page.setHtml(QStringLiteral("<html><body>Hello world!</body></html>"));
+ QTRY_COMPARE(loadFinishedSpy.count(), 1);
+
+ // First test the user-agent is default
+ QCOMPARE(evaluateJavaScriptSync(&page, QStringLiteral("navigator.userAgent")).toString(), defaultUserAgent);
+
+ const QString testUserAgent = QStringLiteral("tst_QWebEngineProfile 1.0");
+ QWebEngineProfile testProfile;
+ testProfile.setHttpUserAgent(testUserAgent);
+
+ // Test a new profile with custom user-agent works
+ QWebEnginePage page2(&testProfile);
+ QSignalSpy loadFinishedSpy2(&page2, SIGNAL(loadFinished(bool)));
+ page2.setHtml(QStringLiteral("<html><body>Hello again!</body></html>"));
+ QTRY_COMPARE(loadFinishedSpy2.count(), 1);
+ QCOMPARE(evaluateJavaScriptSync(&page2, QStringLiteral("navigator.userAgent")).toString(), testUserAgent);
+ QCOMPARE(evaluateJavaScriptSync(&page, QStringLiteral("navigator.userAgent")).toString(), defaultUserAgent);
+
+ // Test an existing page and profile with custom user-agent works
+ QWebEngineProfile::defaultProfile()->setHttpUserAgent(testUserAgent);
+ QCOMPARE(evaluateJavaScriptSync(&page, QStringLiteral("navigator.userAgent")).toString(), testUserAgent);
+}
+
+void tst_QWebEngineProfile::httpAcceptLanguage()
+{
+ QWebEnginePage page;
+ QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
+ page.setHtml(QStringLiteral("<html><body>Hello world!</body></html>"));
+ QTRY_COMPARE(loadFinishedSpy.count(), 1);
+
+ QStringList defaultLanguages = evaluateJavaScriptSync(&page, QStringLiteral("navigator.languages")).toStringList();
+
+ const QString testLang = QStringLiteral("xx-YY");
+ QWebEngineProfile testProfile;
+ testProfile.setHttpAcceptLanguage(testLang);
+
+ // Test a completely new profile
+ QWebEnginePage page2(&testProfile);
+ QSignalSpy loadFinishedSpy2(&page2, SIGNAL(loadFinished(bool)));
+ page2.setHtml(QStringLiteral("<html><body>Hello again!</body></html>"));
+ QTRY_COMPARE(loadFinishedSpy2.count(), 1);
+ QCOMPARE(evaluateJavaScriptSync(&page2, QStringLiteral("navigator.languages")).toStringList(), QStringList(testLang));
+ // Test the old one wasn't affected
+ QCOMPARE(evaluateJavaScriptSync(&page, QStringLiteral("navigator.languages")).toStringList(), defaultLanguages);
+
+ // Test changing an existing page and profile
+ QWebEngineProfile::defaultProfile()->setHttpAcceptLanguage(testLang);
+ QCOMPARE(evaluateJavaScriptSync(&page, QStringLiteral("navigator.languages")).toStringList(), QStringList(testLang));
+}
+
QTEST_MAIN(tst_QWebEngineProfile)
#include "tst_qwebengineprofile.moc"
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index 773550922..8aaf9ccc3 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2016 The Qt Company Ltd.
Copyright (C) 2009 Torch Mobile Inc.
Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>
diff --git a/tests/auto/widgets/util.h b/tests/auto/widgets/util.h
index c2c72c8f4..770579f1f 100644
--- a/tests/auto/widgets/util.h
+++ b/tests/auto/widgets/util.h
@@ -1,21 +1,31 @@
-/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
// Functions and macros that really need to be in QTestLib
#if 0