Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: net/filter/mock_filter_context.cc

Issue 380003002: Improve testing for SDCH. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed braino: Added SDHC enable to the tests that need it. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "net/filter/mock_filter_context.h" 5 #include "net/filter/mock_filter_context.h"
6 6
7 #include "net/url_request/url_request_context.h" 7 #include "net/url_request/url_request_context.h"
8 8
9 namespace net { 9 namespace net {
10 10
11 MockFilterContext::MockFilterContext() 11 MockFilterContext::MockFilterContext()
12 : is_cached_content_(false), 12 : is_cached_content_(false),
13 is_download_(false), 13 is_download_(false),
14 is_sdch_response_(false), 14 is_sdch_response_(false),
15 ok_to_call_get_url_(true),
15 response_code_(-1), 16 response_code_(-1),
16 context_(new URLRequestContext()) { 17 context_(new URLRequestContext()) {
17 } 18 }
18 19
19 MockFilterContext::~MockFilterContext() {} 20 MockFilterContext::~MockFilterContext() {}
20 21
22 void MockFilterContext::NukeUnstableInterfaces() {
23 context_.reset();
24 ok_to_call_get_url_ = false;
25 }
26
21 bool MockFilterContext::GetMimeType(std::string* mime_type) const { 27 bool MockFilterContext::GetMimeType(std::string* mime_type) const {
22 *mime_type = mime_type_; 28 *mime_type = mime_type_;
23 return true; 29 return true;
24 } 30 }
25 31
26 // What URL was used to access this data? 32 // What URL was used to access this data?
27 // Return false if gurl is not present. 33 // Return false if gurl is not present.
28 bool MockFilterContext::GetURL(GURL* gurl) const { 34 bool MockFilterContext::GetURL(GURL* gurl) const {
35 DCHECK(ok_to_call_get_url_);
29 *gurl = gurl_; 36 *gurl = gurl_;
30 return true; 37 return true;
31 } 38 }
32 39
33 bool MockFilterContext::GetContentDisposition(std::string* disposition) const { 40 bool MockFilterContext::GetContentDisposition(std::string* disposition) const {
34 if (content_disposition_.empty()) 41 if (content_disposition_.empty())
35 return false; 42 return false;
36 *disposition = content_disposition_; 43 *disposition = content_disposition_;
37 return true; 44 return true;
38 } 45 }
(...skipping 11 matching lines...) Expand all
50 57
51 int64 MockFilterContext::GetByteReadCount() const { return 0; } 58 int64 MockFilterContext::GetByteReadCount() const { return 0; }
52 59
53 int MockFilterContext::GetResponseCode() const { return response_code_; } 60 int MockFilterContext::GetResponseCode() const { return response_code_; }
54 61
55 const URLRequestContext* MockFilterContext::GetURLRequestContext() const { 62 const URLRequestContext* MockFilterContext::GetURLRequestContext() const {
56 return context_.get(); 63 return context_.get();
57 } 64 }
58 65
59 } // namespace net 66 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698