Remove Q_ASSERT's from QNetworkReply autotest

Rather than aborting in debug builds and failing mysteriously in release
builds, report fatal errors in all builds.

Change-Id: I020b06e19b7ffc8ae4413e1756259f4ca608f253
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
(cherry picked from commit bbfefe1b764cd41b7e677f26621fb6e76a67f9d7)
This commit is contained in:
Jason McDonald 2011-05-09 12:18:50 +10:00 committed by Rohan McGovern
parent 5f88d1fd08
commit 719ba0ea3a

View File

@ -779,7 +779,9 @@ public:
QTcpSocket* waitForNextConnectionSocket() {
waitForNewConnection(-1);
if (doSsl) {
Q_ASSERT(sslSocket);
if (!sslSocket)
qFatal("%s: sslSocket should not be null after calling waitForNewConnection()",
Q_FUNC_INFO);
return sslSocket;
} else {
//qDebug() << "returning nextPendingConnection";
@ -951,7 +953,8 @@ protected:
while (dataIndex < wantedSize) {
const int remainingBytes = wantedSize - measuredSentBytes;
const int bytesToWrite = qMin(remainingBytes, static_cast<int>(BlockSize));
Q_ASSERT(bytesToWrite);
if (bytesToWrite <= 0)
qFatal("%s: attempt to write %d bytes", Q_FUNC_INFO, bytesToWrite);
measuredSentBytes += writeNextData(client, bytesToWrite);
while (client->bytesToWrite() > 0) {
@ -1010,7 +1013,8 @@ public:
// Wait for data to be readyRead
bool ok = connect(&senderObj, SIGNAL(dataReady()), this, SLOT(slotDataReady()));
Q_ASSERT(ok);
if (!ok)
qFatal("%s: Cannot connect dataReady signal", Q_FUNC_INFO);
}
void wrapUp()
@ -1033,9 +1037,9 @@ protected:
void timerEvent(QTimerEvent *)
{
//qDebug() << "RateControlledReader: timerEvent bytesAvailable=" << device->bytesAvailable();
if (readBufferSize > 0) {
// This asserts passes all the time, except in the final flush.
//Q_ASSERT(device->bytesAvailable() <= readBufferSize);
if (readBufferSize > 0 && device->bytesAvailable() > readBufferSize) {
// This passes all the time, except in the final flush.
//qFatal("%s: Too many bytes available", Q_FUNC_INFO);
}
qint64 bytesRead = 0;
@ -1194,7 +1198,7 @@ QString tst_QNetworkReply::runSimpleRequest(QNetworkAccessManager::Operation op,
break;
default:
Q_ASSERT_X(false, "tst_QNetworkReply", "Invalid/unknown operation requested");
qFatal("%s: Invalid/unknown operation requested", Q_FUNC_INFO);
}
reply->setParent(this);