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

Side by Side Diff: net/url_request/url_request_job_tracker_unittest.cc

Issue 6674042: Make URLRequestHttpJob the only URLRequestJob concerned with FilterContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Responded to comments from willchan Created 9 years, 9 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
« net/base/filter.cc ('K') | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <string.h> 5 #include <string.h>
6 #include <algorithm> 6 #include <algorithm>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 NotifyDone(URLRequestStatus()); 111 NotifyDone(URLRequestStatus());
112 } else if (status > 0) { 112 } else if (status > 0) {
113 SetStatus(URLRequestStatus()); 113 SetStatus(URLRequestStatus());
114 } else { 114 } else {
115 ASSERT_FALSE(true) << "Unexpected OnReadCompleted callback."; 115 ASSERT_FALSE(true) << "Unexpected OnReadCompleted callback.";
116 } 116 }
117 117
118 NotifyReadComplete(status); 118 NotifyReadComplete(status);
119 } 119 }
120 120
121 bool GetContentEncodings( 121 Filter* SetupFilter() const {
122 std::vector<Filter::FilterType>* encoding_types) { 122 return request_->url().spec() == "test:compressed"
123 if (request_->url().spec() == "test:basic") { 123 ? Filter::GZipFactory() : NULL;
124 return false;
125 } else if (request_->url().spec() == "test:compressed") {
126 encoding_types->push_back(Filter::FILTER_TYPE_GZIP);
127 return true;
128 } else {
129 return URLRequestJob::GetContentEncodings(encoding_types);
130 }
131 } 124 }
132 125
133 // The data to send, will be set in Start(). 126 // The data to send, will be set in Start().
134 std::string response_data_; 127 std::string response_data_;
135 128
136 // Should reads be synchronous or asynchronous? 129 // Should reads be synchronous or asynchronous?
137 const bool async_reads_; 130 const bool async_reads_;
138 }; 131 };
139 132
140 // Google Mock Matcher to check two URLRequestStatus instances for 133 // Google Mock Matcher to check two URLRequestStatus instances for
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 AssertJobTrackerCallbacks("test:compressed"); 220 AssertJobTrackerCallbacks("test:compressed");
228 } 221 }
229 222
230 TEST_F(URLRequestJobTrackerTest, CompressedSync) { 223 TEST_F(URLRequestJobTrackerTest, CompressedSync) {
231 g_async_reads = false; 224 g_async_reads = false;
232 AssertJobTrackerCallbacks("test:compressed"); 225 AssertJobTrackerCallbacks("test:compressed");
233 } 226 }
234 227
235 } // namespace 228 } // namespace
236 } // namespace net 229 } // namespace net
OLDNEW
« net/base/filter.cc ('K') | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698