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) if (!hasServerAlpn)
QSKIP("Server-side ALPN is unsupported, skipping test"); 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); QFETCH_GLOBAL(bool, setProxy);
if (setProxy) if (setProxy)
return; return;
@ -3840,13 +3834,13 @@ void tst_QSslSocket::allowedProtocolNegotiation()
loop.exit(); loop.exit();
}; };
connect(&clientSocket, &QSslSocket::encrypted, &loop, earlyQuitter); connect(&clientSocket, &QSslSocket::encrypted, &loop, earlyQuitter);
connect(server.socket, &QSslSocket::encrypted, &loop, earlyQuitter); connect(&server, &SslServer::socketEncrypted, &loop, earlyQuitter);
loop.exec(); loop.exec();
QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == QCOMPARE(server.socket->sslConfiguration().nextNegotiatedProtocol(),
clientSocket.sslConfiguration().nextNegotiatedProtocol()); clientSocket.sslConfiguration().nextNegotiatedProtocol());
QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == expectedNegotiated); QCOMPARE(server.socket->sslConfiguration().nextNegotiatedProtocol(), expectedNegotiated);
} }
#if QT_CONFIG(openssl) #if QT_CONFIG(openssl)