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 #ifndef NET_FILTER_MOCK_FILTER_CONTEXT_H_ | 5 #ifndef NET_FILTER_MOCK_FILTER_CONTEXT_H_ |
6 #define NET_FILTER_MOCK_FILTER_CONTEXT_H_ | 6 #define NET_FILTER_MOCK_FILTER_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 ~MockFilterContext() override; | 23 ~MockFilterContext() override; |
24 | 24 |
25 void SetMimeType(const std::string& mime_type) { mime_type_ = mime_type; } | 25 void SetMimeType(const std::string& mime_type) { mime_type_ = mime_type; } |
26 void SetURL(const GURL& gurl) { gurl_ = gurl; } | 26 void SetURL(const GURL& gurl) { gurl_ = gurl; } |
27 void SetRequestTime(const base::Time time) { request_time_ = time; } | 27 void SetRequestTime(const base::Time time) { request_time_ = time; } |
28 void SetCached(bool is_cached) { is_cached_content_ = is_cached; } | 28 void SetCached(bool is_cached) { is_cached_content_ = is_cached; } |
29 void SetResponseCode(int response_code) { response_code_ = response_code; } | 29 void SetResponseCode(int response_code) { response_code_ = response_code; } |
30 void SetSdchResponse(scoped_ptr<SdchManager::DictionarySet> handle) { | 30 void SetSdchResponse(scoped_ptr<SdchManager::DictionarySet> handle) { |
31 dictionaries_handle_ = handle.Pass(); | 31 dictionaries_handle_ = handle.Pass(); |
32 } | 32 } |
| 33 void SetBrotliEnabled(bool is_brotli_enabled) { |
| 34 is_brotli_enabled_ = is_brotli_enabled; |
| 35 } |
33 URLRequestContext* GetModifiableURLRequestContext() const { | 36 URLRequestContext* GetModifiableURLRequestContext() const { |
34 return context_.get(); | 37 return context_.get(); |
35 } | 38 } |
36 | 39 |
37 // After a URLRequest's destructor is called, some interfaces may become | 40 // After a URLRequest's destructor is called, some interfaces may become |
38 // unstable. This method is used to signal that state, so we can tag use | 41 // unstable. This method is used to signal that state, so we can tag use |
39 // of those interfaces as coding errors. | 42 // of those interfaces as coding errors. |
40 void NukeUnstableInterfaces(); | 43 void NukeUnstableInterfaces(); |
41 | 44 |
42 bool GetMimeType(std::string* mime_type) const override; | 45 bool GetMimeType(std::string* mime_type) const override; |
(...skipping 16 matching lines...) Expand all Loading... |
59 | 62 |
60 int GetResponseCode() const override; | 63 int GetResponseCode() const override; |
61 | 64 |
62 // The URLRequestContext associated with the request. | 65 // The URLRequestContext associated with the request. |
63 const URLRequestContext* GetURLRequestContext() const override; | 66 const URLRequestContext* GetURLRequestContext() const override; |
64 | 67 |
65 void RecordPacketStats(StatisticSelector statistic) const override {} | 68 void RecordPacketStats(StatisticSelector statistic) const override {} |
66 | 69 |
67 const BoundNetLog& GetNetLog() const override; | 70 const BoundNetLog& GetNetLog() const override; |
68 | 71 |
| 72 bool IsBrotliEnabled() const override; |
| 73 |
69 private: | 74 private: |
70 std::string mime_type_; | 75 std::string mime_type_; |
71 GURL gurl_; | 76 GURL gurl_; |
72 base::Time request_time_; | 77 base::Time request_time_; |
73 bool is_cached_content_; | 78 bool is_cached_content_; |
74 scoped_ptr<SdchManager::DictionarySet> dictionaries_handle_; | 79 scoped_ptr<SdchManager::DictionarySet> dictionaries_handle_; |
75 bool ok_to_call_get_url_; | 80 bool ok_to_call_get_url_; |
76 int response_code_; | 81 int response_code_; |
77 scoped_ptr<URLRequestContext> context_; | 82 scoped_ptr<URLRequestContext> context_; |
78 BoundNetLog net_log_; | 83 BoundNetLog net_log_; |
| 84 bool is_brotli_enabled_; |
79 | 85 |
80 DISALLOW_COPY_AND_ASSIGN(MockFilterContext); | 86 DISALLOW_COPY_AND_ASSIGN(MockFilterContext); |
81 }; | 87 }; |
82 | 88 |
83 } // namespace net | 89 } // namespace net |
84 | 90 |
85 #endif // NET_FILTER_MOCK_FILTER_CONTEXT_H_ | 91 #endif // NET_FILTER_MOCK_FILTER_CONTEXT_H_ |
OLD | NEW |