diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2016-09-26 23:38:37 +0200 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@edeltech.ch> | 2016-11-29 14:01:47 +0000 |
commit | 58e1465cb0042899063124ded827f52dd92b8b42 (patch) | |
tree | 80ffb624019628b9d3108d6f2edbbd9473d191f6 /tests/auto/network | |
parent | a0551ae6100a12a0590ef7352b5ea027a442c0d7 (diff) |
Add configurable connect timeout for QAbstractSocket
The aim of this patch is to allow the configuration of the connect
timeout used by QAbstractSocket that is currently hardcoded to 30
seconds.
Using QNetworkConfiguration for this allows to adapt the timeout per
network configuration (e.g. 2G vs wired lan)
[ChangeLog][QtNetwork] The connect timeout from QAbstractSocket
is now configurable through QNetworkConfiguration.
Change-Id: I1dc4051be2c74f925f7a9e0a9ccef332efc2e370
Reviewed-by: Lorn Potter <lorn.potter@canonical.com>
Diffstat (limited to 'tests/auto/network')
-rw-r--r-- | tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp index 0a52dd0388..6ca881d38a 100644 --- a/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp +++ b/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp @@ -53,6 +53,7 @@ private slots: void comparison(); void children(); void isRoamingAvailable(); + void connectTimeout(); #endif }; @@ -181,6 +182,21 @@ void tst_QNetworkConfiguration::isRoamingAvailable() } } } + +void tst_QNetworkConfiguration::connectTimeout() +{ + QNetworkConfigurationManager manager; + QList<QNetworkConfiguration> configs = manager.allConfigurations(); + + foreach (QNetworkConfiguration networkConfiguration, configs) { + QCOMPARE(networkConfiguration.connectTimeout(), 30000); + + bool result = networkConfiguration.setConnectTimeout(100); + QVERIFY(result); + + QCOMPARE(networkConfiguration.connectTimeout(), 100); + } +} #endif QTEST_MAIN(tst_QNetworkConfiguration) |