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