summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/access
Commit message (Collapse)AuthorAgeFilesLines
* QtNetwork: Handle FD_CLOSE on WindowsMartin Petersson2012-08-011-10/+1
| | | | | | | | | | | | | We need to handle FD_CLOSE separately on Windows as this will be sent only once. When we get FD_CLOSE we need to check if there is more data available for reading. It there is this might indicate that there is another FD_READ that we need to handle after the FD_CLOSE. So in this case we will manually create another close event. Task-number: QTBUG-19409 Task-number: QTBUG-25386 Change-Id: Ie19906bc3f64fb6a85a508a5ab12caac5d70ccdb Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Set the Qt API level to compatibility mode in all tests.Thiago Macieira2012-08-0112-0/+12
| | | | | | | | | | | Qt 5.0 beta requires changing the default to the 5.0 API, disabling the deprecated code. However, tests should test (and often do) the compatibility API too, so turn it back on. Task-number: QTBUG-25053 Change-Id: I8129c3ef3cb58541c95a32d083850d9e7f768927 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QtNetwork: use nullary version of qRegisterMetaType<T>("T")Marc Mutz2012-07-253-12/+3
| | | | | | | | | | | | | | | | | Using the nullary version has the advantage that multiple calls during a program run are much more efficient, since an inlined atomic is used to store the result. It also ensures that Q_DECLARE_METATYPE(T) has been used, whereas qRegisterMetaType<T>("T") will happily register anything. So I've added the macro where it was missing, or moved it to a central place when it existed hidden. In tst_qnetworkreply, this became a bit tricky, because a private header is conditionally included, so moved the Q_DECLARE_METATYPE() into a conditional section, too. Change-Id: I71484523e4277f4697b7d4b2ddc3505375162727 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Avoid load(testcase) for installing test helper appsRohan McGovern2012-07-041-2/+2
| | | | | | | | | | | | Make test projects declare TEST_HELPER_INSTALLS rather than calling a function exported by testcase.prf. load(testcase) may be unsafe, as testcase.prf should be processed after default_post.prf. Fixes silent disabling of various autotests. Change-Id: I56b35ffd653a637ad5ab18d64dd1a1edadfac59f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Kurt Korbatits <kurt.korbatits@nokia.com>
* Fixed warnings in qnetworkreply unit testKurt Korbatits2012-07-031-0/+2
| | | | | | | | | On windows without ssl there was a disconnect on sslError signal that was not wrapped in ifdef. Change-Id: I9b1327adfa853d4dc8f1d8a0120f8f0ed7c13e9e Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Fixed several unit tests to work in shadow buildsKurt Korbatits2012-06-291-0/+1
| | | | | | | | - qlogging, qthreadstorage, qnetworkreply, qapplication, qfile, qprocess Added app_bundle and debug_and_release_target to CONFIG Change-Id: I6212902c449520dc016da9590149a423069cc38c Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Implement RFC6265 test suiteShane Kearns2012-06-272-0/+2056
| | | | | | | | | | | | | Tests against the test data from the IETF working group https://github.com/abarth/http-state The test data is in the parser.json file, imported from that repository and with one patch applied to make the ordering0001 test case data match the raw files which are used by their python test server. Task-number: QTBUG-18920 Change-Id: I17c1a8d92aef2850907f009667c6574e4c8d0cdb Reviewed-by: Richard J. Moore <rich@kde.org>
* Use RFC6265 rules for cookie path & path matchingShane Kearns2012-06-271-13/+25
| | | | | | | | | | | | | | | Url encoding of paths is no longer used. This matches the current release behaviour of Firefox, Chrome and MSIE browsers. RFC6265 does not allow this type of encoding. This fixes remaining path test cases in the IETF test suite. Currently the path0027 test is passed by Firefox but failed by Chrome and MSIE, so there is a potential compatibility issue. However it is a corner case with a malformed cookie. Task-number: QTBUG-15794 Change-Id: I9b02bb5adc32d614f512d314d06f2c60894aa2b0 Reviewed-by: Richard J. Moore <rich@kde.org>
* QNetworkCookie: Use RFC6265 rules for parsing Set-CookieShane Kearns2012-06-271-3/+9
| | | | | | | | | | | | | | The ';' separator takes priority even inside a quoted string. Quotation marks have no special meaning, they are not parsed and regenerated anymore. This means it is not possible to include the ';' character inside a cookie value. Other characters are returned transparently, including [",\] Task-number: QTBUG-15794 Task-number: QTBUG-26002 Task-number: QTBUG-11641 Change-Id: I4eefef5c6ac7753d5a21c226169e264578521fe9 Reviewed-by: Richard J. Moore <rich@kde.org>
* Change invalid test case (two cookies separated by ,)Shane Kearns2012-06-271-2/+9
| | | | | | | | Two cookies in a single Set-Cookie header are no longer allowed. Check that this header is parsed according to RFC6265 rules instead Change-Id: Ice48bbe78a9886208f7d1186cf1d8c37f46f1252 Reviewed-by: Richard J. Moore <rich@kde.org>
* QNetworkRequest autotest: adapt to new cookie parsing (re. commas)Peter Hartmann2012-06-271-1/+1
| | | | | | | | | | | | | | Cookies cannot be separated by commas anymore, but are separated by new lines. See "Remove support for multiple cookies in one Set-Cookie header to follow RFC6265." Reviewed-by: Martin Petersson Task-number: QTBUG-21456 (cherry-picked from 5d809703aa2d2a08ae7e9610fd42025b081d3d0c) Change-Id: If7d1b4e58399a5d678495af6ff280409ba220e86 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Remove support for multiple cookies in one Set-Cookie header to follow RFC6265.Jocelyn Turcotte2012-06-271-39/+15
| | | | | | | | | | | | This also allows cookie values to contain commas to increase compatibility like most popular browsers do even though the RFC still reserves them for future uses. Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Task-number: QTBUG-21456 (cherry-picked from 8ba781b01e900148fec2e9d26485369b3295487f) Change-Id: Ib09ab2411dddf7f99de1c0c31680428b7412fc7e Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Rewrite QNetworkReply downloadProgress autotestShane Kearns2012-06-141-54/+56
| | | | | | | | | | | The existing autotest was made invalid by the downloadProgress signal choking patch. Rewrote the autotest to download files from the test server with some rate limiting applied to ensure more than one signal is emitted. Change-Id: I6026bacdf356b4e1796b80f6983e5bdce0d1bfce Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* choke uploadProgress signalsShane Kearns2012-06-141-1/+4
| | | | | | | | | | | | | | | | | | The QNetworkReply::uploadProgress signal is intended for updating UI elements such as a progress bar. Limit the signal emissions to 10 per second to prevent overloading the UI with updates. As with the downloadProgress choke, this is implemented by dropping signals that occur within 100ms of the previous emission. The 100% signal is always emitted (bytesSent == bytesTotal) When the upload size is initially unknown, this behaviour is still provided by the upload device emitting a suitable readProgress signal when EOF is reached. Task-number: QTBUG-20449 Change-Id: I77e03c8a49109106e1c375ee00380293fd326b63 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Make tst_qabstractnetworkcache parallel-safeRohan McGovern2012-06-012-3/+5
| | | | | | | Use a unique QTemporaryDir instead of a fixed path for the test cache. Change-Id: Ib664033a509a6cefd7c323708f80ef595b202178 Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
* Make tst_qnetworkdiskcache parallel-safeRohan McGovern2012-05-312-26/+35
| | | | | | | | Use a QTemporaryDir for a unique test cache directory for each process, rather than a fixed path. Change-Id: I64df8422d01282bbc108e942947c1b55368bd941 Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
* Set explicit testcase.timeout for slow testsRohan McGovern2012-05-291-0/+1
| | | | | | | | | | | | We'd like to decrease the default timeout for tests in the Qt Project CI so that we waste less time waiting for hanging tests. Tests which genuinely take a long time to run, such as these, should have their timeout explicitly set in their .pro file. Change-Id: I4fe6249e9efa764b230251d73a1115c24411e168 Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com> Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
* Make tst_qnetworkreply parallel-safe.Rohan McGovern2012-05-292-2/+3
| | | | | | | | | Ensure we always use a unique filename when writing to test files. The test already contained code for this, but it was not applied in a couple of places. Change-Id: I1e29ee162c390e014688ab46e3658e2a463d203e Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
* Add CONFIG+=parallel_test to suspected parallel-safe tests.Rohan McGovern2012-05-287-0/+7
| | | | | | | | | These tests have passed a parallel stress test on all three of Linux, Mac, Windows. Mark them with CONFIG+=parallel_test to allow CI to run them in parallel, saving time. Change-Id: I19fd333c3c645a67374ca998f6c8530dd236b0f8 Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
* Fallback to IPv4 when IPv6 is not present.Jonas M. Gastal2012-05-212-4/+2
| | | | | | | In tests when IPv6 is not present QSKIP IPv6 tests. Task-number: QTBUG-23660 Change-Id: I02abc7322d765a93cbf661e53c76257f03dca73e Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* tst_QNetworkReply: enable the ioGetFromBuiltinHttp test.Martin Petersson2012-05-161-6/+5
| | | | | | | | | | This can be enabled again now. The sender transfer test is still not re-enabled since the test would take to long to run if sending enough data to overwhelm the reciever's kernel buffers. Change-Id: I4056fdca53ec8ebbcc53dfdc814d8bfdbc73f7ce Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
* tst_QNetworkReply: fix backgroundRequestInterruption test.Martin Petersson2012-05-111-0/+3
| | | | | | | | After we have change the policy we should set the readbuffersize to unlimited again, so that we try to download all data. Change-Id: I1b9bdb6c2e5f408c920f6e6d7e85a39e4c18316b Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtNetwork]Thiago Macieira2012-05-041-10/+10
| | | | | | | | | | | | This operation should be a no-op anyway, since at this point in time, the fromAscii and toAscii functions simply call their fromLatin1 and toLatin1 counterparts. Task-number: QTBUG-21872 Change-Id: I94cc301ea75cc689bcb6e2d417120cf14e36808d Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Richard J. Moore <rich@kde.org>
* Optimise windows cert fetching and fix test case.Shane Kearns2012-05-031-2/+1
| | | | | | | | | | | | | If we're not going to verify the peer, or we know in advance that windows won't have a CA root then don't ask it to verify the certificate chain. The test case started failing in CI when the windows cert fetcher was integrated due to timing change. I've relaxed the timing requirement of the test to avoid it being unstable. Task-number: QTBUG-24827 Change-Id: I694f193f7d96962667f00aa01b9483b326e3e054 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Don't use obsolete qVariantValue, qVariantCanConvert, etc.Debao Zhang2012-05-021-11/+11
| | | | | | | | | | qVariantValue and qVariantCanConvert are Compatibility members, while in Qt4.8 they are marked as Qt 3 Support Members. qVariantFromValue and qVariantSetValue are Obsolete members. Change-Id: Ie8505cad1e0950e40c6f6710fde9f6fb2ac670fd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Wrap the non-ASCII testcases with QString::fromUtf8Thiago Macieira2012-04-271-5/+5
| | | | | | | And use QString::toUtf8() to recover the byte array original. Change-Id: Ic94de12e7ac67479e85a64a86f8467428b4d22ba Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Stabilisation of tst_qnetworkreply on windowsShane Kearns2012-04-201-8/+14
| | | | | | | | | | Workaround QTBUG-24451 by retrying creation of SocketPair if it fails (waitForConnected and waitForNewConnection are used in the factory function). Skip very unstable test cases due to QTBUG-25386 Change-Id: I32129922329b895eb3719d61719c487a4d52c466 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add test case for checking ConnectInBackground is setShane Kearns2012-04-191-1/+64
| | | | | | | | | | | | | ConnectInBackground should be set when opening a network session due to a background request. This test checks that. Unfortunately, none of the bearer plugins currently in Qt Base support this attribute, so the test result is inconclusive. (testing with a debugger shows the attribute is set correctly, but it can't be read back as the set is discarded by the plugin implementation) Change-Id: Idcf777fe489a62d4ff5007ffd291a84ba052311b Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Abort background requests if policy changes to disallow themShane Kearns2012-04-191-0/+73
| | | | | | | | | | | | | Using the policy change signal from QNetworkSession. If the new policy disallows background requests and this is a background request, then generate an error. This results in a TCP RST on the socket, and a BackgroundRequestNotAllowedError on the QNetworkReply. If the reply is already finished, no action is taken. Change-Id: I4ff5c681a8b7b852727bb95f03664d666f4efe07 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Expand tst_QNetworkReply::backgroundRequest to ftp & httpsShane Kearns2012-04-191-5/+35
| | | | | | | | Ftp and Http have different implementations of QNetworkReply, so test both of them. Change-Id: If502fa1788110edf89e619966534eea08830a19b Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-04-162-2/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/corelib/io/qurl.cpp src/gui/kernel/qwindow.cpp src/tools/moc/generator.cpp src/widgets/kernel/qwidget_qpa.cpp src/widgets/styles/qstyle.h src/widgets/widgets/qtabbar.cpp tests/auto/corelib/codecs/utf8/tst_utf8.cpp Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
| * Put bug numbers on same line as insignificant_test markers.Jason McDonald2012-04-161-1/+1
| | | | | | | | | | | | | | | | This makes it easier to find insignificant tests that have no associated bug report. Change-Id: Ia71d59da062818d3860b0365d063e044705267fd Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
| * re-enable qabstractnetworkcache autotestShane Kearns2012-04-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I have run the test 250 times in each of these configs with no crashes observed, so assuming the instability has been fixed by another change. ubuntu 11.10 64 bit ubuntu 10.04 32 bit windows 7 msvc2010 64 bit (debug) windows 7 msvc2010 32 bit (release) Task-number: QTBUG-20686 Change-Id: I02bab165c263cf79684c7723eae1e278839b1e37 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* | Add unit test for BackgroundRequestAttributeShane Kearns2012-04-131-1/+47
| | | | | | | | | | Change-Id: I807953cac3d23825461f9ae860badbd148835330 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* | Merge remote-tracking branch 'origin/master' into api_changesOswald Buddenhagen2012-04-101-0/+32
|\| | | | | | | | | | | | | | | | | | | Conflicts: configure src/widgets/styles/qwindowsxpstyle.cpp tests/auto/gui/kernel/qwindow/qwindow.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
| * QNetworkAccessFtpBackend: remove entry from QNetworkAccessCacheMartin Petersson2012-04-011-0/+32
| | | | | | | | | | | | | | | | | | | | | | When FTP login fails we fail to remove the entry from the cache. This is because the cache key is created from the url with the userInfo. So this needs to be set again to match the key used when inserted. Task-number: QTBUG-11824 Change-Id: Ib3fd2d737581653ae59c56d0810d42e2d8dc2176 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* | Port to the new QUrl APIThiago Macieira2012-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The use of any broken-down components of the query now needs QUrlQuery. The QUrl constructor and toString() are now rehabilitated and the preferred forms. Use toEncoded() and fromEncoded() now only when we need to store data in a QByteArray or the data comes from a QByteArray anyway. Change to toString() or the constructor if the data was in a QString. Change-Id: I9d761a628bef9c70185a48e927a61779a1642342 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | tst_qnetworkreply: don't inherit from QSharedPointerMarc Mutz2012-03-231-146/+145
|/ | | | | | | | | | | | | | | QSharedPointer isn't meant to be used as a base class. Instead of inheriting from it to add implicit conversions to and from QNetworkReply*, make QNetworkReplyPtr a typedef, overload two oft-used functions to take a QNetworkReplyPtr in addition to QNetworkReply*, and otherwise make the conversions explicit. Change-Id: I1eff1793a19f2d5bad1cce8de74c0786675a50f3 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Mark tst_QNetworkReply::getThenDeleteObject as unstableShane Kearns2012-03-081-0/+1
| | | | | | | | | | It's unstable on all platforms, because the reply can be finished due to a race with the http thread. It isn't crashing (which the test was trying to test for), but rather the QVERIFY(!reply->isFinished()) fails, which is an inconclusive verdict. Change-Id: Ib815a7cedd220544a0c9cb83023e3334df4a0fb3 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* tst_qnetworkreply - remove qRegisterMetaType duplicatesShane Kearns2012-03-081-28/+0
| | | | | | | | | | The metatypes are registered in the constructor, don't need to register them in test cases as well. Registering in a test case is bad practice, as it could result in tests failing when run individually due to unknown metatype. Change-Id: Ic4d65d0f5fe3cdd3ab57cf2512a4906d71205a05 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Add windows XFAIL to qnetworkreply autotestShane Kearns2012-03-081-0/+4
| | | | | | | | The test case that depends on QLocalSocket consistently fails due to bugs in QLocalSocket windows implementation Change-Id: Ibfe9eb3590be4f72b52f14cd4fbe5be61f6cf70e Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Fix tst_QNetworkReply::httpWithNoCredentialUsage autotestShane Kearns2012-03-061-16/+39
| | | | | | | | | | | | The test was testing the wrong thing, and passing even though QNetworkRequest::AuthenticationReuseAttribute was not being respected, until recently when I fixed username/password in URLs Now the cache is properly bypassed when this attribute is set to manual, and the autotest is updated to check this. Change-Id: I87943515562d0b16b03504f0758ba265758d1c22 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Fix QNetworkReply ioGetFromHttpWithCache test caseShane Kearns2012-03-061-0/+1
| | | | | | | | | | | | | | Expiration date is calculated from max-age header when a response is inserted into the cache. Because the test case is prepopulating the cache outside of QNAM's control, the expiration date was uninitialised, causing the test to fail. This is due to a 2 year old change in QNAM, where max age calculation was removed from cache retrieval, and more recent changes to QDateTime where secsTo() returns 0 if one of the arguments is invalid. Change-Id: Ieecd46123dde4ca0fd0be3ae79e70e1528ec02bc Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Change bugreports.qt.nokia.com -> bugreports.qt-project.orgSergio Ahumada2012-03-021-1/+1
| | | | | Change-Id: Ia795098f24cf358b15067f54cd08dff0bd792bc5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* network cookies: check "example.com" != "example.com."Shane Kearns2012-02-291-0/+12
| | | | | | | | Only test code change, we already have the correct behaviour Task-number: QTBUG-20001 Change-Id: I2296f405f47f9c8d15796e69f9d1854063e38d6a Reviewed-by: Richard J. Moore <rich@kde.org>
* Changed qnetworkreply unittest to return correct codeKurt Korbatits2012-02-271-7/+5
| | | | | | | | - Changed waitForFinished() to return correct return code Change-Id: Ic6b0dfa195254783a2106011c4a108d907d73557 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* compile fix: missing #include <unistd.h>sMarc Mutz2012-02-231-0/+5
| | | | | Change-Id: I3bd34f67033fb921c49da97419c107811d8da6ff Reviewed-by: David Faure <faure@kde.org>
* Test for QT_NO_SSL instead of QT_NO_OPENSSLShane Kearns2012-02-212-37/+37
| | | | | | | | Change the ifdefs in our own code (except openssl backend) to use the new configure flag. Change-Id: I8774734771c66b22164b5fae8fdb27814ac3df7b Reviewed-by: Richard J. Moore <rich@kde.org>
* Changed qabstractnetworkcache unittest to use TESTDATAKurt Korbatits2012-02-201-5/+1
| | | | | | | | - Changed qabstractnetworkcache to install testdata Change-Id: I8f2ae6103214755ee7898dbc0ee50c0e4d7d45ab Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Fix handling of urls containing username/password in QNetworkAccessManagerShane Kearns2012-02-171-10/+53
| | | | | | | | | | | | | | | | | | QNetworkAccessManager was ignoring the supplied credentials, although webkit seems to support these urls at a higher level. Following the behaviour of browsers: We use supplied credentials if authentication is required. We add supplied credentials to the authentication cache. We emit authenticationRequired signal if the credentials were wrong. We do not use previously cached credentials for that url Synchronous http requests fail, if the credentials were wrong. Task-number: QTBUG-18107 Change-Id: If46e8eab1511ba8a0f4bbe0d4efaabc4df0b8ab4 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>