summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2020-01-09 11:58:34 +0100
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2020-01-10 12:54:53 +0100
commit94b3dd77f29a00ebbd1efdc66d75f57e1c75b152 (patch)
treeb95a984789b506b6a0e4df03648717e20282d2e2 /tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
parent9a112bebe56f5975bdb11549c8d66773cf60419f (diff)
QAbstractSocket: deprecate 'error' member-function
The one that is a getter for the last error found. This is to disambiguate the expression '&QAbstractSocket::error'. Introduce a new member-function socketError as a replacement. [ChangeLog][Deprecation Notice] QAbstractSocket::error() (the getter) is deprecated; superseded by socketError(). Task-number: QTBUG-80369 Change-Id: Ia2e3d108657aaa7929ab0810babe2ede309740ba Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp')
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 5a643c11a2..871d1c065f 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -526,7 +526,7 @@ void tst_QSslSocket::constructing()
QCOMPARE(socket.write(0, 0), qint64(-1));
QTest::ignoreMessage(QtWarningMsg, writeNotOpenMessage);
QCOMPARE(socket.write(QByteArray()), qint64(-1));
- QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError);
+ QCOMPARE(socket.socketError(), QAbstractSocket::UnknownSocketError);
QVERIFY(!socket.flush());
QVERIFY(!socket.isValid());
QCOMPARE(socket.localAddress(), QHostAddress());
@@ -1389,16 +1389,16 @@ void tst_QSslSocket::protocolServerSide()
QAbstractSocket::SocketState expectedState = (works) ? QAbstractSocket::ConnectedState : QAbstractSocket::UnconnectedState;
// Determine whether the client or the server caused the event loop
// to quit due to a socket error, and investigate the culprit.
- if (client.error() != QAbstractSocket::UnknownSocketError) {
+ if (client.socketError() != QAbstractSocket::UnknownSocketError) {
// It can happen that the client, after TCP connection established, before
// incomingConnection() slot fired, hits TLS initialization error and stops
// the loop, so the server socket is not created yet.
if (server.socket)
- QVERIFY(server.socket->error() == QAbstractSocket::UnknownSocketError);
+ QVERIFY(server.socket->socketError() == QAbstractSocket::UnknownSocketError);
QCOMPARE(client.state(), expectedState);
- } else if (server.socket->error() != QAbstractSocket::UnknownSocketError) {
- QVERIFY(client.error() == QAbstractSocket::UnknownSocketError);
+ } else if (server.socket->socketError() != QAbstractSocket::UnknownSocketError) {
+ QVERIFY(client.socketError() == QAbstractSocket::UnknownSocketError);
QCOMPARE(server.socket->state(), expectedState);
}
@@ -2010,7 +2010,7 @@ void tst_QSslSocket::setEmptyKey()
QTestEventLoop::instance().enterLoop(2);
QCOMPARE(socket.state(), QAbstractSocket::ConnectedState);
- QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError);
+ QCOMPARE(socket.socketError(), QAbstractSocket::UnknownSocketError);
}
void tst_QSslSocket::spontaneousWrite()
@@ -2782,11 +2782,11 @@ void tst_QSslSocket::writeBigChunk()
// no better way to do this right now since the error is the same as the default error.
if (socket->errorString().startsWith(QLatin1String("Unable to write data")))
{
- qWarning() << socket->error() << socket->errorString();
+ qWarning() << socket->socketError() << socket->errorString();
QFAIL("Error while writing! Check if the OpenSSL BIO size is limited?!");
}
// also check the error string. If another error (than UnknownError) occurred, it should be different than before
- QVERIFY2(errorBefore == errorAfter || socket->error() == QAbstractSocket::RemoteHostClosedError,
+ QVERIFY2(errorBefore == errorAfter || socket->socketError() == QAbstractSocket::RemoteHostClosedError,
QByteArray("unexpected error: ").append(qPrintable(errorAfter)));
// check that everything has been written to OpenSSL
@@ -2981,7 +2981,7 @@ void tst_QSslSocket::resume()
QCOMPARE(encryptedSpy.count(), 0);
QVERIFY(!socket.isEncrypted());
QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(socket.error(), QAbstractSocket::SslHandshakeFailedError);
+ QCOMPARE(socket.socketError(), QAbstractSocket::SslHandshakeFailedError);
}
}
@@ -4346,9 +4346,9 @@ void tst_QSslSocket::disabledProtocols()
// early, preventing any real connection from ever starting.
QSslSocket socket;
socket.setProtocol(disabledProtocol);
- QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError);
+ QCOMPARE(socket.socketError(), QAbstractSocket::UnknownSocketError);
socket.connectToHostEncrypted(QStringLiteral("doesnotmatter.org"), 1010);
- QCOMPARE(socket.error(), QAbstractSocket::SslInvalidUserDataError);
+ QCOMPARE(socket.socketError(), QAbstractSocket::SslInvalidUserDataError);
QCOMPARE(socket.state(), QAbstractSocket::UnconnectedState);
}
{
@@ -4358,14 +4358,14 @@ void tst_QSslSocket::disabledProtocols()
QVERIFY(server.listen());
QSslSocket socket;
- QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError);
+ QCOMPARE(socket.socketError(), QAbstractSocket::UnknownSocketError);
socket.connectToHost(QHostAddress::LocalHost, server.serverPort());
QVERIFY(socket.waitForConnected(timeoutMS));
socket.setProtocol(disabledProtocol);
socket.startClientEncryption();
- QCOMPARE(socket.error(), QAbstractSocket::SslInvalidUserDataError);
+ QCOMPARE(socket.socketError(), QAbstractSocket::SslInvalidUserDataError);
}
{
// 2. waitForEncrypted: client-side, blocking API plus requires from us
@@ -4389,7 +4389,7 @@ void tst_QSslSocket::disabledProtocols()
loop.enterLoopMSecs(timeoutMS);
QVERIFY(!loop.timeout());
QVERIFY(server.socket);
- QCOMPARE(server.socket->error(), QAbstractSocket::SslInvalidUserDataError);
+ QCOMPARE(server.socket->socketError(), QAbstractSocket::SslInvalidUserDataError);
}
}