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 CONTENT_RENDERER_MEDIA_TEST_RESPONSE_GENERATOR_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_TEST_RESPONSE_GENERATOR_H_ |
6 #define CONTENT_RENDERER_MEDIA_TEST_RESPONSE_GENERATOR_H_ | 6 #define CONTENT_RENDERER_MEDIA_TEST_RESPONSE_GENERATOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "third_party/WebKit/public/platform/WebURLError.h" | 9 #include "third_party/WebKit/public/platform/WebURLError.h" |
10 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 10 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 kNoContentRange = 1 << 1, // Don't include Content-Range in 206 response. | 21 kNoContentRange = 1 << 1, // Don't include Content-Range in 206 response. |
22 kNoContentLength = 1 << 2, // Don't include Content-Length in 206 response. | 22 kNoContentLength = 1 << 2, // Don't include Content-Length in 206 response. |
23 kNoContentRangeInstanceSize = 1 << 3, // Content-Range: N-M/* in 206. | 23 kNoContentRangeInstanceSize = 1 << 3, // Content-Range: N-M/* in 206. |
24 }; | 24 }; |
25 | 25 |
26 // Build an HTTP response generator for the given URL. |content_length| is | 26 // Build an HTTP response generator for the given URL. |content_length| is |
27 // used to generate Content-Length and Content-Range headers. | 27 // used to generate Content-Length and Content-Range headers. |
28 TestResponseGenerator(const GURL& gurl, int64 content_length); | 28 TestResponseGenerator(const GURL& gurl, int64 content_length); |
29 | 29 |
30 // Generates a WebURLError object. | 30 // Generates a WebURLError object. |
31 WebKit::WebURLError GenerateError(); | 31 blink::WebURLError GenerateError(); |
32 | 32 |
33 // Generates a regular HTTP 200 response. | 33 // Generates a regular HTTP 200 response. |
34 WebKit::WebURLResponse Generate200(); | 34 blink::WebURLResponse Generate200(); |
35 | 35 |
36 // Generates a regular HTTP 206 response starting from |first_byte_offset| | 36 // Generates a regular HTTP 206 response starting from |first_byte_offset| |
37 // until the end of the resource. | 37 // until the end of the resource. |
38 WebKit::WebURLResponse Generate206(int64 first_byte_offset); | 38 blink::WebURLResponse Generate206(int64 first_byte_offset); |
39 | 39 |
40 // Generates a custom HTTP 206 response starting from |first_byte_offset| | 40 // Generates a custom HTTP 206 response starting from |first_byte_offset| |
41 // until the end of the resource. You can tweak what gets included in the | 41 // until the end of the resource. You can tweak what gets included in the |
42 // headers via |flags|. | 42 // headers via |flags|. |
43 WebKit::WebURLResponse Generate206(int64 first_byte_offset, Flags flags); | 43 blink::WebURLResponse Generate206(int64 first_byte_offset, Flags flags); |
44 | 44 |
45 // Generates a regular HTTP 404 response. | 45 // Generates a regular HTTP 404 response. |
46 WebKit::WebURLResponse Generate404(); | 46 blink::WebURLResponse Generate404(); |
47 | 47 |
48 // Generates a file:// response starting from |first_byte_offset| until the | 48 // Generates a file:// response starting from |first_byte_offset| until the |
49 // end of the resource. | 49 // end of the resource. |
50 // | 50 // |
51 // If |first_byte_offset| is negative a response containing no content length | 51 // If |first_byte_offset| is negative a response containing no content length |
52 // will be returned. | 52 // will be returned. |
53 WebKit::WebURLResponse GenerateFileResponse(int64 first_byte_offset); | 53 blink::WebURLResponse GenerateFileResponse(int64 first_byte_offset); |
54 | 54 |
55 int64 content_length() { return content_length_; } | 55 int64 content_length() { return content_length_; } |
56 | 56 |
57 private: | 57 private: |
58 GURL gurl_; | 58 GURL gurl_; |
59 int64 content_length_; | 59 int64 content_length_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(TestResponseGenerator); | 61 DISALLOW_COPY_AND_ASSIGN(TestResponseGenerator); |
62 }; | 62 }; |
63 | 63 |
64 } // namespace content | 64 } // namespace content |
65 | 65 |
66 #endif // CONTENT_RENDERER_MEDIA_TEST_RESPONSE_GENERATOR_H_ | 66 #endif // CONTENT_RENDERER_MEDIA_TEST_RESPONSE_GENERATOR_H_ |
OLD | NEW |