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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 EXPECT_TRUE(IsStrictMediaMimeType("audio/x-wav")); | 106 EXPECT_TRUE(IsStrictMediaMimeType("audio/x-wav")); |
107 | 107 |
108 EXPECT_TRUE(IsStrictMediaMimeType("video/ogg")); | 108 EXPECT_TRUE(IsStrictMediaMimeType("video/ogg")); |
109 EXPECT_TRUE(IsStrictMediaMimeType("audio/ogg")); | 109 EXPECT_TRUE(IsStrictMediaMimeType("audio/ogg")); |
110 EXPECT_TRUE(IsStrictMediaMimeType("application/ogg")); | 110 EXPECT_TRUE(IsStrictMediaMimeType("application/ogg")); |
111 | 111 |
112 EXPECT_TRUE(IsStrictMediaMimeType("audio/mpeg")); | 112 EXPECT_TRUE(IsStrictMediaMimeType("audio/mpeg")); |
113 EXPECT_TRUE(IsStrictMediaMimeType("audio/mp3")); | 113 EXPECT_TRUE(IsStrictMediaMimeType("audio/mp3")); |
114 EXPECT_TRUE(IsStrictMediaMimeType("audio/x-mp3")); | 114 EXPECT_TRUE(IsStrictMediaMimeType("audio/x-mp3")); |
115 | 115 |
116 // TODO(amogh.bihani): These will be fixed http://crbug.com/53193 | 116 EXPECT_TRUE(IsStrictMediaMimeType("video/mp4")); |
117 EXPECT_FALSE(IsStrictMediaMimeType("video/mp4")); | 117 EXPECT_TRUE(IsStrictMediaMimeType("video/x-m4v")); |
118 EXPECT_FALSE(IsStrictMediaMimeType("video/x-m4v")); | 118 EXPECT_TRUE(IsStrictMediaMimeType("audio/mp4")); |
119 EXPECT_FALSE(IsStrictMediaMimeType("audio/mp4")); | 119 EXPECT_TRUE(IsStrictMediaMimeType("audio/x-m4a")); |
120 EXPECT_FALSE(IsStrictMediaMimeType("audio/x-m4a")); | |
121 | 120 |
122 EXPECT_FALSE(IsStrictMediaMimeType("application/x-mpegurl")); | 121 EXPECT_TRUE(IsStrictMediaMimeType("application/x-mpegurl")); |
123 EXPECT_FALSE(IsStrictMediaMimeType("application/vnd.apple.mpegurl")); | 122 EXPECT_TRUE(IsStrictMediaMimeType("application/vnd.apple.mpegurl")); |
124 // --------------------------------------------------------------------------- | |
125 | 123 |
126 EXPECT_FALSE(IsStrictMediaMimeType("video/unknown")); | 124 EXPECT_FALSE(IsStrictMediaMimeType("video/unknown")); |
127 EXPECT_FALSE(IsStrictMediaMimeType("audio/unknown")); | 125 EXPECT_FALSE(IsStrictMediaMimeType("audio/unknown")); |
128 EXPECT_FALSE(IsStrictMediaMimeType("application/unknown")); | 126 EXPECT_FALSE(IsStrictMediaMimeType("application/unknown")); |
129 EXPECT_FALSE(IsStrictMediaMimeType("unknown/unknown")); | 127 EXPECT_FALSE(IsStrictMediaMimeType("unknown/unknown")); |
130 } | 128 } |
131 | 129 |
132 TEST(MimeUtilTest, MatchesMimeType) { | 130 TEST(MimeUtilTest, MatchesMimeType) { |
133 EXPECT_TRUE(MatchesMimeType("*", "video/x-mpeg")); | 131 EXPECT_TRUE(MatchesMimeType("*", "video/x-mpeg")); |
134 EXPECT_TRUE(MatchesMimeType("video/*", "video/x-mpeg")); | 132 EXPECT_TRUE(MatchesMimeType("video/*", "video/x-mpeg")); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 std::string post_data; | 444 std::string post_data; |
447 AddMultipartValueForUpload("value name", "value", "boundary", | 445 AddMultipartValueForUpload("value name", "value", "boundary", |
448 "content type", &post_data); | 446 "content type", &post_data); |
449 AddMultipartValueForUpload("value name", "value", "boundary", | 447 AddMultipartValueForUpload("value name", "value", "boundary", |
450 "", &post_data); | 448 "", &post_data); |
451 AddMultipartFinalDelimiterForUpload("boundary", &post_data); | 449 AddMultipartFinalDelimiterForUpload("boundary", &post_data); |
452 EXPECT_STREQ(ref_output, post_data.c_str()); | 450 EXPECT_STREQ(ref_output, post_data.c_str()); |
453 } | 451 } |
454 | 452 |
455 } // namespace net | 453 } // namespace net |
OLD | NEW |