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