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/strings/string_split.h" | 6 #include "base/strings/string_split.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "net/base/mime_util.h" | 8 #include "net/base/mime_util.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 if (rv) | 62 if (rv) |
63 EXPECT_EQ(tests[i].mime_type, mime_type); | 63 EXPECT_EQ(tests[i].mime_type, mime_type); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 TEST(MimeUtilTest, LookupTypes) { | 67 TEST(MimeUtilTest, LookupTypes) { |
68 EXPECT_FALSE(IsUnsupportedTextMimeType("text/banana")); | 68 EXPECT_FALSE(IsUnsupportedTextMimeType("text/banana")); |
69 EXPECT_TRUE(IsUnsupportedTextMimeType("text/vcard")); | 69 EXPECT_TRUE(IsUnsupportedTextMimeType("text/vcard")); |
70 | 70 |
71 EXPECT_TRUE(IsSupportedImageMimeType("image/jpeg")); | 71 EXPECT_TRUE(IsSupportedImageMimeType("image/jpeg")); |
| 72 EXPECT_FALSE(IsSupportedImageMimeType("image/svg+xml")); |
| 73 EXPECT_TRUE(IsSupportedImagePrefixedMimeType("image/svg+xml")); |
72 EXPECT_FALSE(IsSupportedImageMimeType("image/lolcat")); | 74 EXPECT_FALSE(IsSupportedImageMimeType("image/lolcat")); |
73 EXPECT_TRUE(IsSupportedNonImageMimeType("text/html")); | 75 EXPECT_TRUE(IsSupportedNonImageMimeType("text/html")); |
74 EXPECT_TRUE(IsSupportedNonImageMimeType("text/css")); | 76 EXPECT_TRUE(IsSupportedNonImageMimeType("text/css")); |
75 EXPECT_TRUE(IsSupportedNonImageMimeType("text/")); | 77 EXPECT_TRUE(IsSupportedNonImageMimeType("text/")); |
76 EXPECT_TRUE(IsSupportedNonImageMimeType("text/banana")); | 78 EXPECT_TRUE(IsSupportedNonImageMimeType("text/banana")); |
77 EXPECT_FALSE(IsSupportedNonImageMimeType("text/vcard")); | 79 EXPECT_FALSE(IsSupportedNonImageMimeType("text/vcard")); |
78 EXPECT_FALSE(IsSupportedNonImageMimeType("application/virus")); | 80 EXPECT_FALSE(IsSupportedNonImageMimeType("application/virus")); |
79 EXPECT_TRUE(IsSupportedNonImageMimeType("application/x-x509-user-cert")); | 81 EXPECT_TRUE(IsSupportedNonImageMimeType("application/x-x509-user-cert")); |
80 EXPECT_TRUE(IsSupportedNonImageMimeType("application/json")); | 82 EXPECT_TRUE(IsSupportedNonImageMimeType("application/json")); |
81 EXPECT_TRUE(IsSupportedNonImageMimeType("application/+json")); | 83 EXPECT_TRUE(IsSupportedNonImageMimeType("application/+json")); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 std::string post_data; | 446 std::string post_data; |
445 AddMultipartValueForUpload("value name", "value", "boundary", | 447 AddMultipartValueForUpload("value name", "value", "boundary", |
446 "content type", &post_data); | 448 "content type", &post_data); |
447 AddMultipartValueForUpload("value name", "value", "boundary", | 449 AddMultipartValueForUpload("value name", "value", "boundary", |
448 "", &post_data); | 450 "", &post_data); |
449 AddMultipartFinalDelimiterForUpload("boundary", &post_data); | 451 AddMultipartFinalDelimiterForUpload("boundary", &post_data); |
450 EXPECT_STREQ(ref_output, post_data.c_str()); | 452 EXPECT_STREQ(ref_output, post_data.c_str()); |
451 } | 453 } |
452 | 454 |
453 } // namespace net | 455 } // namespace net |
OLD | NEW |