summaryrefslogtreecommitdiff
path: root/chromium/net/http/mock_http_cache.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-29 16:35:13 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-02-01 15:33:35 +0000
commitc8c2d1901aec01e934adf561a9fdf0cc776cdef8 (patch)
tree9157c3d9815e5870799e070b113813bec53e0535 /chromium/net/http/mock_http_cache.cc
parentabefd5095b41dac94ca451d784ab6e27372e981a (diff)
downloadqtwebengine-chromium-c8c2d1901aec01e934adf561a9fdf0cc776cdef8.tar.gz
BASELINE: Update Chromium to 64.0.3282.139
Change-Id: I1cae68fe9c94ff7608b26b8382fc19862cdb293a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/net/http/mock_http_cache.cc')
-rw-r--r--chromium/net/http/mock_http_cache.cc32
1 files changed, 13 insertions, 19 deletions
diff --git a/chromium/net/http/mock_http_cache.cc b/chromium/net/http/mock_http_cache.cc
index 7846cf80906..8c940f3bde4 100644
--- a/chromium/net/http/mock_http_cache.cc
+++ b/chromium/net/http/mock_http_cache.cc
@@ -14,6 +14,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "net/base/completion_callback.h"
#include "net/base/net_errors.h"
+#include "net/http/http_cache_writers.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
@@ -327,8 +328,7 @@ void MockDiskEntry::IgnoreCallbacks(bool value) {
StoreAndDeliverCallbacks(false, NULL, CompletionCallback(), 0);
}
-MockDiskEntry::~MockDiskEntry() {
-}
+MockDiskEntry::~MockDiskEntry() = default;
// Unlike the callbacks for MockHttpTransaction, we want this one to run even
// if the consumer called Close on the MockDiskEntry. We achieve that by
@@ -724,37 +724,32 @@ void MockHttpCache::SetTestMode(int test_mode) {
bool MockHttpCache::IsWriterPresent(const std::string& key) {
HttpCache::ActiveEntry* entry = http_cache_.FindActiveEntry(key);
- if (entry)
- return entry->writer;
- return false;
+ return entry && entry->writers && !entry->writers->IsEmpty();
}
bool MockHttpCache::IsHeadersTransactionPresent(const std::string& key) {
HttpCache::ActiveEntry* entry = http_cache_.FindActiveEntry(key);
- if (entry)
- return entry->headers_transaction;
- return false;
+ return entry && entry->headers_transaction;
}
int MockHttpCache::GetCountReaders(const std::string& key) {
HttpCache::ActiveEntry* entry = http_cache_.FindActiveEntry(key);
- if (entry)
- return entry->readers.size();
- return false;
+ return entry ? entry->readers.size() : 0;
}
int MockHttpCache::GetCountAddToEntryQueue(const std::string& key) {
HttpCache::ActiveEntry* entry = http_cache_.FindActiveEntry(key);
- if (entry)
- return entry->add_to_entry_queue.size();
- return false;
+ return entry ? entry->add_to_entry_queue.size() : 0;
}
int MockHttpCache::GetCountDoneHeadersQueue(const std::string& key) {
HttpCache::ActiveEntry* entry = http_cache_.FindActiveEntry(key);
- if (entry)
- return entry->done_headers_queue.size();
- return false;
+ return entry ? entry->done_headers_queue.size() : 0;
+}
+
+int MockHttpCache::GetCountWriterTransactions(const std::string& key) {
+ HttpCache::ActiveEntry* entry = http_cache_.FindActiveEntry(key);
+ return entry && entry->writers ? entry->writers->GetTransactionsCount() : 0;
}
//-----------------------------------------------------------------------------
@@ -783,8 +778,7 @@ MockBlockingBackendFactory::MockBlockingBackendFactory()
fail_(false) {
}
-MockBlockingBackendFactory::~MockBlockingBackendFactory() {
-}
+MockBlockingBackendFactory::~MockBlockingBackendFactory() = default;
int MockBlockingBackendFactory::CreateBackend(
NetLog* net_log,