OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/filter/mock_filter_context.h" | 5 #include "net/filter/mock_filter_context.h" |
6 | 6 |
7 namespace net { | 7 namespace net { |
8 | 8 |
9 MockFilterContext::MockFilterContext() | 9 MockFilterContext::MockFilterContext() |
10 : is_cached_content_(false), | 10 : is_cached_content_(false), |
11 is_download_(false), | 11 is_download_(false), |
12 is_sdch_response_(false), | 12 is_sdch_response_(false), |
13 response_code_(-1) { | 13 response_code_(-1) { |
14 } | 14 } |
15 | 15 |
16 MockFilterContext::~MockFilterContext() {} | 16 MockFilterContext::~MockFilterContext() { |
| 17 } |
17 | 18 |
18 bool MockFilterContext::GetMimeType(std::string* mime_type) const { | 19 bool MockFilterContext::GetMimeType(std::string* mime_type) const { |
19 *mime_type = mime_type_; | 20 *mime_type = mime_type_; |
20 return true; | 21 return true; |
21 } | 22 } |
22 | 23 |
23 // What URL was used to access this data? | 24 // What URL was used to access this data? |
24 // Return false if gurl is not present. | 25 // Return false if gurl is not present. |
25 bool MockFilterContext::GetURL(GURL* gurl) const { | 26 bool MockFilterContext::GetURL(GURL* gurl) const { |
26 *gurl = gurl_; | 27 *gurl = gurl_; |
27 return true; | 28 return true; |
28 } | 29 } |
29 | 30 |
30 bool MockFilterContext::GetContentDisposition(std::string* disposition) const { | 31 bool MockFilterContext::GetContentDisposition(std::string* disposition) const { |
31 if (content_disposition_.empty()) | 32 if (content_disposition_.empty()) |
32 return false; | 33 return false; |
33 *disposition = content_disposition_; | 34 *disposition = content_disposition_; |
34 return true; | 35 return true; |
35 } | 36 } |
36 | 37 |
37 // What was this data requested from a server? | 38 // What was this data requested from a server? |
38 base::Time MockFilterContext::GetRequestTime() const { | 39 base::Time MockFilterContext::GetRequestTime() const { |
39 return request_time_; | 40 return request_time_; |
40 } | 41 } |
41 | 42 |
42 bool MockFilterContext::IsCachedContent() const { return is_cached_content_; } | 43 bool MockFilterContext::IsCachedContent() const { |
| 44 return is_cached_content_; |
| 45 } |
43 | 46 |
44 bool MockFilterContext::IsDownload() const { return is_download_; } | 47 bool MockFilterContext::IsDownload() const { |
| 48 return is_download_; |
| 49 } |
45 | 50 |
46 bool MockFilterContext::IsSdchResponse() const { return is_sdch_response_; } | 51 bool MockFilterContext::IsSdchResponse() const { |
| 52 return is_sdch_response_; |
| 53 } |
47 | 54 |
48 int64 MockFilterContext::GetByteReadCount() const { return 0; } | 55 int64 MockFilterContext::GetByteReadCount() const { |
| 56 return 0; |
| 57 } |
49 | 58 |
50 int MockFilterContext::GetResponseCode() const { return response_code_; } | 59 int MockFilterContext::GetResponseCode() const { |
| 60 return response_code_; |
| 61 } |
51 | 62 |
52 } // namespace net | 63 } // namespace net |
OLD | NEW |