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

Side by Side Diff: android_webview/browser/net/android_stream_reader_url_request_job_unittest.cc

Issue 11293252: Change Interceptors into URLRequestJobFactory::ProtocolHandlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years 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
« no previous file with comments | « no previous file | android_webview/browser/net/aw_url_request_context_getter.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "android_webview/browser/input_stream.h" 5 #include "android_webview/browser/input_stream.h"
6 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" 6 #include "android_webview/browser/net/android_stream_reader_url_request_job.h"
7 #include "android_webview/browser/net/aw_url_request_job_factory.h" 7 #include "android_webview/browser/net/aw_url_request_job_factory.h"
8 #include "android_webview/browser/net/input_stream_reader.h" 8 #include "android_webview/browser/net/input_stream_reader.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void SetUpTestJob(scoped_ptr<InputStreamReader> stream_reader) { 157 void SetUpTestJob(scoped_ptr<InputStreamReader> stream_reader) {
158 scoped_ptr<AndroidStreamReaderURLRequestJob::Delegate> 158 scoped_ptr<AndroidStreamReaderURLRequestJob::Delegate>
159 stream_reader_delegate(new StreamReaderDelegate()); 159 stream_reader_delegate(new StreamReaderDelegate());
160 TestStreamReaderJob* test_stream_reader_job = 160 TestStreamReaderJob* test_stream_reader_job =
161 new TestStreamReaderJob( 161 new TestStreamReaderJob(
162 req_.get(), 162 req_.get(),
163 &network_delegate_, 163 &network_delegate_,
164 stream_reader_delegate.Pass(), 164 stream_reader_delegate.Pass(),
165 stream_reader.Pass()); 165 stream_reader.Pass());
166 // The Interceptor is owned by the |factory_|. 166 // The Interceptor is owned by the |factory_|.
167 TestJobInterceptor* interceptor = new TestJobInterceptor; 167 TestJobInterceptor* protocol_handler = new TestJobInterceptor;
168 interceptor->set_main_intercept_job(test_stream_reader_job); 168 protocol_handler->set_main_intercept_job(test_stream_reader_job);
169 factory_.AddInterceptor(interceptor); 169 bool set_protocol = factory_.SetProtocolHandler("http", protocol_handler);
170 DCHECK(set_protocol);
170 } 171 }
171 172
172 MessageLoop loop_; 173 MessageLoop loop_;
173 TestURLRequestContext context_; 174 TestURLRequestContext context_;
174 android_webview::AwURLRequestJobFactory factory_; 175 android_webview::AwURLRequestJobFactory factory_;
175 TestDelegate url_request_delegate_; 176 TestDelegate url_request_delegate_;
176 TestNetworkDelegate network_delegate_; 177 TestNetworkDelegate network_delegate_;
177 scoped_ptr<TestURLRequest> req_; 178 scoped_ptr<TestURLRequest> req_;
178 }; 179 };
179 180
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 301
301 SetRange(req_.get(), offset, bytes_available); 302 SetRange(req_.get(), offset, bytes_available);
302 req_->Start(); 303 req_->Start();
303 304
304 loop.Run(); 305 loop.Run();
305 306
306 EXPECT_EQ(0, network_delegate_.completed_requests()); 307 EXPECT_EQ(0, network_delegate_.completed_requests());
307 req_->Cancel(); 308 req_->Cancel();
308 EXPECT_EQ(1, network_delegate_.completed_requests()); 309 EXPECT_EQ(1, network_delegate_.completed_requests());
309 } 310 }
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/net/aw_url_request_context_getter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698