[sql] Callback and scoped-ignore tests for sql::Statement.
[chromium-blink-merge.git] / net / base / mock_filter_context.h
blobd35fc85230a871b2c1d07afd41c17f1a5e7a6856
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
3 // found in the LICENSE file.
5 #ifndef NET_BASE_MOCK_FILTER_CONTEXT_H_
6 #define NET_BASE_MOCK_FILTER_CONTEXT_H_
8 #include <string>
10 #include "googleurl/src/gurl.h"
11 #include "net/base/filter.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 SetRequestTime(const base::Time time) { request_time_ = time; }
23 void SetCached(bool is_cached) { is_cached_content_ = is_cached; }
24 void SetDownload(bool is_download) { is_download_ = is_download; }
25 void SetResponseCode(int response_code) { response_code_ = response_code; }
26 void SetSdchResponse(bool is_sdch_response) {
27 is_sdch_response_ = is_sdch_response;
30 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE;
32 // What URL was used to access this data?
33 // Return false if gurl is not present.
34 virtual bool GetURL(GURL* gurl) const OVERRIDE;
36 // What was this data requested from a server?
37 virtual base::Time GetRequestTime() const OVERRIDE;
39 // Is data supplied from cache, or fresh across the net?
40 virtual bool IsCachedContent() const OVERRIDE;
42 // Is this a download?
43 virtual bool IsDownload() const OVERRIDE;
45 // Was this data flagged as a response to a request with an SDCH dictionary?
46 virtual bool IsSdchResponse() const OVERRIDE;
48 // How many bytes were fed to filter(s) so far?
49 virtual int64 GetByteReadCount() const OVERRIDE;
51 virtual int GetResponseCode() const OVERRIDE;
53 virtual void RecordPacketStats(StatisticSelector statistic) const OVERRIDE {}
55 private:
56 int buffer_size_;
57 std::string mime_type_;
58 GURL gurl_;
59 base::Time request_time_;
60 bool is_cached_content_;
61 bool is_download_;
62 bool is_sdch_response_;
63 int response_code_;
65 DISALLOW_COPY_AND_ASSIGN(MockFilterContext);
68 } // namespace net
70 #endif // NET_BASE_MOCK_FILTER_CONTEXT_H_