| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BASE_MOCK_FILTER_CONTEXT_H_ | 5 #ifndef NET_BASE_MOCK_FILTER_CONTEXT_H_ |
| 6 #define NET_BASE_MOCK_FILTER_CONTEXT_H_ | 6 #define NET_BASE_MOCK_FILTER_CONTEXT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 #include "net/base/filter.h" | 12 #include "net/base/filter.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 class MockFilterContext : public FilterContext { | 16 class MockFilterContext : public FilterContext { |
| 17 public: | 17 public: |
| 18 explicit MockFilterContext(int buffer_size); | 18 MockFilterContext(); |
| 19 virtual ~MockFilterContext(); | 19 virtual ~MockFilterContext(); |
| 20 | 20 |
| 21 void SetBufferSize(int buffer_size) { buffer_size_ = buffer_size; } | |
| 22 void SetMimeType(const std::string& mime_type) { mime_type_ = mime_type; } | 21 void SetMimeType(const std::string& mime_type) { mime_type_ = mime_type; } |
| 23 void SetURL(const GURL& gurl) { gurl_ = gurl; } | 22 void SetURL(const GURL& gurl) { gurl_ = gurl; } |
| 24 void SetRequestTime(const base::Time time) { request_time_ = time; } | 23 void SetRequestTime(const base::Time time) { request_time_ = time; } |
| 25 void SetCached(bool is_cached) { is_cached_content_ = is_cached; } | 24 void SetCached(bool is_cached) { is_cached_content_ = is_cached; } |
| 26 void SetDownload(bool is_download) { is_download_ = is_download; } | 25 void SetDownload(bool is_download) { is_download_ = is_download; } |
| 27 void SetResponseCode(int response_code) { response_code_ = response_code; } | 26 void SetResponseCode(int response_code) { response_code_ = response_code; } |
| 28 void SetSdchResponse(bool is_sdch_response) { | 27 void SetSdchResponse(bool is_sdch_response) { |
| 29 is_sdch_response_ = is_sdch_response; | 28 is_sdch_response_ = is_sdch_response; |
| 30 } | 29 } |
| 31 | 30 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 45 virtual bool IsDownload() const; | 44 virtual bool IsDownload() const; |
| 46 | 45 |
| 47 // Was this data flagged as a response to a request with an SDCH dictionary? | 46 // Was this data flagged as a response to a request with an SDCH dictionary? |
| 48 virtual bool IsSdchResponse() const; | 47 virtual bool IsSdchResponse() const; |
| 49 | 48 |
| 50 // How many bytes were fed to filter(s) so far? | 49 // How many bytes were fed to filter(s) so far? |
| 51 virtual int64 GetByteReadCount() const; | 50 virtual int64 GetByteReadCount() const; |
| 52 | 51 |
| 53 virtual int GetResponseCode() const; | 52 virtual int GetResponseCode() const; |
| 54 | 53 |
| 55 // What is the desirable input buffer size for these filters? | |
| 56 virtual int GetInputStreamBufferSize() const; | |
| 57 | |
| 58 virtual void RecordPacketStats(StatisticSelector statistic) const {} | 54 virtual void RecordPacketStats(StatisticSelector statistic) const {} |
| 59 | 55 |
| 60 private: | 56 private: |
| 61 int buffer_size_; | 57 int buffer_size_; |
| 62 std::string mime_type_; | 58 std::string mime_type_; |
| 63 GURL gurl_; | 59 GURL gurl_; |
| 64 base::Time request_time_; | 60 base::Time request_time_; |
| 65 bool is_cached_content_; | 61 bool is_cached_content_; |
| 66 bool is_download_; | 62 bool is_download_; |
| 67 bool is_sdch_response_; | 63 bool is_sdch_response_; |
| 68 int response_code_; | 64 int response_code_; |
| 69 | 65 |
| 70 DISALLOW_COPY_AND_ASSIGN(MockFilterContext); | 66 DISALLOW_COPY_AND_ASSIGN(MockFilterContext); |
| 71 }; | 67 }; |
| 72 | 68 |
| 73 } // namespace net | 69 } // namespace net |
| 74 | 70 |
| 75 #endif // NET_BASE_MOCK_FILTER_CONTEXT_H_ | 71 #endif // NET_BASE_MOCK_FILTER_CONTEXT_H_ |
| OLD | NEW |