OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef MEDIA_BLINK_TEST_RESPONSE_GENERATOR_H_ | 5 #ifndef MEDIA_BLINK_TEST_RESPONSE_GENERATOR_H_ |
6 #define MEDIA_BLINK_TEST_RESPONSE_GENERATOR_H_ | 6 #define MEDIA_BLINK_TEST_RESPONSE_GENERATOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // Generates a custom HTTP 206 response starting from |first_byte_offset| | 52 // Generates a custom HTTP 206 response starting from |first_byte_offset| |
53 // until |last_byte_offset|. You can tweak what gets included in the | 53 // until |last_byte_offset|. You can tweak what gets included in the |
54 // headers via |flags|. | 54 // headers via |flags|. |
55 blink::WebURLResponse GeneratePartial206(int64_t first_byte_offset, | 55 blink::WebURLResponse GeneratePartial206(int64_t first_byte_offset, |
56 int64_t last_byte_offset, | 56 int64_t last_byte_offset, |
57 Flags flags); | 57 Flags flags); |
58 | 58 |
59 // Generates a regular HTTP 404 response. | 59 // Generates a regular HTTP 404 response. |
60 blink::WebURLResponse Generate404(); | 60 blink::WebURLResponse Generate404(); |
61 | 61 |
| 62 // Generate a HTTP response with specified code. |
| 63 blink::WebURLResponse GenerateResponse(int code); |
| 64 |
62 // Generates a file:// response starting from |first_byte_offset| until the | 65 // Generates a file:// response starting from |first_byte_offset| until the |
63 // end of the resource. | 66 // end of the resource. |
64 // | 67 // |
65 // If |first_byte_offset| is negative a response containing no content length | 68 // If |first_byte_offset| is negative a response containing no content length |
66 // will be returned. | 69 // will be returned. |
67 blink::WebURLResponse GenerateFileResponse(int64_t first_byte_offset); | 70 blink::WebURLResponse GenerateFileResponse(int64_t first_byte_offset); |
68 | 71 |
69 int64_t content_length() { return content_length_; } | 72 int64_t content_length() { return content_length_; } |
70 | 73 |
71 private: | 74 private: |
72 GURL gurl_; | 75 GURL gurl_; |
73 int64_t content_length_; | 76 int64_t content_length_; |
74 | 77 |
75 DISALLOW_COPY_AND_ASSIGN(TestResponseGenerator); | 78 DISALLOW_COPY_AND_ASSIGN(TestResponseGenerator); |
76 }; | 79 }; |
77 | 80 |
78 } // namespace media | 81 } // namespace media |
79 | 82 |
80 #endif // MEDIA_BLINK_TEST_RESPONSE_GENERATOR_H_ | 83 #endif // MEDIA_BLINK_TEST_RESPONSE_GENERATOR_H_ |
OLD | NEW |