tst_QSslSocket: fix and clean up allowedProtocolNegotiation

The server's socket may not have been created yet, so use the server's signal
instead.
Switch to QCOMPARE to get better output.
Delete the extra checking for schannel, we don't support Windows 8 anymore.

Pick-to: 6.2
Change-Id: Icd310c32939cb577c9f3438789f667aa0a3a4d85
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Mårten Nordheim 2021-07-14 15:58:08 +02:00
parent 5d7a58ea45
commit 9c67aa2da1

View File

@ -3800,12 +3800,6 @@ void tst_QSslSocket::allowedProtocolNegotiation()
if (!hasServerAlpn)
QSKIP("Server-side ALPN is unsupported, skipping test");
if (isTestingSchannel) {
// TODO: move this check into the plugin (not to report ALPN as supported).
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8_1)
QSKIP("ALPN is not supported on this version of Windows using Schannel.");
}
QFETCH_GLOBAL(bool, setProxy);
if (setProxy)
return;
@ -3840,13 +3834,13 @@ void tst_QSslSocket::allowedProtocolNegotiation()
loop.exit();
};
connect(&clientSocket, &QSslSocket::encrypted, &loop, earlyQuitter);
connect(server.socket, &QSslSocket::encrypted, &loop, earlyQuitter);
connect(&server, &SslServer::socketEncrypted, &loop, earlyQuitter);
loop.exec();
QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() ==
clientSocket.sslConfiguration().nextNegotiatedProtocol());
QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == expectedNegotiated);
QCOMPARE(server.socket->sslConfiguration().nextNegotiatedProtocol(),
clientSocket.sslConfiguration().nextNegotiatedProtocol());
QCOMPARE(server.socket->sslConfiguration().nextNegotiatedProtocol(), expectedNegotiated);
}
#if QT_CONFIG(openssl)