OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 }; | 62 }; |
63 | 63 |
64 // Required in order to create an instance of AndroidStreamReaderURLRequestJob. | 64 // Required in order to create an instance of AndroidStreamReaderURLRequestJob. |
65 class StreamReaderDelegate : | 65 class StreamReaderDelegate : |
66 public AndroidStreamReaderURLRequestJob::Delegate { | 66 public AndroidStreamReaderURLRequestJob::Delegate { |
67 public: | 67 public: |
68 StreamReaderDelegate() {} | 68 StreamReaderDelegate() {} |
69 | 69 |
70 virtual scoped_ptr<InputStream> OpenInputStream( | 70 virtual scoped_ptr<InputStream> OpenInputStream( |
71 JNIEnv* env, | 71 JNIEnv* env, |
72 net::URLRequest* request) { | 72 const GURL& url) { |
73 return make_scoped_ptr<InputStream>(new NotImplInputStream()); | 73 return make_scoped_ptr<InputStream>(new NotImplInputStream()); |
74 } | 74 } |
75 | 75 |
| 76 virtual void OnInputStreamOpenFailed(net::URLRequest* request, |
| 77 bool* restart) { |
| 78 *restart = false; |
| 79 } |
| 80 |
76 virtual bool GetMimeType( | 81 virtual bool GetMimeType( |
77 JNIEnv* env, | 82 JNIEnv* env, |
78 net::URLRequest* request, | 83 net::URLRequest* request, |
79 android_webview::InputStream* stream, | 84 android_webview::InputStream* stream, |
80 std::string* mime_type) { | 85 std::string* mime_type) { |
81 return false; | 86 return false; |
82 } | 87 } |
83 | 88 |
84 virtual bool GetCharset( | 89 virtual bool GetCharset( |
85 JNIEnv* env, | 90 JNIEnv* env, |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 311 |
307 SetRange(req_.get(), offset, bytes_available); | 312 SetRange(req_.get(), offset, bytes_available); |
308 req_->Start(); | 313 req_->Start(); |
309 | 314 |
310 loop.Run(); | 315 loop.Run(); |
311 | 316 |
312 EXPECT_EQ(0, network_delegate_.completed_requests()); | 317 EXPECT_EQ(0, network_delegate_.completed_requests()); |
313 req_->Cancel(); | 318 req_->Cancel(); |
314 EXPECT_EQ(1, network_delegate_.completed_requests()); | 319 EXPECT_EQ(1, network_delegate_.completed_requests()); |
315 } | 320 } |
OLD | NEW |