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 <stdint.h> | 8 #include <stdint.h> |
9 | |
10 #include <string> | 9 #include <string> |
| 10 #include <utility> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "net/base/sdch_manager.h" | 14 #include "net/base/sdch_manager.h" |
15 #include "net/filter/filter.h" | 15 #include "net/filter/filter.h" |
16 #include "net/log/net_log.h" | 16 #include "net/log/net_log.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 class URLRequestContext; | 21 class URLRequestContext; |
22 | 22 |
23 class MockFilterContext : public FilterContext { | 23 class MockFilterContext : public FilterContext { |
24 public: | 24 public: |
25 MockFilterContext(); | 25 MockFilterContext(); |
26 ~MockFilterContext() override; | 26 ~MockFilterContext() override; |
27 | 27 |
28 void SetMimeType(const std::string& mime_type) { mime_type_ = mime_type; } | 28 void SetMimeType(const std::string& mime_type) { mime_type_ = mime_type; } |
29 void SetURL(const GURL& gurl) { gurl_ = gurl; } | 29 void SetURL(const GURL& gurl) { gurl_ = gurl; } |
30 void SetRequestTime(const base::Time time) { request_time_ = time; } | 30 void SetRequestTime(const base::Time time) { request_time_ = time; } |
31 void SetCached(bool is_cached) { is_cached_content_ = is_cached; } | 31 void SetCached(bool is_cached) { is_cached_content_ = is_cached; } |
32 void SetResponseCode(int response_code) { response_code_ = response_code; } | 32 void SetResponseCode(int response_code) { response_code_ = response_code; } |
33 void SetSdchResponse(scoped_ptr<SdchManager::DictionarySet> handle) { | 33 void SetSdchResponse(scoped_ptr<SdchManager::DictionarySet> handle) { |
34 dictionaries_handle_ = handle.Pass(); | 34 dictionaries_handle_ = std::move(handle); |
35 } | 35 } |
36 URLRequestContext* GetModifiableURLRequestContext() const { | 36 URLRequestContext* GetModifiableURLRequestContext() const { |
37 return context_.get(); | 37 return context_.get(); |
38 } | 38 } |
39 | 39 |
40 // After a URLRequest's destructor is called, some interfaces may become | 40 // After a URLRequest's destructor is called, some interfaces may become |
41 // 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 |
42 // of those interfaces as coding errors. | 42 // of those interfaces as coding errors. |
43 void NukeUnstableInterfaces(); | 43 void NukeUnstableInterfaces(); |
44 | 44 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 int response_code_; | 79 int response_code_; |
80 scoped_ptr<URLRequestContext> context_; | 80 scoped_ptr<URLRequestContext> context_; |
81 BoundNetLog net_log_; | 81 BoundNetLog net_log_; |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(MockFilterContext); | 83 DISALLOW_COPY_AND_ASSIGN(MockFilterContext); |
84 }; | 84 }; |
85 | 85 |
86 } // namespace net | 86 } // namespace net |
87 | 87 |
88 #endif // NET_FILTER_MOCK_FILTER_CONTEXT_H_ | 88 #endif // NET_FILTER_MOCK_FILTER_CONTEXT_H_ |
OLD | NEW |