Commit Graph

91 Commits

Author SHA1 Message Date
Sergio Ahumada
4d3a53305f test: QFtp tests require `private_tests' set
Also fixing some includes and re-enabling the test

Change-Id: I4a061e106c2e55db39b8000729737a93e3d7714a
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-09-09 08:51:05 +02:00
Martin Petersson
b8453b6fe3 QtNetwork: Handle FD_CLOSE on Windows
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>
2012-08-01 18:12:34 +02:00
Thiago Macieira
672b5b7ab6 Set the Qt API level to compatibility mode in all tests.
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>
2012-08-01 15:37:46 +02:00
Marc Mutz
79b742b7e0 QtNetwork: use nullary version of qRegisterMetaType<T>("T")
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>
2012-07-25 19:32:41 +02:00
Rohan McGovern
bcf20e122a Avoid load(testcase) for installing test helper apps
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>
2012-07-04 02:46:27 +02:00
Kurt Korbatits
28f30aa543 Fixed warnings in qnetworkreply unit test
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>
2012-07-03 04:03:12 +02:00
Kurt Korbatits
551e1e63d9 Fixed several unit tests to work in shadow builds
- 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>
2012-06-29 04:57:04 +02:00
Shane Kearns
c0a0b37103 Implement RFC6265 test suite
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>
2012-06-27 00:46:35 +02:00
Shane Kearns
058fddd1c0 Use RFC6265 rules for cookie path & path matching
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>
2012-06-27 00:46:35 +02:00
Shane Kearns
d76bd0d735 QNetworkCookie: Use RFC6265 rules for parsing Set-Cookie
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>
2012-06-27 00:46:35 +02:00
Shane Kearns
74d3963c25 Change invalid test case (two cookies separated by ,)
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>
2012-06-27 00:46:35 +02:00
Peter Hartmann
bd38ff3c54 QNetworkRequest autotest: adapt to new cookie parsing (re. commas)
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>
2012-06-27 00:46:35 +02:00
Jocelyn Turcotte
297a25cc4b Remove support for multiple cookies in one Set-Cookie header to follow RFC6265.
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>
2012-06-27 00:46:35 +02:00
Shane Kearns
dd9bdf5654 Rewrite QNetworkReply downloadProgress autotest
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>
2012-06-14 05:26:39 +02:00
Shane Kearns
46e40214cf choke uploadProgress signals
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>
2012-06-14 05:26:37 +02:00
Rohan McGovern
9469e9fdeb Make tst_qabstractnetworkcache parallel-safe
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>
2012-06-01 03:16:11 +02:00
Rohan McGovern
b63e101a90 Make tst_qnetworkdiskcache parallel-safe
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>
2012-05-31 05:37:28 +02:00
Rohan McGovern
dd3e4f1dbe Set explicit testcase.timeout for slow tests
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>
2012-05-29 09:39:18 +02:00
Rohan McGovern
c68f4367f6 Make tst_qnetworkreply parallel-safe.
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>
2012-05-29 03:04:29 +02:00
Rohan McGovern
177070cb7b Add CONFIG+=parallel_test to suspected parallel-safe tests.
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>
2012-05-28 07:33:01 +02:00
Jonas M. Gastal
2c790b251d Fallback to IPv4 when IPv6 is not present.
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>
2012-05-21 13:00:27 +02:00
Martin Petersson
3e697188da tst_QNetworkReply: enable the ioGetFromBuiltinHttp test.
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>
2012-05-16 04:24:38 +02:00
Martin Petersson
85c3f6a74d tst_QNetworkReply: fix backgroundRequestInterruption test.
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>
2012-05-11 10:38:25 +02:00
Thiago Macieira
dd5b373d41 Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtNetwork]
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>
2012-05-04 12:46:05 +02:00
Shane Kearns
ee0514d63c Optimise windows cert fetching and fix test case.
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>
2012-05-03 16:11:58 +02:00
Debao Zhang
ade8888603 Don't use obsolete qVariantValue, qVariantCanConvert, etc.
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>
2012-05-02 08:30:59 +02:00
Thiago Macieira
d78d5ddf2a Wrap the non-ASCII testcases with QString::fromUtf8
And use QString::toUtf8() to recover the byte array original.

Change-Id: Ic94de12e7ac67479e85a64a86f8467428b4d22ba
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-04-27 22:52:01 +02:00
Shane Kearns
7742b2c97c Stabilisation of tst_qnetworkreply on windows
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>
2012-04-20 12:46:47 +02:00
Shane Kearns
a6156d1aed Add test case for checking ConnectInBackground is set
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>
2012-04-19 19:46:07 +02:00
Shane Kearns
af100dbd7e Abort background requests if policy changes to disallow them
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>
2012-04-19 19:46:07 +02:00
Shane Kearns
ddf040eccb Expand tst_QNetworkReply::backgroundRequest to ftp & https
Ftp and Http have different implementations of QNetworkReply,
so test both of them.

Change-Id: If502fa1788110edf89e619966534eea08830a19b
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
2012-04-19 19:46:07 +02:00
Lars Knoll
9bd0323551 Merge remote-tracking branch 'origin/master' into api_changes
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
2012-04-16 12:04:34 +02:00
Jason McDonald
73db181e83 Put bug numbers on same line as insignificant_test markers.
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>
2012-04-16 03:10:22 +02:00
Shane Kearns
bfcfbc592c re-enable qabstractnetworkcache autotest
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>
2012-04-13 15:28:29 +02:00
Shane Kearns
1424702918 Add unit test for BackgroundRequestAttribute
Change-Id: I807953cac3d23825461f9ae860badbd148835330
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
2012-04-13 12:44:45 +02:00
Oswald Buddenhagen
143c4d3e13 Merge remote-tracking branch 'origin/master' into api_changes
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
2012-04-10 15:31:45 +02:00
Martin Petersson
3dbf98c715 QNetworkAccessFtpBackend: remove entry from QNetworkAccessCache
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>
2012-04-01 14:13:45 +02:00
Thiago Macieira
74d2dba460 Port to the new QUrl API
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>
2012-03-30 01:19:59 +02:00
Marc Mutz
167af3b6ca tst_qnetworkreply: don't inherit from QSharedPointer
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>
2012-03-23 11:22:40 +01:00
Shane Kearns
75ab89d4d6 Mark tst_QNetworkReply::getThenDeleteObject as unstable
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>
2012-03-08 05:31:40 +01:00
Shane Kearns
fbd45a9311 tst_qnetworkreply - remove qRegisterMetaType duplicates
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>
2012-03-08 05:31:40 +01:00
Shane Kearns
69c428a810 Add windows XFAIL to qnetworkreply autotest
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>
2012-03-08 05:31:40 +01:00
Shane Kearns
c93f7b6948 Fix tst_QNetworkReply::httpWithNoCredentialUsage autotest
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>
2012-03-06 18:24:09 +01:00
Shane Kearns
299e7ffd6a Fix QNetworkReply ioGetFromHttpWithCache test case
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>
2012-03-06 18:24:01 +01:00
Sergio Ahumada
db1abf9f76 Change bugreports.qt.nokia.com -> bugreports.qt-project.org
Change-Id: Ia795098f24cf358b15067f54cd08dff0bd792bc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-02 23:16:25 +01:00
Shane Kearns
7d5b0e2b04 network cookies: check "example.com" != "example.com."
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>
2012-02-29 17:46:06 +01:00
Kurt Korbatits
efb5a3a52e Changed qnetworkreply unittest to return correct code
- 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>
2012-02-27 04:19:28 +01:00
Marc Mutz
8d10d9a444 compile fix: missing #include <unistd.h>s
Change-Id: I3bd34f67033fb921c49da97419c107811d8da6ff
Reviewed-by: David Faure <faure@kde.org>
2012-02-23 13:25:26 +01:00
Shane Kearns
3f91cde588 Test for QT_NO_SSL instead of QT_NO_OPENSSL
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>
2012-02-21 15:28:40 +01:00
Kurt Korbatits
c66bb51a75 Changed qabstractnetworkcache unittest to use TESTDATA
- Changed qabstractnetworkcache to install testdata

Change-Id: I8f2ae6103214755ee7898dbc0ee50c0e4d7d45ab
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-02-20 09:36:51 +01:00