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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "base/test/test_simple_task_runner.h" | 6 #include "base/test/test_simple_task_runner.h" |
7 #include "content/browser/streams/stream.h" | 7 #include "content/browser/streams/stream.h" |
8 #include "content/browser/streams/stream_registry.h" | 8 #include "content/browser/streams/stream_registry.h" |
9 #include "content/browser/streams/stream_url_request_job.h" | 9 #include "content/browser/streams/stream_url_request_job.h" |
10 #include "content/browser/streams/stream_write_observer.h" | 10 #include "content/browser/streams/stream_write_observer.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 public: | 33 public: |
34 // A simple ProtocolHandler implementation to create StreamURLRequestJob. | 34 // A simple ProtocolHandler implementation to create StreamURLRequestJob. |
35 class MockProtocolHandler : | 35 class MockProtocolHandler : |
36 public net::URLRequestJobFactory::ProtocolHandler { | 36 public net::URLRequestJobFactory::ProtocolHandler { |
37 public: | 37 public: |
38 MockProtocolHandler(StreamRegistry* registry) : registry_(registry) {} | 38 MockProtocolHandler(StreamRegistry* registry) : registry_(registry) {} |
39 | 39 |
40 // net::URLRequestJobFactory::ProtocolHandler override. | 40 // net::URLRequestJobFactory::ProtocolHandler override. |
41 virtual net::URLRequestJob* MaybeCreateJob( | 41 virtual net::URLRequestJob* MaybeCreateJob( |
42 net::URLRequest* request, | 42 net::URLRequest* request, |
43 net::NetworkDelegate* network_delegate) const OVERRIDE { | 43 net::NetworkDelegate* network_delegate) const override { |
44 scoped_refptr<Stream> stream = registry_->GetStream(request->url()); | 44 scoped_refptr<Stream> stream = registry_->GetStream(request->url()); |
45 if (stream.get()) | 45 if (stream.get()) |
46 return new StreamURLRequestJob(request, network_delegate, stream); | 46 return new StreamURLRequestJob(request, network_delegate, stream); |
47 return NULL; | 47 return NULL; |
48 } | 48 } |
49 | 49 |
50 private: | 50 private: |
51 StreamRegistry* registry_; | 51 StreamRegistry* registry_; |
52 }; | 52 }; |
53 | 53 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 stream->AddData(buffer, buffer->size()); | 171 stream->AddData(buffer, buffer->size()); |
172 stream->Finalize(); | 172 stream->Finalize(); |
173 | 173 |
174 net::HttpRequestHeaders extra_headers; | 174 net::HttpRequestHeaders extra_headers; |
175 extra_headers.SetHeader(net::HttpRequestHeaders::kRange, | 175 extra_headers.SetHeader(net::HttpRequestHeaders::kRange, |
176 net::HttpByteRange::Bounded(1, 3).GetHeaderValue()); | 176 net::HttpByteRange::Bounded(1, 3).GetHeaderValue()); |
177 TestRequest("GET", kStreamURL, extra_headers, 405, std::string()); | 177 TestRequest("GET", kStreamURL, extra_headers, 405, std::string()); |
178 } | 178 } |
179 | 179 |
180 } // namespace content | 180 } // namespace content |
OLD | NEW |