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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return false; | 61 return false; |
62 } | 62 } |
63 }; | 63 }; |
64 | 64 |
65 // Required in order to create an instance of AndroidStreamReaderURLRequestJob. | 65 // Required in order to create an instance of AndroidStreamReaderURLRequestJob. |
66 class StreamReaderDelegate : | 66 class StreamReaderDelegate : |
67 public AndroidStreamReaderURLRequestJob::Delegate { | 67 public AndroidStreamReaderURLRequestJob::Delegate { |
68 public: | 68 public: |
69 StreamReaderDelegate() {} | 69 StreamReaderDelegate() {} |
70 | 70 |
| 71 virtual void OnStart() OVERRIDE {} |
| 72 |
71 virtual scoped_ptr<InputStream> OpenInputStream( | 73 virtual scoped_ptr<InputStream> OpenInputStream( |
72 JNIEnv* env, | 74 JNIEnv* env, |
73 const GURL& url) OVERRIDE { | 75 const GURL& url) OVERRIDE { |
74 return make_scoped_ptr<InputStream>(new NotImplInputStream()); | 76 return make_scoped_ptr<InputStream>(new NotImplInputStream()); |
75 } | 77 } |
76 | 78 |
77 virtual void OnInputStreamOpenFailed(net::URLRequest* request, | 79 virtual void OnInputStreamOpenFailed(net::URLRequest* request, |
78 bool* restart) OVERRIDE { | 80 bool* restart) OVERRIDE { |
79 *restart = false; | 81 *restart = false; |
80 } | 82 } |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 350 |
349 SetRange(req_.get(), offset, bytes_available); | 351 SetRange(req_.get(), offset, bytes_available); |
350 req_->Start(); | 352 req_->Start(); |
351 | 353 |
352 loop.Run(); | 354 loop.Run(); |
353 | 355 |
354 EXPECT_EQ(0, network_delegate_.completed_requests()); | 356 EXPECT_EQ(0, network_delegate_.completed_requests()); |
355 req_->Cancel(); | 357 req_->Cancel(); |
356 EXPECT_EQ(1, network_delegate_.completed_requests()); | 358 EXPECT_EQ(1, network_delegate_.completed_requests()); |
357 } | 359 } |
OLD | NEW |