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

Unified Diff: net/base/mime_util_unittest.cc

Issue 218303002: Fix: canPlayType() gives false positive for */ogg and audio/x-wav (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« net/base/mime_util.cc ('K') | « net/base/mime_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/mime_util_unittest.cc
diff --git a/net/base/mime_util_unittest.cc b/net/base/mime_util_unittest.cc
index 3bb49956431f087083b85d5d179bd6d12da6d01e..a4ab2ea8689bfdf429999b5aa29380d42411f035 100644
--- a/net/base/mime_util_unittest.cc
+++ b/net/base/mime_util_unittest.cc
@@ -8,6 +8,12 @@
#include "net/base/mime_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(OS_ANDROID)
+#define EXPECT_TRUE_NON_ANDROID EXPECT_FALSE
scherkus (not reviewing) 2014/04/02 16:26:46 considering this is only used in one place I don't
amogh.bihani 2014/04/03 03:57:13 Done.
+#else
+#define EXPECT_TRUE_NON_ANDROID EXPECT_TRUE
+#endif // OS_ANDROID
+
namespace net {
TEST(MimeUtilTest, ExtensionTest) {
@@ -94,6 +100,38 @@ TEST(MimeUtilTest, LookupTypes) {
EXPECT_FALSE(IsSupportedNonImageMimeType("application/vnd.doc;x=y+json"));
}
+TEST(MimeUtilTest, StrictMediaMimeType) {
+ EXPECT_TRUE(IsStrictMediaMimeType("video/webm"));
+ EXPECT_TRUE(IsStrictMediaMimeType("audio/webm"));
+
+ EXPECT_TRUE(IsStrictMediaMimeType("audio/wav"));
+ EXPECT_TRUE(IsStrictMediaMimeType("audio/x-wav"));
+
+ EXPECT_TRUE_NON_ANDROID(IsStrictMediaMimeType("video/ogg"));
+ EXPECT_TRUE(IsStrictMediaMimeType("audio/ogg"));
+ EXPECT_TRUE(IsStrictMediaMimeType("application/ogg"));
+
+ // TODO(amogh.bihani): Fix these test when bug 53193 is fixed.
+ // http://crbug.com/53193 ----------------------------------------------------
+ EXPECT_FALSE(IsStrictMediaMimeType("audio/mpeg"));
+ EXPECT_FALSE(IsStrictMediaMimeType("audio/mp3"));
+ EXPECT_FALSE(IsStrictMediaMimeType("audio/x-mp3"));
+
+ EXPECT_FALSE(IsStrictMediaMimeType("video/mp4"));
+ EXPECT_FALSE(IsStrictMediaMimeType("video/x-mp4v"));
+ EXPECT_FALSE(IsStrictMediaMimeType("audio/mp4"));
+ EXPECT_FALSE(IsStrictMediaMimeType("audio/x-mp4a"));
+
+ EXPECT_FALSE(IsStrictMediaMimeType("application/x-mpegurl"));
+ EXPECT_FALSE(IsStrictMediaMimeType("application/vnd.apple.mpegurl"));
+ // ---------------------------------------------------------------------------
+
+ EXPECT_FALSE(IsStrictMediaMimeType("video/unknown"));
+ EXPECT_FALSE(IsStrictMediaMimeType("audio/unknown"));
+ EXPECT_FALSE(IsStrictMediaMimeType("application/unknown"));
+ EXPECT_FALSE(IsStrictMediaMimeType("unknown/unknown"));
+}
+
TEST(MimeUtilTest, MatchesMimeType) {
EXPECT_TRUE(MatchesMimeType("*", "video/x-mpeg"));
EXPECT_TRUE(MatchesMimeType("video/*", "video/x-mpeg"));
« net/base/mime_util.cc ('K') | « net/base/mime_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698