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 "webkit/media/test_response_generator.h" | 5 #include "webkit/media/test_response_generator.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 return response; | 79 return response; |
80 } | 80 } |
81 | 81 |
82 WebURLResponse TestResponseGenerator::Generate404() { | 82 WebURLResponse TestResponseGenerator::Generate404() { |
83 WebURLResponse response(gurl_); | 83 WebURLResponse response(gurl_); |
84 response.setHTTPStatusCode(404); | 84 response.setHTTPStatusCode(404); |
85 return response; | 85 return response; |
86 } | 86 } |
87 | 87 |
| 88 WebURLResponse TestResponseGenerator::GenerateFileResponse( |
| 89 int64 first_byte_offset) { |
| 90 WebURLResponse response(gurl_); |
| 91 response.setHTTPStatusCode(0); |
| 92 |
| 93 if (first_byte_offset >= 0) { |
| 94 response.setExpectedContentLength(content_length_ - first_byte_offset); |
| 95 } else { |
| 96 response.setExpectedContentLength(-1); |
| 97 } |
| 98 return response; |
| 99 } |
| 100 |
88 } // namespace webkit_media | 101 } // namespace webkit_media |
OLD | NEW |