OpenCoverage

qnetworkaccesscachebackend.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qnetworkaccesscachebackend.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4QNetworkAccessCacheBackend::QNetworkAccessCacheBackend()-
5 : QNetworkAccessBackend()-
6{-
7}
executed 14 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkAccessManager
  • tst_QNetworkReply
14
8-
9QNetworkAccessCacheBackend::~QNetworkAccessCacheBackend()-
10{-
11}-
12-
13void QNetworkAccessCacheBackend::open()-
14{-
15 if (operation() != QNetworkAccessManager::GetOperation
operation() !=...::GetOperationDescription
TRUEnever evaluated
FALSEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
|| !sendCacheContents()
!sendCacheContents()Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
0-13
16 QString msg = QCoreApplication::translate("QNetworkAccessCacheBackend", "Error opening %1")-
17 .arg(this->url().toString());-
18 error(QNetworkReply::ContentNotFoundError, msg);-
19 }
executed 4 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
else {
4
20 setAttribute(QNetworkRequest::SourceIsFromCacheAttribute, true);-
21 }
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9
22 finished();-
23}
executed 13 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
13
24-
25bool QNetworkAccessCacheBackend::sendCacheContents()-
26{-
27 setCachingEnabled(false);-
28 QAbstractNetworkCache *nc = networkCache();-
29 if (!nc
!ncDescription
TRUEnever evaluated
FALSEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
)
0-13
30 return
never executed: return false;
false;
never executed: return false;
0
31-
32 QNetworkCacheMetaData item = nc->metaData(url());-
33 if (!item.isValid()
!item.isValid()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QAbstractNetworkCache
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
)
1-12
34 return
executed 1 time by 1 test: return false;
Executed by:
  • tst_QAbstractNetworkCache
false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QAbstractNetworkCache
1
35-
36 QNetworkCacheMetaData::AttributesMap attributes = item.attributes();-
37 setAttribute(QNetworkRequest::HttpStatusCodeAttribute, attributes.value(QNetworkRequest::HttpStatusCodeAttribute));-
38 setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute));-
39-
40-
41 QNetworkCacheMetaData::RawHeaderList rawHeaders = item.rawHeaders();-
42 QNetworkCacheMetaData::RawHeaderList::ConstIterator it = rawHeaders.constBegin(),-
43 end = rawHeaders.constEnd();-
44 for ( ; it != end
it != endDescription
TRUEevaluated 39 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
; ++it) {
9-39
45 if (it->first.toLower() == "cache-control"
it->first.toLo...cache-control"Description
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 34 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
&&
5-34
46 it->second.toLower().contains("must-revalidate")
it->second.toL...t-revalidate")Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
2-3
47 return
executed 3 times by 2 tests: return false;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
false;
executed 3 times by 2 tests: return false;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
3
48 }-
49 setRawHeader(it->first, it->second);-
50 }
executed 36 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
36
51-
52-
53 QVariant redirectionTarget = attributes.value(QNetworkRequest::RedirectionTargetAttribute);-
54 if (redirectionTarget.isValid()
redirectionTarget.isValid()Description
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
) {
0-9
55 setAttribute(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget);-
56 redirectionRequested(redirectionTarget.toUrl());-
57 }
never executed: end of block
0
58-
59-
60 metaDataChanged();-
61-
62 if (operation() == QNetworkAccessManager::GetOperation
operation() ==...::GetOperationDescription
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-9
63 QIODevice *contents = nc->data(url());-
64 if (!contents
!contentsDescription
TRUEnever evaluated
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
)
0-9
65 return
never executed: return false;
false;
never executed: return false;
0
66 contents->setParent(this);-
67 writeDownstreamData(contents);-
68 }
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9
69-
70-
71-
72-
73 return
executed 9 times by 2 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
true;
executed 9 times by 2 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
9
74}-
75-
76void QNetworkAccessCacheBackend::closeDownstreamChannel()-
77{-
78}-
79-
80void QNetworkAccessCacheBackend::closeUpstreamChannel()-
81{-
82 ((!(false)) ? qt_assert_x(__PRETTY_FUNCTION__, "This function show not have been called!",__FILE__,129) : qt_noop());-
83}
never executed: end of block
0
84-
85void QNetworkAccessCacheBackend::upstreamReadyRead()-
86{-
87 ((!(false)) ? qt_assert_x(__PRETTY_FUNCTION__, "This function show not have been called!",__FILE__,134) : qt_noop());-
88}
never executed: end of block
0
89-
90void QNetworkAccessCacheBackend::downstreamReadyWrite()-
91{-
92 ((!(false)) ? qt_assert_x(__PRETTY_FUNCTION__, "This function show not have been called!",__FILE__,139) : qt_noop());-
93}
never executed: end of block
0
94-
95-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9