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

Unified Diff: net/base/mime_util_unittest.cc

Issue 230413003: Adding platform specific checks for VP9 codecs and HLS mime types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding comments Created 6 years, 8 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
« no previous file with comments | « 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 c0d7e801257ce42c53626021c3314f7db22b1a2f..61719889034a7ea3c7610f836063b082d23c16e7 100644
--- a/net/base/mime_util_unittest.cc
+++ b/net/base/mime_util_unittest.cc
@@ -8,6 +8,10 @@
#include "net/base/mime_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(OS_ANDROID)
+#include "base/android/build_info.h"
+#endif
+
namespace net {
TEST(MimeUtilTest, ExtensionTest) {
@@ -189,6 +193,60 @@ TEST(MimeUtilTest, MatchesMimeType) {
EXPECT_TRUE(MatchesMimeType("ab/*cd", "ab/xxxcd"));
}
+TEST(MimeUtilTest, CommonMediaMimeType) {
+#if defined(OS_ANDROID)
+ bool HLSSupported;
+ if (base::android::BuildInfo::GetInstance()->sdk_int() < 14)
+ HLSSupported = false;
+ else
+ HLSSupported = true;
+#endif
+
+ EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm"));
+ EXPECT_TRUE(IsSupportedMediaMimeType("video/webm"));
+
+ EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav"));
+ EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav"));
+
+ EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg"));
+ EXPECT_TRUE(IsSupportedMediaMimeType("application/ogg"));
+#if defined(OS_ANDROID)
+ EXPECT_FALSE(IsSupportedMediaMimeType("video/ogg"));
+ EXPECT_EQ(HLSSupported, IsSupportedMediaMimeType("application/x-mpegurl"));
+ EXPECT_EQ(HLSSupported,
+ IsSupportedMediaMimeType("application/vnd.apple.mpegurl"));
+#else
+ EXPECT_TRUE(IsSupportedMediaMimeType("video/ogg"));
+ EXPECT_FALSE(IsSupportedMediaMimeType("application/x-mpegurl"));
+ EXPECT_FALSE(IsSupportedMediaMimeType("application/vnd.apple.mpegurl"));
+#endif // OS_ANDROID
+
+#if defined(USE_PROPRIETARY_CODECS)
+ EXPECT_TRUE(IsSupportedMediaMimeType("audio/mp4"));
+ EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-m4a"));
+ EXPECT_TRUE(IsSupportedMediaMimeType("video/mp4"));
+ EXPECT_TRUE(IsSupportedMediaMimeType("video/x-m4v"));
+
+ EXPECT_TRUE(IsSupportedMediaMimeType("audio/mp3"));
+ EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-mp3"));
+ EXPECT_TRUE(IsSupportedMediaMimeType("audio/mpeg"));
+#else
+ EXPECT_FALSE(IsSupportedMediaMimeType("audio/mp4"));
+ EXPECT_FALSE(IsSupportedMediaMimeType("audio/x-m4a"));
+ EXPECT_FALSE(IsSupportedMediaMimeType("video/mp4"));
+ EXPECT_FALSE(IsSupportedMediaMimeType("video/x-m4v"));
+
+ EXPECT_FALSE(IsSupportedMediaMimeType("audio/mp3"));
+ EXPECT_FALSE(IsSupportedMediaMimeType("audio/x-mp3"));
+ EXPECT_FALSE(IsSupportedMediaMimeType("audio/mpeg"));
+#endif // USE_PROPRIETARY_CODECS
+ EXPECT_FALSE(IsSupportedMediaMimeType("video/mp3"));
+
+ EXPECT_FALSE(IsSupportedMediaMimeType("video/unknown"));
+ EXPECT_FALSE(IsSupportedMediaMimeType("audio/unknown"));
+ EXPECT_FALSE(IsSupportedMediaMimeType("unknown/unknown"));
+}
+
// Note: codecs should only be a list of 2 or fewer; hence the restriction of
// results' length to 2.
TEST(MimeUtilTest, ParseCodecString) {
« no previous file with comments | « net/base/mime_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698