aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlxmlhttprequest
Commit message (Collapse)AuthorAgeFilesLines
* Tests: check that QFile::open succeedsGiuseppe D'Angelo2024-04-041-1/+1
| | | | | | | | | | Wrap it in QVERIFY if possible. If not possible (e.g. a function that returns non-void, or not an autotest function) use qFatal to abort the test. Change-Id: Ie255024d29507e928a94e67d9af1cd436df4f1df Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Correct license for test filesLucie Gérard2024-02-275-5/+5
| | | | | | | | | | | | | | According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I26d72e8de04d4c7c57b3b7838af5d033265de5ba Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Update xmlhttprequest expected data following QHttpHeadersMårten Nordheim2024-02-0721-143/+143
| | | | | | | | | | | | | It is sent in lower-case now. I cannot see an easy way to make the xmlhttprequest read just the header names as case-insensitive without changing a lot of how it works, so I just updated the expected data instead. Fixes: QTBUG-121728 Change-Id: I68b5d98aa7ede0e56ac8ba4236b819abaf556aa9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Purge stray horizontal space in XHR test data QMLEdward Welbourne2023-08-098-8/+8
| | | | | Change-Id: If0d31d6e2deb68984b330beb16e8212fb6d67fd0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Correct an inaccurate comment in XHR test-case for repeated headersEdward Welbourne2023-08-091-3/+2
| | | | | | | | | Setting the same header repeatedly appends values to the header, as the test-cases' expected output indeed shows, so don't claim the last setting over-writes all earlier ones. Reflow in the process. Change-Id: Ib21d218e5f762c3842aa03d380ed795023e5434d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Clear out some locale-dependencies from XHR unit testEdward Welbourne2023-08-0949-79/+21
| | | | | | | | | | | | | | | | None of these tests care about Accept-Language, which QHttpNetworkConnection sets automatically based on the system locale, so testing for it (by including a line for it in .expect files), setting it and skipping tests due to its "locale-dependence" were all unnecessary. Just tell the test-server to {{Ignore}} the value of the header. This failed on Android due to one of the data files being unavailable, so make access to that a precondition of its test. Pick-to: 6.5 6.6 Change-Id: I560ead8b3ace6a5df173d96aea10f8dac3ed1124 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix QML error, accessing global statusEdward Welbourne2023-08-081-1/+2
| | | | | | | Give the outer QtObject an id so we can overtly access its status. Change-Id: Iffe68b85cc43d2bedf046dc40d6c6cae34569072 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Make qml tests standalone projectsAlexandru Croitor2023-07-051-0/+6
| | | | | | | | | | | | | | | | | Add the boilerplate standalone test prelude to each test, so that they can be opened with an IDE without the qt-cmake-standalone-test script, but directly with qt-cmake or cmake. Boilerplate was added using the follow script: https://git.qt.io/alcroito/cmake_refactor Manual adjustments were made where the code was inserted in the wrong location. Task-number: QTBUG-93020 Change-Id: Ia68c9d263e7454f0c4a26c29b10f1c535d08e2f6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
* Don't discard blank lines after the end of the headersEdward Welbourne2023-06-161-1/+0
| | | | | | | | | | | | | | TestHTTPServer::wait()'s parsing of the expected request file discarded blank lines, setting headers_done to true, regardless of how many times it had done so already. Only do that once. One expected content file duly needed a trailing blank line removed so that it actually does match the content really sent by the QML, which ended in a single newline. Change-Id: Ic4c1b26398d8bf680823b383f163a62a5f1386be Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Tidy up stray braces and blank lines in XHR test-csesEdward Welbourne2023-04-2520-69/+19
| | | | | Change-Id: I9155f0a78443a8bbd11dc6ddb05cbc4f21bf6c00 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove spurious && true from two boolean conditions in XHR test QMLEdward Welbourne2023-04-252-2/+2
| | | | | | | | | The properties modified by this condition are booleans, that have been set, so there is no need to && true them to ensure they are boolean. Change-Id: I94f166c91549a5c212de5f694901896657cd04e0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Save some duplicate code in send_ignoreData.qml test-case for XHREdward Welbourne2023-04-251-7/+3
| | | | | Change-Id: Ib6f8fedcf77e647021f3d3d7a4ca0464739c7558 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* XHR sendPropfind_data(): split some long linesEdward Welbourne2023-04-251-3/+6
| | | | | | | | Use string concatenation for the long test names. Split data rows are more << markers. Change-Id: I502bcc615a53169a4175a09af08ae5f2c3133668 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Split some long lines in XHR's getResponseHeader.qml test-caseEdward Welbourne2023-04-251-4/+9
| | | | | Change-Id: I68acc7df09a99961f895c1763df2d6cecb292604 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Split a long line in an XHR test using [].join()Edward Welbourne2023-04-251-1/+5
| | | | | | | | This both makes the list of headers more readable and keeps the line of code within our 100-column limit. Change-Id: I7d53cca5beeeb9f6dd2b2a7c3311362750695d10 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* XHR WebDAV test: don't expect more than Keep-Alive in Connection: headerEdward Welbourne2023-04-251-1/+1
| | | | | | | | | | | | | | Only one XHR test expects Keep-Alive, Upgrade, HTTP2-Settings as the Connection: header, which fails when I run it locally, and I can see no reason why that test [0] would expect it, where all the others just give "Keep-Alive{{Ignore}}" (or "close") in their .expect files, so do the same for [0] as well. [0] sendPropfind:Send PROPFIND "allprop" request for collection. Pick-to: 6.5 Change-Id: I09cafcf282861b87693b5782f34e2fb84c888ff1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* XMLHttpRequest: Implement XHR.overrideMimeType()Edward Welbourne2023-04-204-0/+51
| | | | | | | | | | | | | | | | | It was missing from QQmlXMLHttpRequestCtor, making life painful for XHR users. It's a method that has existed in every XHR specification, and is required, if the goal is to be compliant with any XHR web standard. [ChangeLog][Qml][XMLHttpRequest] Added missing overrideMimeType(mime) method. This function can be used to force the XHR object to parse the data in HTTP responses differently than what the server suggests. Done-with: Oliver Eftevaag <oliver.eftevaag@qt.io> Task-number: QTBUG-53709 Change-Id: I9f8ff37e1604b95306a85fc7e64db6d111b9e069 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* XHR: Add responseURLTasuku Suzuki2023-04-152-0/+84
| | | | | | | | | | | https://xhr.spec.whatwg.org/#the-responseurl-attribute the attribute was introduced around 2014. [ChangeLog][Qml][XMLHttpRequest] Added missing responseURL property. This returns the url that was used to retrieve the response data, after any redirects have occurred. Change-Id: Ice70520913bb306885a10dfd7a3a89da31bcfdeb Task-number: QTBUG-111217 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* tst_qqmlxmlhttprequest: remove unneeded property set in redirectsTasuku Suzuki2023-04-051-3/+0
| | | | | | | | | | | | "expectedText" is not defined in the files below - redirects.qml - redirectError.qml - redirectRecur.qml Change-Id: Ib07f72fc902b90286ec709399216be7b2fce392a Pick-to: 6.5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Retire the qt_parse_all_argumentsAmir Masoud Abdol2023-01-201-2/+2
| | | | | | Task-number: QTBUG-99238 Change-Id: Ia11c9cbd7c06347319ab3674ec0cd8da0214747e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-09-071-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: Id89ed14990804a5024183e75382cc539d4293da1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't use PUBLIC_LIBRARIES for tests and test helpersAlexandru Croitor2022-07-281-1/+1
| | | | | Change-Id: I1cd769f85d5f82c43639d6787d98e536619249e6 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Unblacklist tst_qqmlxmlhttprequestUlf Hermann2022-07-121-3/+0
| | | | | | | | The test hasn't failed anymore for half a year. Fixes: QTBUG-99149 Change-Id: Ie9ebef0f92f3b9a02426184295da7c18469f5669 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-081-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-115-135/+10
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* INTEGRITY: Fix some test cases from core/qml foldersKimmo Ollila2022-03-032-0/+8
| | | | | | | | | | | | | -Add dummy_imports.qml to TESTDATA -Let qmlimportscanner handle plugin import -Skip cases that depend on mounted filesystem Task-number: QTBUG-99123 Pick-to: 6.3 6.2 Change-Id: I99e21e423f2114c4c4ee1e24bdf9bb85af51baf7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Skip test cases execute the app's main shared lib on AndroidAssam Boudjelthia2021-12-171-0/+11
| | | | | | | | | | | | Because on Android the project main target is compiled into a shared library. Pick-to: 6.2 6.3 Task-number: QTBUG-99214 Task-number: QTBUG-97056 Change-Id: Ia0b5d84f6a07964ce7e1802c42a9b35675248e51 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Blacklist failing tests on macOS armShawn Rutledge2021-12-121-0/+3
| | | | | | | Task-number: QTBUG-81938 Task-number: QTBUG-99149 Change-Id: Ia982300a3069014f841a04f19b5358aef0cf8673 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qqmlxmlhttprequest: Fix h2c fallout and ignore in futureMårten Nordheim2021-12-0220-37/+18
| | | | | | | | | | | | The headers were hardcoded but seeing as they are ultimately ignored on the server-side (which is following the spec) we can also ignore them if they come back in some form in the future. Pick-to: 6.2 Fixes: QTBUG-98811 Change-Id: Ida490cbd8193eb3e3bf8d56fd387af93c408d921 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tst_qqmlxmlhttprequest: Skip locale dependent testsFabian Kosmale2021-11-261-0/+8
| | | | | | | | | | | | | ...in case the locales is not en-us. Ideally we would make the test not dependent on the system locale, but the best way to achieve is not clear, and skipping tests that have no chance of succeeding is the next best thing we can do. Pick-to: 6.2 Fixes: QTBUG-59223 Change-Id: I1d7dfca267b01b701e369043d028d61f2f687fcd Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Consolidate test helpers into private librariesMitch Curtis2021-09-132-7/+4
| | | | | | | | | | | | | | | | | | | | Previously each test would include and build sources from the shared folder. Now we make those sources a library, build it once, then have each test link to it instead. We also take the opportunity to move some helpers that qtquickcontrols2 had added into the quicktestutils library where it makes sense, and for the helpers that don't make sense to be there, move them into quickcontrolstestutils. We add the libraries to src/ so that they are internal modules built as part of Qt, rather than tests. That way we can use them in a standalone test outside of qtdeclarative. Task-number: QTBUG-95621 Pick-to: 6.2 Change-Id: I0a2ab3976fdbff2e4414df7bdc0808f16453b80a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix some "can be marked override" warningsAndreas Buhr2021-02-231-1/+1
| | | | | | Change-Id: I13da0d085901314950c4fa0afb5853e183652e67 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Remove the qmake project filesFabian Kosmale2021-01-151-14/+0
| | | | | | | | | Remove all qmake project files, except for examples which are used to test that qmake continues to work. Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-10-061-3/+3
| | | | | | | | Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I3b964e3baf0cc7040830156dac30358ea1152801 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* XHR: allow the user to set the User-Agent headerGiuseppe D'Angelo2020-10-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | The Fetch spec has allowed it for a while (in other words, it's no longer forbidden): * https://fetch.spec.whatwg.org/#terminology-headers * https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name Cf. also * https://github.com/whatwg/fetch/issues/37 * https://github.com/whatwg/fetch/commit/dab09b0c483c46324082df1e54b29ed4c9c02162 [ChangeLog][QtQml][XmlHttpRequest] It is now possible to set the User-Agent header. Change-Id: I1d5bd785223e9df2883011f873d440a63e363a24 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix xmlhttprequest autotest after HTTP/2 changes in qtbaseLars Knoll2020-09-1531-42/+86
| | | | | | Change-Id: I32029f4f70da909b0b0d088899ac0c3138454792 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_qqmlxmlhttprequest: Ignore HTTP encoding headersUlf Hermann2020-08-1220-19/+19
| | | | | | | | | Apparently QtNetwork changed the default order of encodings. We don't really care about this anyway, though. Change-Id: I72e5f0783e5e88ddb9fe031f72ff5f6c760256fa Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Update Apple platform defines after rename in qtbaseTor Arne Vestbø2020-03-171-2/+2
| | | | | Change-Id: Ia0a075e3199eab735f9b289873beeb8730ebc47e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2020-03-121-17/+21
|\ | | | | | | | | | | | | | | Conflicts: dependencies.yaml src/qml/qml/qqmlengine.cpp Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
| * qqmlxmlhttprequest: Disable local file access by defaultMaximilian Goldstein2020-02-121-17/+21
| | | | | | | | | | | | | | | | | | | | [ChangeLog][Important Behavior Changes] Local file accesses are now disabled by default for security reasons. To enable them set the environment variables QML_XHR_ALLOW_FILE_READ / QML_XHR_ALLOW_FILE_WRITE to 1 for reading and writing respectively. Change-Id: Idf225d6eb8f16b1716867101b8e768926242b7bf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Regenerate qtdeclarativeAlexandru Croitor2020-02-121-5/+3
| | | | | | | | | | | | | | Change-Id: I48d7fd306f3d1b161a8e73029282ee591b1ef612 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeLeander Beernaert2020-01-162-79/+299
|\| | | | | | | Change-Id: I0c5b939c70bdb91ccdf7068784308416dcaa5736
| * qqmlxmlhttprequest: Add ability to disable file:// requestsMaximilian Goldstein2020-01-152-79/+299
| | | | | | | | | | | | | | | | | | | | | | | | | | Introduces two new flags: QML_XHR_ALLOW_FILE_READ: Controls whether GET can be used with file://. QML_XHR_ALLOW_FILE_WRITE: Controls whether PUT can be used with file://. In Qt 6 these will be off by default. At the moment having these unset while using either GET or PUT on file:// will just result in a warning. Change-Id: I2d85e88f1ddba8153ccbbd833ec7de5c1d0d8b5b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Regenerate all projects with new CMake API versionAlexandru Croitor2019-11-151-3/+3
| | | | | | | | | | | | Change-Id: Ie0db35f674137c229eaf049616f38f8e818f7092 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Regenerate testsAlexandru Croitor2019-11-141-11/+2
| | | | | | | | | | | | Change-Id: I67a6c8f1659e7b471a4fcb92a2699292cf4eea81 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add QtDeclarative Test CoverageLeander Beernaert2019-08-141-0/+51
|/ | | | | | | | | | | | | | | | | | | | | | All tests compile and run on a developer build. These tests are failing: tst_qqmlsqldatabase Fails due to missing sql driver tst_qqmlsqldatabase Fails in wip/qt6 tst_ququicklayouts Fails in wip/qt6 tst_flickableinterop Fails in wip/qt6 tst_qquickpinchandler Fails in wip/qt6 tst_qquickflickable Fails in wip/qt6 tst_qquickgridview Fails in wip/qt6 tst_qquickimage Fails due to missing jpeg plugin tst_qquicklistview Fails in wip/qt6 tst_qquicktext Fails in wip/qt6 tst_qquickcanvasitem Fails in wip/qt6 tst_scenegraph Fails due to missing jpeg plugin tst_TestFiltering Fails in wip/qt6 Change-Id: I4b9d69c118e23c095cb72ad5a67653fc30943bb1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add support for onload/onloadend/onerror callbacks in XHRSimon Hausmann2018-07-182-0/+16
| | | | | | | | | Those functions are supposed to be called after readystatechanged, with onloadend coming last. Task-number: QTBUG-67337 Change-Id: I946cd3c7edbe762c1b66345ec8649562d2246d34 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix XMLHttpRequest when used with QQmlEngine::evaluateSimon Hausmann2018-04-092-0/+37
| | | | | | | | | | | | | | | | | | | | | | | Our XHR implementation insists on a valid QQmlContext when processing callbacks. This is to protect against callbacks being triggered after dynamic QML contexts such as delegates have been destroyed. Unfortunately those checks are too strict and make it impossible to use XHR from within plain JS scripts (where v4->callingQmlContext() will return a null pointer). Dispatching the callbacks in functions that are directly called from QML/JS is safe and something we can do unconditionally. This applies to the callbacks triggered from abort() and open() for example. When we're called from QNetworkAccessManager we should enforce the continued existence of a QML context only if it was present at send() time. Task-number: QTBUG-67337 Change-Id: I8235f6ef407adc3eaeeff4eee72238ba6750afb2 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Valery Kotov <vkotov@luxoft.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace remaining Q_NULLPTR with nullptrKevin Funk2017-11-171-1/+1
| | | | | Change-Id: I28a32af7f1c306a3002d47025a842475f848c1a4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Tests: Clean up inclusion of util.pri and debugutil.priUlf Hermann2017-08-171-1/+0
| | | | | | | | | | | When we include debugutil.pri, we always want util.pri, too. We can as well nest the inclusions. Also, setting the include path is much easier from within the .pri files than from outside. Change-Id: I1205bdc3051e16e635d4ea9626f44e51002ddb50 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>