diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-17 21:43:20 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-17 21:43:20 +0000 |
commit | 8ef59c3b8d485227dae56a1ce4edc784be329f59 (patch) | |
tree | 68344d77979b8a468e5d2c95e3798b87adfd836d /net/base/mime_sniffer_unittest.cc | |
parent | 4a324a1705813d626833e38539f3cc3bf27b2627 (diff) | |
download | chromium_src-8ef59c3b8d485227dae56a1ce4edc784be329f59.zip chromium_src-8ef59c3b8d485227dae56a1ce4edc784be329f59.tar.gz chromium_src-8ef59c3b8d485227dae56a1ce4edc784be329f59.tar.bz2 |
Fix problem where "text/xml" responses get buffered past 512 bytes, causing the response to be truncated.
BUG=3521
Review URL: http://codereview.chromium.org/7610
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3567 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/mime_sniffer_unittest.cc')
-rw-r--r-- | net/base/mime_sniffer_unittest.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/base/mime_sniffer_unittest.cc b/net/base/mime_sniffer_unittest.cc index 0ed87e8..caf258b 100644 --- a/net/base/mime_sniffer_unittest.cc +++ b/net/base/mime_sniffer_unittest.cc @@ -295,3 +295,16 @@ TEST(MimeSnifferTest, XMLTest) { } +// Test content which is >= 512 bytes, and includes no open angle bracket. +// http://code.google.com/p/chromium/issues/detail?id=3521 +TEST(MimeSnifferTest, XMLTestLargeNoAngledBracket) { + // Make a large input, with 600 bytes of "x". + std::string content; + content.resize(600); + std::fill(content.begin(), content.end(), 'x'); + + // content.size() >= kMaxBytesToSniff (512) so the sniff is unambiguous. + std::string mime_type; + EXPECT_TRUE(net::SniffMimeType(content.data(), content.size(), GURL(), + "text/xml", &mime_type)); +} |