tst_QHttpNetworkConnection: Move to use only one ctor

We want to get rid of the other one, it's all internal
API anyway.

Task-number: QTBUG-102855
Change-Id: I2b621c20f4dd7c8bf5f07db8db908c2b7b86976f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
bb10
Mårten Nordheim 2024-03-21 15:13:07 +01:00
parent 785a4a7149
commit b85acc8356
3 changed files with 11 additions and 13 deletions

View File

@ -34,9 +34,6 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
// Note: Only used from auto tests, normal usage is via QHttp1Configuration
const int QHttpNetworkConnectionPrivate::defaultHttpChannelCount = 6;
// The pipeline length. So there will be 4 requests in flight.
const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3;
// Only re-fill the pipeline if there's defaultRePipelineLength slots free in the pipeline.

View File

@ -138,7 +138,8 @@ class QHttpNetworkConnectionPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QHttpNetworkConnection)
public:
static const int defaultHttpChannelCount;
// Note: Only used from auto tests, normal usage is via QHttp1Configuration
static constexpr int defaultHttpChannelCount = 6;
static const int defaultPipelineLength;
static const int defaultRePipelineLength;

View File

@ -125,7 +125,7 @@ void tst_QHttpNetworkConnection::head()
QFETCH(QString, statusString);
QFETCH(int, contentLength);
QHttpNetworkConnection connection(host, port, encrypt);
QHttpNetworkConnection connection(QHttpNetworkConnectionPrivate::defaultHttpChannelCount, host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
QCOMPARE(connection.isSsl(), encrypt);
@ -175,7 +175,7 @@ void tst_QHttpNetworkConnection::get()
QFETCH(int, contentLength);
QFETCH(int, downloadSize);
QHttpNetworkConnection connection(host, port, encrypt);
QHttpNetworkConnection connection(QHttpNetworkConnectionPrivate::defaultHttpChannelCount, host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
QCOMPARE(connection.isSsl(), encrypt);
@ -241,7 +241,7 @@ void tst_QHttpNetworkConnection::put()
QFETCH(QString, data);
QFETCH(bool, succeed);
QHttpNetworkConnection connection(host, port, encrypt);
QHttpNetworkConnection connection(QHttpNetworkConnectionPrivate::defaultHttpChannelCount, host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
QCOMPARE(connection.isSsl(), encrypt);
@ -323,7 +323,7 @@ void tst_QHttpNetworkConnection::post()
QFETCH(int, contentLength);
QFETCH(int, downloadSize);
QHttpNetworkConnection connection(host, port, encrypt);
QHttpNetworkConnection connection(QHttpNetworkConnectionPrivate::defaultHttpChannelCount, host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
QCOMPARE(connection.isSsl(), encrypt);
@ -450,7 +450,7 @@ void tst_QHttpNetworkConnection::get401()
QFETCH(QString, password);
QFETCH(int, statusCode);
QHttpNetworkConnection connection(host, port, encrypt);
QHttpNetworkConnection connection(QHttpNetworkConnectionPrivate::defaultHttpChannelCount, host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
QCOMPARE(connection.isSsl(), encrypt);
@ -510,7 +510,7 @@ void tst_QHttpNetworkConnection::compression()
QFETCH(bool, autoCompress);
QFETCH(QString, contentCoding);
QHttpNetworkConnection connection(host, port, encrypt);
QHttpNetworkConnection connection(QHttpNetworkConnectionPrivate::defaultHttpChannelCount, host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
QCOMPARE(connection.isSsl(), encrypt);
@ -584,7 +584,7 @@ void tst_QHttpNetworkConnection::ignoresslerror()
QFETCH(bool, ignoreFromSignal);
QFETCH(int, statusCode);
QHttpNetworkConnection connection(host, port, encrypt);
QHttpNetworkConnection connection(QHttpNetworkConnectionPrivate::defaultHttpChannelCount, host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
if (ignoreInit)
@ -629,7 +629,7 @@ void tst_QHttpNetworkConnection::nossl()
QFETCH(bool, encrypt);
QFETCH(QNetworkReply::NetworkError, networkError);
QHttpNetworkConnection connection(host, port, encrypt);
QHttpNetworkConnection connection(QHttpNetworkConnectionPrivate::defaultHttpChannelCount, host, port, encrypt);
QCOMPARE(connection.port(), port);
QCOMPARE(connection.hostName(), host);
@ -919,7 +919,7 @@ void tst_QHttpNetworkConnection::getAndThenDeleteObject_data()
void tst_QHttpNetworkConnection::getAndThenDeleteObject()
{
// yes, this will leak if the testcase fails. I don't care. It must not fail then :P
QHttpNetworkConnection *connection = new QHttpNetworkConnection(httpServerName());
QHttpNetworkConnection *connection = new QHttpNetworkConnection(QHttpNetworkConnectionPrivate::defaultHttpChannelCount, httpServerName());
QHttpNetworkRequest request("http://" + httpServerName() + "/qtest/bigfile");
QHttpNetworkReply *reply = connection->sendRequest(request);
reply->setDownstreamLimited(true);