Chromium Code Reviews| Index: LayoutTests/http/tests/media/video-load-metadata-decode-error.cgi |
| diff --git a/LayoutTests/http/tests/media/video-load-metadata-decode-error.cgi b/LayoutTests/http/tests/media/video-load-metadata-decode-error.cgi |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..686986b4177908d3c8c130eebfec7c188df5fb7a |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/media/video-load-metadata-decode-error.cgi |
| @@ -0,0 +1,47 @@ |
| +#!/usr/bin/perl -wT |
| + |
| +use strict; |
| + |
| +use CGI; |
| +use File::stat; |
| + |
| +my $query = new CGI; |
| + |
| +my $name = $query->param('name'); |
| +my $filesize = stat($name)->size; |
| + |
| +# Get MIME type if provided. Default to video/mp4. |
| +my $type = $query->param('type') || "video/mp4"; |
|
acolwell GONE FROM CHROMIUM
2014/06/18 23:46:27
nit: Please remove the default so this parameter m
Srirama
2014/06/19 03:35:15
I will remove the default parameter. But I feel we
acolwell GONE FROM CHROMIUM
2014/06/23 16:35:28
But returning 400 will likely cause a test to fail
Srirama
2014/06/24 05:23:01
Done.
|
| + |
| +my $rangeEnd = $filesize - 1; |
| + |
| +# Print HTTP Header, disabling cache. |
| +print "Cache-Control: no-cache\n"; |
|
acolwell GONE FROM CHROMIUM
2014/06/18 23:46:27
What is responsible for printing the HTTP status l
Srirama
2014/06/19 03:35:15
I think based on the CGI output apache server will
|
| +print "Content-Length: " . $filesize . "\n"; |
| +print "Content-Type: " . $type . "\n"; |
| + |
| +print "\n"; |
| + |
| +open FILE, $name or die; |
| +binmode FILE; |
| +my ($data, $n); |
| +my $total = 0; |
| +my $break = $filesize / 4; |
| +my $string = "corrupt video"; |
| +seek(FILE, 0, 0); |
| + |
| +while (($n = read FILE, $data, 1024) != 0) { |
| + print $data; |
| + |
| + $total += $n; |
| + if ($total >= $filesize) { |
| + last; |
| + } |
| + |
| + if ($total >= $break) { |
| + print $string; |
| + $total += length($string); |
| + } |
| + |
| +} |
| +close(FILE); |