Disable firewall check. It takes signifficant time, need to be on FILE thread.
[chromium-blink-merge.git] / net / filter / mock_filter_context.h
blob21e56ac92e17c314ba49d5f1bca21a0348a32816
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 #ifndef NET_FILTER_MOCK_FILTER_CONTEXT_H_
6 #define NET_FILTER_MOCK_FILTER_CONTEXT_H_
8 #include <string>
10 #include "net/filter/filter.h"
11 #include "url/gurl.h"
13 namespace net {
15 class MockFilterContext : public FilterContext {
16 public:
17 MockFilterContext();
18 virtual ~MockFilterContext();
20 void SetMimeType(const std::string& mime_type) { mime_type_ = mime_type; }
21 void SetURL(const GURL& gurl) { gurl_ = gurl; }
22 void SetContentDisposition(const std::string& disposition) {
23 content_disposition_ = disposition;
25 void SetRequestTime(const base::Time time) { request_time_ = time; }
26 void SetCached(bool is_cached) { is_cached_content_ = is_cached; }
27 void SetDownload(bool is_download) { is_download_ = is_download; }
28 void SetResponseCode(int response_code) { response_code_ = response_code; }
29 void SetSdchResponse(bool is_sdch_response) {
30 is_sdch_response_ = is_sdch_response;
33 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE;
35 // What URL was used to access this data?
36 // Return false if gurl is not present.
37 virtual bool GetURL(GURL* gurl) const OVERRIDE;
39 // What Content-Disposition did the server supply for this data?
40 // Return false if Content-Disposition was not present.
41 virtual bool GetContentDisposition(std::string* disposition) const OVERRIDE;
43 // What was this data requested from a server?
44 virtual base::Time GetRequestTime() const OVERRIDE;
46 // Is data supplied from cache, or fresh across the net?
47 virtual bool IsCachedContent() const OVERRIDE;
49 // Is this a download?
50 virtual bool IsDownload() const OVERRIDE;
52 // Was this data flagged as a response to a request with an SDCH dictionary?
53 virtual bool IsSdchResponse() const OVERRIDE;
55 // How many bytes were fed to filter(s) so far?
56 virtual int64 GetByteReadCount() const OVERRIDE;
58 virtual int GetResponseCode() const OVERRIDE;
60 virtual void RecordPacketStats(StatisticSelector statistic) const OVERRIDE {}
62 private:
63 int buffer_size_;
64 std::string mime_type_;
65 std::string content_disposition_;
66 GURL gurl_;
67 base::Time request_time_;
68 bool is_cached_content_;
69 bool is_download_;
70 bool is_sdch_response_;
71 int response_code_;
73 DISALLOW_COPY_AND_ASSIGN(MockFilterContext);
76 } // namespace net
78 #endif // NET_FILTER_MOCK_FILTER_CONTEXT_H_