| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "net/base/mime_util.h" | 7 #include "net/base/mime_util.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 EXPECT_TRUE(IsSupportedMimeType("image/jpeg")); | 73 EXPECT_TRUE(IsSupportedMimeType("image/jpeg")); |
| 74 EXPECT_FALSE(IsSupportedMimeType("image/lolcat")); | 74 EXPECT_FALSE(IsSupportedMimeType("image/lolcat")); |
| 75 EXPECT_TRUE(IsSupportedMimeType("text/html")); | 75 EXPECT_TRUE(IsSupportedMimeType("text/html")); |
| 76 EXPECT_TRUE(IsSupportedMimeType("text/banana")); | 76 EXPECT_TRUE(IsSupportedMimeType("text/banana")); |
| 77 EXPECT_FALSE(IsSupportedMimeType("text/vcard")); | 77 EXPECT_FALSE(IsSupportedMimeType("text/vcard")); |
| 78 EXPECT_FALSE(IsSupportedMimeType("application/virus")); | 78 EXPECT_FALSE(IsSupportedMimeType("application/virus")); |
| 79 } | 79 } |
| 80 | 80 |
| 81 TEST(MimeUtilTest, MatchesMimeType) { | 81 TEST(MimeUtilTest, MatchesMimeType) { |
| 82 EXPECT_TRUE(MatchesMimeType("*", "video/x-mpeg")); | 82 EXPECT_TRUE(MatchesMimeType("*", "video/x-mpeg")); |
| 83 EXPECT_TRUE(MatchesMimeType("*", "")); |
| 83 EXPECT_TRUE(MatchesMimeType("video/*", "video/x-mpeg")); | 84 EXPECT_TRUE(MatchesMimeType("video/*", "video/x-mpeg")); |
| 84 EXPECT_TRUE(MatchesMimeType("video/x-mpeg", "video/x-mpeg")); | 85 EXPECT_TRUE(MatchesMimeType("video/x-mpeg", "video/x-mpeg")); |
| 85 EXPECT_TRUE(MatchesMimeType("application/*+xml", | 86 EXPECT_TRUE(MatchesMimeType("application/*+xml", |
| 86 "application/html+xml")); | 87 "application/html+xml")); |
| 87 EXPECT_TRUE(MatchesMimeType("application/*+xml", "application/+xml")); | 88 EXPECT_TRUE(MatchesMimeType("application/*+xml", "application/+xml")); |
| 88 EXPECT_TRUE(MatchesMimeType("aaa*aaa", "aaaaaa")); | 89 EXPECT_TRUE(MatchesMimeType("aaa*aaa", "aaaaaa")); |
| 89 EXPECT_FALSE(MatchesMimeType("video/", "video/x-mpeg")); | 90 EXPECT_FALSE(MatchesMimeType("video/", "video/x-mpeg")); |
| 90 EXPECT_FALSE(MatchesMimeType("", "video/x-mpeg")); | 91 EXPECT_FALSE(MatchesMimeType("", "video/x-mpeg")); |
| 91 EXPECT_FALSE(MatchesMimeType("", "")); | 92 EXPECT_FALSE(MatchesMimeType("", "")); |
| 92 EXPECT_FALSE(MatchesMimeType("video/x-mpeg", "")); | 93 EXPECT_FALSE(MatchesMimeType("video/x-mpeg", "")); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 EXPECT_EQ("example", GetIANAMediaType("example/yomomma")); | 180 EXPECT_EQ("example", GetIANAMediaType("example/yomomma")); |
| 180 EXPECT_EQ("image", GetIANAMediaType("image/png")); | 181 EXPECT_EQ("image", GetIANAMediaType("image/png")); |
| 181 EXPECT_EQ("message", GetIANAMediaType("message/sipfrag")); | 182 EXPECT_EQ("message", GetIANAMediaType("message/sipfrag")); |
| 182 EXPECT_EQ("model", GetIANAMediaType("model/vrml")); | 183 EXPECT_EQ("model", GetIANAMediaType("model/vrml")); |
| 183 EXPECT_EQ("multipart", GetIANAMediaType("multipart/mixed")); | 184 EXPECT_EQ("multipart", GetIANAMediaType("multipart/mixed")); |
| 184 EXPECT_EQ("text", GetIANAMediaType("text/plain")); | 185 EXPECT_EQ("text", GetIANAMediaType("text/plain")); |
| 185 EXPECT_EQ("video", GetIANAMediaType("video/H261")); | 186 EXPECT_EQ("video", GetIANAMediaType("video/H261")); |
| 186 } | 187 } |
| 187 | 188 |
| 188 } // namespace net | 189 } // namespace net |
| OLD | NEW |