| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/bearer/qnetworksession.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | QNetworkSession::QNetworkSession(const QNetworkConfiguration &connectionConfig, QObject *parent) | - | ||||||||||||
| 5 | : QObject(parent), d(0) | - | ||||||||||||
| 6 | { | - | ||||||||||||
| 7 | - | |||||||||||||
| 8 | if (!connectionConfig.identifier().isEmpty()
| 2-78 | ||||||||||||
| 9 | const auto engines = qNetworkConfigurationManagerPrivate()->engines(); | - | ||||||||||||
| 10 | for (QBearerEngine *engine : engines) { | - | ||||||||||||
| 11 | if (engine->hasIdentifier(connectionConfig.identifier())
| 8-78 | ||||||||||||
| 12 | d = engine->createSessionBackend(); | - | ||||||||||||
| 13 | d->q = this; | - | ||||||||||||
| 14 | d->publicConfig = connectionConfig; | - | ||||||||||||
| 15 | d->syncStateWithInterface(); | - | ||||||||||||
| 16 | connect(d, qFlagLocation("2""quitPendingWaitsForOpened()" "\0" __FILE__ ":" "264"), this, qFlagLocation("2""opened()" "\0" __FILE__ ":" "264")); | - | ||||||||||||
| 17 | connect(d, qFlagLocation("2""error(QNetworkSession::SessionError)" "\0" __FILE__ ":" "265"), | - | ||||||||||||
| 18 | this, qFlagLocation("2""error(QNetworkSession::SessionError)" "\0" __FILE__ ":" "266")); | - | ||||||||||||
| 19 | connect(d, qFlagLocation("2""stateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "267"), | - | ||||||||||||
| 20 | this, qFlagLocation("2""stateChanged(QNetworkSession::State)" "\0" __FILE__ ":" "268")); | - | ||||||||||||
| 21 | connect(d, qFlagLocation("2""closed()" "\0" __FILE__ ":" "269"), this, qFlagLocation("2""closed()" "\0" __FILE__ ":" "269")); | - | ||||||||||||
| 22 | connect(d, qFlagLocation("2""preferredConfigurationChanged(QNetworkConfiguration,bool)" "\0" __FILE__ ":" "270"), | - | ||||||||||||
| 23 | this, qFlagLocation("2""preferredConfigurationChanged(QNetworkConfiguration,bool)" "\0" __FILE__ ":" "271")); | - | ||||||||||||
| 24 | connect(d, qFlagLocation("2""newConfigurationActivated()" "\0" __FILE__ ":" "272"), | - | ||||||||||||
| 25 | this, qFlagLocation("2""newConfigurationActivated()" "\0" __FILE__ ":" "273")); | - | ||||||||||||
| 26 | connect(d, qFlagLocation("2""usagePoliciesChanged(QNetworkSession::UsagePolicies)" "\0" __FILE__ ":" "274"), | - | ||||||||||||
| 27 | this, qFlagLocation("2""usagePoliciesChanged(QNetworkSession::UsagePolicies)" "\0" __FILE__ ":" "275")); | - | ||||||||||||
| 28 | break; executed 78 times by 15 tests: break;Executed by:
| 78 | ||||||||||||
| 29 | } | - | ||||||||||||
| 30 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||
| 31 | } executed 78 times by 15 tests: end of blockExecuted by:
| 78 | ||||||||||||
| 32 | - | |||||||||||||
| 33 | qRegisterMetaType<QNetworkSession::State>(); | - | ||||||||||||
| 34 | qRegisterMetaType<QNetworkSession::SessionError>(); | - | ||||||||||||
| 35 | qRegisterMetaType<QNetworkSession::UsagePolicies>(); | - | ||||||||||||
| 36 | } executed 80 times by 15 tests: end of blockExecuted by:
| 80 | ||||||||||||
| 37 | - | |||||||||||||
| 38 | - | |||||||||||||
| 39 | - | |||||||||||||
| 40 | - | |||||||||||||
| 41 | QNetworkSession::~QNetworkSession() | - | ||||||||||||
| 42 | { | - | ||||||||||||
| 43 | delete d; | - | ||||||||||||
| 44 | } executed 70 times by 12 tests: end of blockExecuted by:
| 70 | ||||||||||||
| 45 | void QNetworkSession::open() | - | ||||||||||||
| 46 | { | - | ||||||||||||
| 47 | if (d
| 1-70 | ||||||||||||
| 48 | d->open(); executed 70 times by 11 tests: d->open();Executed by:
| 70 | ||||||||||||
| 49 | else | - | ||||||||||||
| 50 | error(InvalidConfigurationError); executed 1 time by 1 test: error(InvalidConfigurationError);Executed by:
| 1 | ||||||||||||
| 51 | } | - | ||||||||||||
| 52 | bool QNetworkSession::waitForOpened(int msecs) | - | ||||||||||||
| 53 | { | - | ||||||||||||
| 54 | if (!d
| 1-11 | ||||||||||||
| 55 | return executed 1 time by 1 test: false;return false;Executed by:
executed 1 time by 1 test: return false;Executed by:
| 1 | ||||||||||||
| 56 | - | |||||||||||||
| 57 | if (d->isOpen
| 0-11 | ||||||||||||
| 58 | return executed 11 times by 9 tests: true;return true;Executed by:
executed 11 times by 9 tests: return true;Executed by:
| 11 | ||||||||||||
| 59 | - | |||||||||||||
| 60 | if (!(d->state == Connecting
| 0 | ||||||||||||
| 61 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 62 | } | - | ||||||||||||
| 63 | - | |||||||||||||
| 64 | QEventLoop loop; | - | ||||||||||||
| 65 | QObject::connect(d, qFlagLocation("2""quitPendingWaitsForOpened()" "\0" __FILE__ ":" "349"), &loop, qFlagLocation("1""quit()" "\0" __FILE__ ":" "349")); | - | ||||||||||||
| 66 | QObject::connect(this, qFlagLocation("2""error(QNetworkSession::SessionError)" "\0" __FILE__ ":" "350"), &loop, qFlagLocation("1""quit()" "\0" __FILE__ ":" "350")); | - | ||||||||||||
| 67 | - | |||||||||||||
| 68 | - | |||||||||||||
| 69 | if (msecs >= 0
| 0 | ||||||||||||
| 70 | QTimer::singleShot(msecs, &loop, qFlagLocation("1""quit()" "\0" __FILE__ ":" "354")); never executed: QTimer::singleShot(msecs, &loop, qFlagLocation("1""quit()" "\0" __FILE__ ":" "354")); | 0 | ||||||||||||
| 71 | - | |||||||||||||
| 72 | - | |||||||||||||
| 73 | loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents); | - | ||||||||||||
| 74 | - | |||||||||||||
| 75 | return never executed: d->isOpen;return d->isOpen;never executed: return d->isOpen; | 0 | ||||||||||||
| 76 | } | - | ||||||||||||
| 77 | void QNetworkSession::close() | - | ||||||||||||
| 78 | { | - | ||||||||||||
| 79 | if (d
| 0-4 | ||||||||||||
| 80 | d->close(); executed 4 times by 1 test: d->close();Executed by:
| 4 | ||||||||||||
| 81 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 82 | void QNetworkSession::stop() | - | ||||||||||||
| 83 | { | - | ||||||||||||
| 84 | if (d
| 0 | ||||||||||||
| 85 | d->stop(); never executed: d->stop(); | 0 | ||||||||||||
| 86 | } never executed: end of block | 0 | ||||||||||||
| 87 | - | |||||||||||||
| 88 | - | |||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| 91 | - | |||||||||||||
| 92 | - | |||||||||||||
| 93 | QNetworkConfiguration QNetworkSession::configuration() const | - | ||||||||||||
| 94 | { | - | ||||||||||||
| 95 | return executed 138 times by 4 tests: d ? d->publicConfig : QNetworkConfiguration();return d ? d->publicConfig : QNetworkConfiguration();Executed by:
executed 138 times by 4 tests: return d ? d->publicConfig : QNetworkConfiguration();Executed by:
| 138 | ||||||||||||
| 96 | } | - | ||||||||||||
| 97 | QNetworkInterface QNetworkSession::interface() const | - | ||||||||||||
| 98 | { | - | ||||||||||||
| 99 | return executed 4 times by 1 test: d ? d->currentInterface() : QNetworkInterface();return d ? d->currentInterface() : QNetworkInterface();Executed by:
executed 4 times by 1 test: return d ? d->currentInterface() : QNetworkInterface();Executed by:
| 4 | ||||||||||||
| 100 | } | - | ||||||||||||
| 101 | bool QNetworkSession::isOpen() const | - | ||||||||||||
| 102 | { | - | ||||||||||||
| 103 | return executed 1297 times by 10 tests: d ? d->isOpen : false;return d ? d->isOpen : false;Executed by:
executed 1297 times by 10 tests: return d ? d->isOpen : false;Executed by:
| 1297 | ||||||||||||
| 104 | } | - | ||||||||||||
| 105 | QNetworkSession::State QNetworkSession::state() const | - | ||||||||||||
| 106 | { | - | ||||||||||||
| 107 | return executed 2087 times by 10 tests: d ? d->state : QNetworkSession::Invalid;return d ? d->state : QNetworkSession::Invalid;Executed by:
executed 2087 times by 10 tests: return d ? d->state : QNetworkSession::Invalid;Executed by:
| 2087 | ||||||||||||
| 108 | } | - | ||||||||||||
| 109 | - | |||||||||||||
| 110 | - | |||||||||||||
| 111 | - | |||||||||||||
| 112 | - | |||||||||||||
| 113 | - | |||||||||||||
| 114 | - | |||||||||||||
| 115 | QNetworkSession::SessionError QNetworkSession::error() const | - | ||||||||||||
| 116 | { | - | ||||||||||||
| 117 | return executed 2 times by 1 test: d ? d->error() : InvalidConfigurationError;return d ? d->error() : InvalidConfigurationError;Executed by:
executed 2 times by 1 test: return d ? d->error() : InvalidConfigurationError;Executed by:
| 2 | ||||||||||||
| 118 | } | - | ||||||||||||
| 119 | - | |||||||||||||
| 120 | - | |||||||||||||
| 121 | - | |||||||||||||
| 122 | - | |||||||||||||
| 123 | - | |||||||||||||
| 124 | - | |||||||||||||
| 125 | - | |||||||||||||
| 126 | QString QNetworkSession::errorString() const | - | ||||||||||||
| 127 | { | - | ||||||||||||
| 128 | return never executed: d ? d->errorString() : tr("Invalid configuration.");return d ? d->errorString() : tr("Invalid configuration.");never executed: return d ? d->errorString() : tr("Invalid configuration."); | 0 | ||||||||||||
| 129 | } | - | ||||||||||||
| 130 | QVariant QNetworkSession::sessionProperty(const QString &key) const | - | ||||||||||||
| 131 | { | - | ||||||||||||
| 132 | if (!d
| 0-127 | ||||||||||||
| 133 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||
| 134 | - | |||||||||||||
| 135 | if (key == QLatin1String("ActiveConfiguration")
| 11-116 | ||||||||||||
| 136 | return executed 116 times by 2 tests: d->isOpen ? d->activeConfig.identifier() : QString();return d->isOpen ? d->activeConfig.identifier() : QString();Executed by:
executed 116 times by 2 tests: return d->isOpen ? d->activeConfig.identifier() : QString();Executed by:
| 116 | ||||||||||||
| 137 | - | |||||||||||||
| 138 | if (key == QLatin1String("UserChoiceConfiguration")
| 0-11 | ||||||||||||
| 139 | if (!d->isOpen
| 0 | ||||||||||||
| 140 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||
| 141 | - | |||||||||||||
| 142 | if (d->serviceConfig.isValid()
| 0 | ||||||||||||
| 143 | return never executed: d->serviceConfig.identifier();return d->serviceConfig.identifier();never executed: return d->serviceConfig.identifier(); | 0 | ||||||||||||
| 144 | else | - | ||||||||||||
| 145 | return never executed: d->activeConfig.identifier();return d->activeConfig.identifier();never executed: return d->activeConfig.identifier(); | 0 | ||||||||||||
| 146 | } | - | ||||||||||||
| 147 | - | |||||||||||||
| 148 | return executed 11 times by 2 tests: d->sessionProperty(key);return d->sessionProperty(key);Executed by:
executed 11 times by 2 tests: return d->sessionProperty(key);Executed by:
| 11 | ||||||||||||
| 149 | } | - | ||||||||||||
| 150 | void QNetworkSession::setSessionProperty(const QString &key, const QVariant &value) | - | ||||||||||||
| 151 | { | - | ||||||||||||
| 152 | if (!d
| 0-61 | ||||||||||||
| 153 | return; never executed: return; | 0 | ||||||||||||
| 154 | - | |||||||||||||
| 155 | if (key == QLatin1String("ActiveConfiguration")
| 0-61 | ||||||||||||
| 156 | key == QLatin1String("UserChoiceConfiguration")
| 0-61 | ||||||||||||
| 157 | return; never executed: return; | 0 | ||||||||||||
| 158 | } | - | ||||||||||||
| 159 | - | |||||||||||||
| 160 | d->setSessionProperty(key, value); | - | ||||||||||||
| 161 | } executed 61 times by 6 tests: end of blockExecuted by:
| 61 | ||||||||||||
| 162 | void QNetworkSession::migrate() | - | ||||||||||||
| 163 | { | - | ||||||||||||
| 164 | if (d
| 0-1 | ||||||||||||
| 165 | d->migrate(); executed 1 time by 1 test: d->migrate();Executed by:
| 1 | ||||||||||||
| 166 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 167 | - | |||||||||||||
| 168 | - | |||||||||||||
| 169 | - | |||||||||||||
| 170 | - | |||||||||||||
| 171 | - | |||||||||||||
| 172 | - | |||||||||||||
| 173 | void QNetworkSession::ignore() | - | ||||||||||||
| 174 | { | - | ||||||||||||
| 175 | if (d
| 0-1 | ||||||||||||
| 176 | d->ignore(); executed 1 time by 1 test: d->ignore();Executed by:
| 1 | ||||||||||||
| 177 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 178 | void QNetworkSession::accept() | - | ||||||||||||
| 179 | { | - | ||||||||||||
| 180 | if (d
| 0-1 | ||||||||||||
| 181 | d->accept(); executed 1 time by 1 test: d->accept();Executed by:
| 1 | ||||||||||||
| 182 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 183 | void QNetworkSession::reject() | - | ||||||||||||
| 184 | { | - | ||||||||||||
| 185 | if (d
| 0-1 | ||||||||||||
| 186 | d->reject(); executed 1 time by 1 test: d->reject();Executed by:
| 1 | ||||||||||||
| 187 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 188 | quint64 QNetworkSession::bytesWritten() const | - | ||||||||||||
| 189 | { | - | ||||||||||||
| 190 | return never executed: d ? d->bytesWritten() : static_cast<unsigned long long>(0ULL);return d ? d->bytesWritten() : static_cast<unsigned long long>(0ULL);never executed: return d ? d->bytesWritten() : static_cast<unsigned long long>(0ULL); | 0 | ||||||||||||
| 191 | } | - | ||||||||||||
| 192 | quint64 QNetworkSession::bytesReceived() const | - | ||||||||||||
| 193 | { | - | ||||||||||||
| 194 | return never executed: d ? d->bytesReceived() : static_cast<unsigned long long>(0ULL);return d ? d->bytesReceived() : static_cast<unsigned long long>(0ULL);never executed: return d ? d->bytesReceived() : static_cast<unsigned long long>(0ULL); | 0 | ||||||||||||
| 195 | } | - | ||||||||||||
| 196 | - | |||||||||||||
| 197 | - | |||||||||||||
| 198 | - | |||||||||||||
| 199 | - | |||||||||||||
| 200 | quint64 QNetworkSession::activeTime() const | - | ||||||||||||
| 201 | { | - | ||||||||||||
| 202 | return never executed: d ? d->activeTime() : static_cast<unsigned long long>(0ULL);return d ? d->activeTime() : static_cast<unsigned long long>(0ULL);never executed: return d ? d->activeTime() : static_cast<unsigned long long>(0ULL); | 0 | ||||||||||||
| 203 | } | - | ||||||||||||
| 204 | - | |||||||||||||
| 205 | - | |||||||||||||
| 206 | - | |||||||||||||
| 207 | - | |||||||||||||
| 208 | QNetworkSession::UsagePolicies QNetworkSession::usagePolicies() const | - | ||||||||||||
| 209 | { | - | ||||||||||||
| 210 | return executed 38 times by 2 tests: d ? d->usagePolicies() : QNetworkSession::NoPolicy;return d ? d->usagePolicies() : QNetworkSession::NoPolicy;Executed by:
executed 38 times by 2 tests: return d ? d->usagePolicies() : QNetworkSession::NoPolicy;Executed by:
| 38 | ||||||||||||
| 211 | } | - | ||||||||||||
| 212 | - | |||||||||||||
| 213 | - | |||||||||||||
| 214 | - | |||||||||||||
| 215 | - | |||||||||||||
| 216 | - | |||||||||||||
| 217 | - | |||||||||||||
| 218 | void QNetworkSessionPrivate::setUsagePolicies(QNetworkSession &session, QNetworkSession::UsagePolicies policies) | - | ||||||||||||
| 219 | { | - | ||||||||||||
| 220 | if (!session.d
| 0-48 | ||||||||||||
| 221 | return; never executed: return; | 0 | ||||||||||||
| 222 | session.d->setUsagePolicies(policies); | - | ||||||||||||
| 223 | } executed 48 times by 2 tests: end of blockExecuted by:
| 48 | ||||||||||||
| 224 | void QNetworkSession::connectNotify(const QMetaMethod &signal) | - | ||||||||||||
| 225 | { | - | ||||||||||||
| 226 | QObject::connectNotify(signal); | - | ||||||||||||
| 227 | - | |||||||||||||
| 228 | if (!d
| 1-2284 | ||||||||||||
| 229 | return; executed 1 time by 1 test: return;Executed by:
| 1 | ||||||||||||
| 230 | - | |||||||||||||
| 231 | - | |||||||||||||
| 232 | - | |||||||||||||
| 233 | static const QMetaMethod preferredConfigurationChangedSignal = | - | ||||||||||||
| 234 | QMetaMethod::fromSignal(&QNetworkSession::preferredConfigurationChanged); | - | ||||||||||||
| 235 | if (signal == preferredConfigurationChangedSignal
| 0-2284 | ||||||||||||
| 236 | d->setALREnabled(true); never executed: d->setALREnabled(true); | 0 | ||||||||||||
| 237 | } executed 2284 times by 10 tests: end of blockExecuted by:
| 2284 | ||||||||||||
| 238 | void QNetworkSession::disconnectNotify(const QMetaMethod &signal) | - | ||||||||||||
| 239 | { | - | ||||||||||||
| 240 | QObject::disconnectNotify(signal); | - | ||||||||||||
| 241 | - | |||||||||||||
| 242 | if (!d
| 1-2227 | ||||||||||||
| 243 | return; executed 1 time by 1 test: return;Executed by:
| 1 | ||||||||||||
| 244 | - | |||||||||||||
| 245 | - | |||||||||||||
| 246 | - | |||||||||||||
| 247 | static const QMetaMethod preferredConfigurationChangedSignal = | - | ||||||||||||
| 248 | QMetaMethod::fromSignal(&QNetworkSession::preferredConfigurationChanged); | - | ||||||||||||
| 249 | if (signal == preferredConfigurationChangedSignal
| 0-2227 | ||||||||||||
| 250 | d->setALREnabled(false); never executed: d->setALREnabled(false); | 0 | ||||||||||||
| 251 | } executed 2227 times by 11 tests: end of blockExecuted by:
| 2227 | ||||||||||||
| 252 | - | |||||||||||||
| 253 | - | |||||||||||||
| 254 | - | |||||||||||||
| Switch to Source code | Preprocessed file |