| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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("video/*", "video/x-mpeg")); | 83 EXPECT_TRUE(MatchesMimeType("video/*", "video/x-mpeg")); |
| 84 EXPECT_TRUE(MatchesMimeType("video/*", "video/*")); |
| 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_TRUE(MatchesMimeType("*", "")); | 90 EXPECT_TRUE(MatchesMimeType("*", "")); |
| 90 EXPECT_FALSE(MatchesMimeType("video/", "video/x-mpeg")); | 91 EXPECT_FALSE(MatchesMimeType("video/", "video/x-mpeg")); |
| 91 EXPECT_FALSE(MatchesMimeType("", "video/x-mpeg")); | 92 EXPECT_FALSE(MatchesMimeType("", "video/x-mpeg")); |
| 92 EXPECT_FALSE(MatchesMimeType("", "")); | 93 EXPECT_FALSE(MatchesMimeType("", "")); |
| 93 EXPECT_FALSE(MatchesMimeType("video/x-mpeg", "")); | 94 EXPECT_FALSE(MatchesMimeType("video/x-mpeg", "")); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 if (extensions[j] == tests[i].contained_result) | 220 if (extensions[j] == tests[i].contained_result) |
| 220 found = true; | 221 found = true; |
| 221 #endif | 222 #endif |
| 222 } | 223 } |
| 223 ASSERT_TRUE(found) << "Must find at least the contained result within " | 224 ASSERT_TRUE(found) << "Must find at least the contained result within " |
| 224 << tests[i].mime_type; | 225 << tests[i].mime_type; |
| 225 } | 226 } |
| 226 } | 227 } |
| 227 | 228 |
| 228 } // namespace net | 229 } // namespace net |
| OLD | NEW |