Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: net/base/mime_util_unittest.cc

Issue 18086: We should download text/csv mime types instead of displaying them.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/mime_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "net/base/mime_util.h" 6 #include "net/base/mime_util.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace { 9 namespace {
10 class MimeUtilTest : public testing::Test { 10 class MimeUtilTest : public testing::Test {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (rv) 58 if (rv)
59 EXPECT_EQ(mime_type, tests[i].mime_type); 59 EXPECT_EQ(mime_type, tests[i].mime_type);
60 } 60 }
61 } 61 }
62 62
63 TEST(MimeUtilTest, LookupTypes) { 63 TEST(MimeUtilTest, LookupTypes) {
64 EXPECT_EQ(true, net::IsSupportedImageMimeType("image/jpeg")); 64 EXPECT_EQ(true, net::IsSupportedImageMimeType("image/jpeg"));
65 EXPECT_EQ(false, net::IsSupportedImageMimeType("image/lolcat")); 65 EXPECT_EQ(false, net::IsSupportedImageMimeType("image/lolcat"));
66 EXPECT_EQ(true, net::IsSupportedNonImageMimeType("text/html")); 66 EXPECT_EQ(true, net::IsSupportedNonImageMimeType("text/html"));
67 EXPECT_EQ(false, net::IsSupportedNonImageMimeType("text/virus")); 67 EXPECT_EQ(false, net::IsSupportedNonImageMimeType("text/virus"));
68
69 EXPECT_EQ(true, net::IsSupportedMimeType("image/jpeg"));
70 EXPECT_EQ(false, net::IsSupportedMimeType("image/lolcat"));
71 EXPECT_EQ(true, net::IsSupportedMimeType("text/html"));
72 EXPECT_EQ(false, net::IsSupportedMimeType("text/virus"));
68 } 73 }
69 74
70 TEST(MimeUtilTest, MatchesMimeType) { 75 TEST(MimeUtilTest, MatchesMimeType) {
71 EXPECT_EQ(true, net::MatchesMimeType("*", "video/x-mpeg")); 76 EXPECT_EQ(true, net::MatchesMimeType("*", "video/x-mpeg"));
72 EXPECT_EQ(true, net::MatchesMimeType("video/*", "video/x-mpeg")); 77 EXPECT_EQ(true, net::MatchesMimeType("video/*", "video/x-mpeg"));
73 EXPECT_EQ(true, net::MatchesMimeType("video/x-mpeg", "video/x-mpeg")); 78 EXPECT_EQ(true, net::MatchesMimeType("video/x-mpeg", "video/x-mpeg"));
74 EXPECT_EQ(true, net::MatchesMimeType("application/*+xml", 79 EXPECT_EQ(true, net::MatchesMimeType("application/*+xml",
75 "application/html+xml")); 80 "application/html+xml"));
76 EXPECT_EQ(true, net::MatchesMimeType("application/*+xml", 81 EXPECT_EQ(true, net::MatchesMimeType("application/*+xml",
77 "application/+xml")); 82 "application/+xml"));
78 EXPECT_EQ(true, net::MatchesMimeType("aaa*aaa", 83 EXPECT_EQ(true, net::MatchesMimeType("aaa*aaa",
79 "aaaaaa")); 84 "aaaaaa"));
80 EXPECT_EQ(false, net::MatchesMimeType("video/", "video/x-mpeg")); 85 EXPECT_EQ(false, net::MatchesMimeType("video/", "video/x-mpeg"));
81 EXPECT_EQ(false, net::MatchesMimeType("", "video/x-mpeg")); 86 EXPECT_EQ(false, net::MatchesMimeType("", "video/x-mpeg"));
82 EXPECT_EQ(false, net::MatchesMimeType("", "")); 87 EXPECT_EQ(false, net::MatchesMimeType("", ""));
83 EXPECT_EQ(false, net::MatchesMimeType("video/x-mpeg", "")); 88 EXPECT_EQ(false, net::MatchesMimeType("video/x-mpeg", ""));
84 EXPECT_EQ(false, net::MatchesMimeType("application/*+xml", 89 EXPECT_EQ(false, net::MatchesMimeType("application/*+xml",
85 "application/xml")); 90 "application/xml"));
86 EXPECT_EQ(false, net::MatchesMimeType("application/*+xml", 91 EXPECT_EQ(false, net::MatchesMimeType("application/*+xml",
87 "application/html+xmlz")); 92 "application/html+xmlz"));
88 EXPECT_EQ(false, net::MatchesMimeType("application/*+xml", 93 EXPECT_EQ(false, net::MatchesMimeType("application/*+xml",
89 "applcation/html+xml")); 94 "applcation/html+xml"));
90 EXPECT_EQ(false, net::MatchesMimeType("aaa*aaa", 95 EXPECT_EQ(false, net::MatchesMimeType("aaa*aaa",
91 "aaaaa")); 96 "aaaaa"));
92 } 97 }
93 98
OLDNEW
« no previous file with comments | « net/base/mime_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698