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

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

Issue 1295523006: Using scoped_ptr for URLRequestJobFactoryImpl::SetProtocolHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing un-modified file Created 5 years, 4 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
« 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/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 stream_reader_delegate) { 211 stream_reader_delegate) {
212 TestStreamReaderJob* test_stream_reader_job = 212 TestStreamReaderJob* test_stream_reader_job =
213 new TestStreamReaderJob( 213 new TestStreamReaderJob(
214 req_.get(), 214 req_.get(),
215 &network_delegate_, 215 &network_delegate_,
216 stream_reader_delegate.Pass(), 216 stream_reader_delegate.Pass(),
217 stream_reader.Pass()); 217 stream_reader.Pass());
218 // The Interceptor is owned by the |factory_|. 218 // The Interceptor is owned by the |factory_|.
219 TestJobInterceptor* protocol_handler = new TestJobInterceptor; 219 TestJobInterceptor* protocol_handler = new TestJobInterceptor;
220 protocol_handler->set_main_intercept_job(test_stream_reader_job); 220 protocol_handler->set_main_intercept_job(test_stream_reader_job);
221 bool set_protocol = factory_.SetProtocolHandler("http", protocol_handler); 221 bool set_protocol =
222 factory_.SetProtocolHandler("http", make_scoped_ptr(protocol_handler));
222 DCHECK(set_protocol); 223 DCHECK(set_protocol);
223 224
224 protocol_handler = new TestJobInterceptor; 225 protocol_handler = new TestJobInterceptor;
225 protocol_handler->set_main_intercept_job(test_stream_reader_job); 226 protocol_handler->set_main_intercept_job(test_stream_reader_job);
226 set_protocol = factory_.SetProtocolHandler("content", protocol_handler); 227 set_protocol = factory_.SetProtocolHandler(
228 "content", make_scoped_ptr(protocol_handler));
227 DCHECK(set_protocol); 229 DCHECK(set_protocol);
228 } 230 }
229 231
230 base::MessageLoopForIO loop_; 232 base::MessageLoopForIO loop_;
231 TestURLRequestContext context_; 233 TestURLRequestContext context_;
232 android_webview::AwURLRequestJobFactory factory_; 234 android_webview::AwURLRequestJobFactory factory_;
233 TestDelegate url_request_delegate_; 235 TestDelegate url_request_delegate_;
234 TestNetworkDelegate network_delegate_; 236 TestNetworkDelegate network_delegate_;
235 scoped_ptr<URLRequest> req_; 237 scoped_ptr<URLRequest> req_;
236 }; 238 };
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 408
407 SetRange(req_.get(), offset, bytes_available); 409 SetRange(req_.get(), offset, bytes_available);
408 req_->Start(); 410 req_->Start();
409 411
410 loop.Run(); 412 loop.Run();
411 413
412 EXPECT_EQ(0, network_delegate_.completed_requests()); 414 EXPECT_EQ(0, network_delegate_.completed_requests());
413 req_->Cancel(); 415 req_->Cancel();
414 EXPECT_EQ(1, network_delegate_.completed_requests()); 416 EXPECT_EQ(1, network_delegate_.completed_requests());
415 } 417 }
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