Evict resources from resource pool after timeout
[chromium-blink-merge.git] / net / filter / mock_filter_context.cc
blobebcaa1865211a033c45f201d3bbaf069d2841cdd
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/filter/mock_filter_context.h"
7 #include "net/url_request/url_request_context.h"
9 namespace net {
11 MockFilterContext::MockFilterContext()
12 : is_cached_content_(false),
13 ok_to_call_get_url_(true),
14 response_code_(-1),
15 context_(new URLRequestContext()) {
18 MockFilterContext::~MockFilterContext() {}
20 void MockFilterContext::NukeUnstableInterfaces() {
21 context_.reset();
22 ok_to_call_get_url_ = false;
23 request_time_ = base::Time();
26 bool MockFilterContext::GetMimeType(std::string* mime_type) const {
27 *mime_type = mime_type_;
28 return true;
31 // What URL was used to access this data?
32 // Return false if gurl is not present.
33 bool MockFilterContext::GetURL(GURL* gurl) const {
34 DCHECK(ok_to_call_get_url_);
35 *gurl = gurl_;
36 return true;
39 // What was this data requested from a server?
40 base::Time MockFilterContext::GetRequestTime() const {
41 return request_time_;
44 bool MockFilterContext::IsCachedContent() const { return is_cached_content_; }
46 SdchManager::DictionarySet*
47 MockFilterContext::SdchDictionariesAdvertised() const {
48 return dictionaries_handle_.get();
51 int64 MockFilterContext::GetByteReadCount() const { return 0; }
53 int MockFilterContext::GetResponseCode() const { return response_code_; }
55 const URLRequestContext* MockFilterContext::GetURLRequestContext() const {
56 return context_.get();
59 const BoundNetLog& MockFilterContext::GetNetLog() const {
60 return net_log_;
63 } // namespace net