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"
11 MockFilterContext::MockFilterContext()
12 : is_cached_content_(false),
14 ok_to_call_get_url_(true),
16 context_(new URLRequestContext()) {
19 MockFilterContext::~MockFilterContext() {}
21 void MockFilterContext::NukeUnstableInterfaces() {
23 ok_to_call_get_url_
= false;
24 request_time_
= base::Time();
27 bool MockFilterContext::GetMimeType(std::string
* mime_type
) const {
28 *mime_type
= mime_type_
;
32 // What URL was used to access this data?
33 // Return false if gurl is not present.
34 bool MockFilterContext::GetURL(GURL
* gurl
) const {
35 DCHECK(ok_to_call_get_url_
);
40 bool MockFilterContext::GetContentDisposition(std::string
* disposition
) const {
41 if (content_disposition_
.empty())
43 *disposition
= content_disposition_
;
47 // What was this data requested from a server?
48 base::Time
MockFilterContext::GetRequestTime() const {
52 bool MockFilterContext::IsCachedContent() const { return is_cached_content_
; }
54 bool MockFilterContext::IsDownload() const { return is_download_
; }
56 SdchManager::DictionarySet
*
57 MockFilterContext::SdchDictionariesAdvertised() const {
58 return dictionaries_handle_
.get();
61 int64
MockFilterContext::GetByteReadCount() const { return 0; }
63 int MockFilterContext::GetResponseCode() const { return response_code_
; }
65 const URLRequestContext
* MockFilterContext::GetURLRequestContext() const {
66 return context_
.get();
69 const BoundNetLog
& MockFilterContext::GetNetLog() const {