summaryrefslogtreecommitdiffstats
path: root/webkit/glue/multipart_response_delegate_unittest.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-07 21:57:30 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-07 21:57:30 +0000
commit57279b98cf12689c603425fecec9d6e3e85515f5 (patch)
tree540a1bf717086c7ae7edc5d583a05e6ee8598906 /webkit/glue/multipart_response_delegate_unittest.cc
parentf07f39e6a966ae3397bc032e5c8fc543c0db7789 (diff)
downloadchromium_src-57279b98cf12689c603425fecec9d6e3e85515f5.zip
chromium_src-57279b98cf12689c603425fecec9d6e3e85515f5.tar.gz
chromium_src-57279b98cf12689c603425fecec9d6e3e85515f5.tar.bz2
Certain PDF files would not load in Chrome if the HTTP multipart response contains the Range header
instead of the Content-Range header. This would cause the Acrobat PDF plugin to freeze or display an error message. Fix is to look for the Range header while parsing the multipart response if we fail to find the Content-Range header. This fixes bug http://code.google.com/p/chromium/issues/detail?id=31050 Bug=31050 Test=Covered by test_shell_tests. Review URL: http://codereview.chromium.org/521048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35740 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/multipart_response_delegate_unittest.cc')
-rw-r--r--webkit/glue/multipart_response_delegate_unittest.cc49
1 files changed, 37 insertions, 12 deletions
diff --git a/webkit/glue/multipart_response_delegate_unittest.cc b/webkit/glue/multipart_response_delegate_unittest.cc
index 27a3629..b8d5fbe 100644
--- a/webkit/glue/multipart_response_delegate_unittest.cc
+++ b/webkit/glue/multipart_response_delegate_unittest.cc
@@ -541,12 +541,9 @@ TEST(MultipartResponseTest, MultipartByteRangeParsingTest) {
TEST(MultipartResponseTest, MultipartContentRangesTest) {
WebURLResponse response1;
response1.initialize();
- response1.setMIMEType(WebString::fromUTF8("application/pdf"));
- response1.setHTTPHeaderField(WebString::fromUTF8("Content-Length"),
- WebString::fromUTF8("200"));
- response1.setHTTPHeaderField(
- WebString::fromUTF8("Content-Range"),
- WebString::fromUTF8("bytes 1000-1050/5000"));
+ response1.setMIMEType("application/pdf");
+ response1.setHTTPHeaderField("Content-Length", "200");
+ response1.setHTTPHeaderField("Content-Range", "bytes 1000-1050/5000");
int content_range_lower_bound = 0;
int content_range_upper_bound = 0;
@@ -561,12 +558,9 @@ TEST(MultipartResponseTest, MultipartContentRangesTest) {
WebURLResponse response2;
response2.initialize();
- response2.setMIMEType(WebString::fromUTF8("application/pdf"));
- response2.setHTTPHeaderField(WebString::fromUTF8("Content-Length"),
- WebString::fromUTF8("200"));
- response2.setHTTPHeaderField(
- WebString::fromUTF8("Content-Range"),
- WebString::fromUTF8("bytes 1000/1050"));
+ response2.setMIMEType("application/pdf");
+ response2.setHTTPHeaderField("Content-Length", "200");
+ response2.setHTTPHeaderField("Content-Range", "bytes 1000/1050");
content_range_lower_bound = 0;
content_range_upper_bound = 0;
@@ -576,6 +570,37 @@ TEST(MultipartResponseTest, MultipartContentRangesTest) {
&content_range_upper_bound);
EXPECT_EQ(result, false);
+
+ WebURLResponse response3;
+ response3.initialize();
+ response3.setMIMEType("application/pdf");
+ response3.setHTTPHeaderField("Content-Length", "200");
+ response3.setHTTPHeaderField("Range", "bytes 1000-1050/5000");
+
+ content_range_lower_bound = 0;
+ content_range_upper_bound = 0;
+
+ result = MultipartResponseDelegate::ReadContentRanges(
+ response3, &content_range_lower_bound,
+ &content_range_upper_bound);
+
+ EXPECT_EQ(result, true);
+ EXPECT_EQ(content_range_lower_bound, 1000);
+ EXPECT_EQ(content_range_upper_bound, 1050);
+
+ WebURLResponse response4;
+ response4.initialize();
+ response4.setMIMEType("application/pdf");
+ response4.setHTTPHeaderField("Content-Length", "200");
+
+ content_range_lower_bound = 0;
+ content_range_upper_bound = 0;
+
+ result = MultipartResponseDelegate::ReadContentRanges(
+ response4, &content_range_lower_bound,
+ &content_range_upper_bound);
+
+ EXPECT_EQ(result, false);
}
} // namespace