summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-22 08:21:00 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-22 08:21:00 +0000
commite5c537aa4654e79406fe5867a06e896c7c840693 (patch)
tree7f182129d5a2aea3ce9d2d5bc50598b75df4496e
parentc44c97d3695e73e3f25738e047ac604d86aca5ff (diff)
downloadchromium_src-e5c537aa4654e79406fe5867a06e896c7c840693.zip
chromium_src-e5c537aa4654e79406fe5867a06e896c7c840693.tar.gz
chromium_src-e5c537aa4654e79406fe5867a06e896c7c840693.tar.bz2
We should download text/csv mime types instead of displaying them.
BUG=6079 R=darin Review URL: http://codereview.chromium.org/18349 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8448 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/base/mime_util.cc9
-rw-r--r--net/base/mime_util_unittest.cc5
-rw-r--r--webkit/glue/mimetype_unittest.cc12
3 files changed, 16 insertions, 10 deletions
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index e3ef145..03d09ad 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -242,12 +242,9 @@ bool MimeUtil::IsViewSourceMimeType(const char* mime_type) const {
// Mirrors WebViewImpl::CanShowMIMEType()
bool MimeUtil::IsSupportedMimeType(const std::string& mime_type) const {
- if (mime_type.compare(0, 5, "text/") == 0 ||
- (mime_type.compare(0, 6, "image/") == 0 &&
- IsSupportedImageMimeType(mime_type.c_str())) ||
- IsSupportedNonImageMimeType(mime_type.c_str()))
- return true;
- return false;
+ return (mime_type.compare(0, 6, "image/") == 0 &&
+ IsSupportedImageMimeType(mime_type.c_str())) ||
+ IsSupportedNonImageMimeType(mime_type.c_str());
}
bool MimeUtil::MatchesMimeType(const std::string &mime_type_pattern,
diff --git a/net/base/mime_util_unittest.cc b/net/base/mime_util_unittest.cc
index d966005..a49dfe3 100644
--- a/net/base/mime_util_unittest.cc
+++ b/net/base/mime_util_unittest.cc
@@ -65,6 +65,11 @@ TEST(MimeUtilTest, LookupTypes) {
EXPECT_EQ(false, net::IsSupportedImageMimeType("image/lolcat"));
EXPECT_EQ(true, net::IsSupportedNonImageMimeType("text/html"));
EXPECT_EQ(false, net::IsSupportedNonImageMimeType("text/virus"));
+
+ EXPECT_EQ(true, net::IsSupportedMimeType("image/jpeg"));
+ EXPECT_EQ(false, net::IsSupportedMimeType("image/lolcat"));
+ EXPECT_EQ(true, net::IsSupportedMimeType("text/html"));
+ EXPECT_EQ(false, net::IsSupportedMimeType("text/virus"));
}
TEST(MimeUtilTest, MatchesMimeType) {
diff --git a/webkit/glue/mimetype_unittest.cc b/webkit/glue/mimetype_unittest.cc
index a746d96..716fc60 100644
--- a/webkit/glue/mimetype_unittest.cc
+++ b/webkit/glue/mimetype_unittest.cc
@@ -44,10 +44,14 @@ TEST_F(MimeTypeTests, MimeTypeTests) {
// These files should all be displayed as plain text.
const char* plain_text[] = {
- "text/css",
- "text/foo",
- "text/richext",
- "text/rtf",
+ // It is unclear whether to display text/css or download it.
+ // Firefox 3: Display
+ // Internet Explorer 7: Download
+ // Safari 3.2: Download
+ // We choose to match Safari.
+ // "text/css",
+ "text/javascript",
+ "text/plain",
"application/x-javascript",
};
for (size_t i = 0; i < arraysize(plain_text); ++i) {