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

Side by Side Diff: media/base/mime_util_unittest.cc

Issue 1128983002: Cleanup unit tests for HLS mime types on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new-move-media-mime
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "media/base/mime_util.h" 7 #include "media/base/mime_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 #if defined(OS_ANDROID)
11 #include "base/android/build_info.h"
12 #endif
13
14 namespace media { 10 namespace media {
15 11
16 TEST(MimeUtilTest, LookupTypes) {
17 #if defined(OS_ANDROID)
18 EXPECT_TRUE(IsSupportedMediaMimeType("application/vnd.apple.mpegurl"));
19 EXPECT_TRUE(IsSupportedMediaMimeType("application/x-mpegurl"));
20 EXPECT_TRUE(IsSupportedMediaMimeType("Application/X-MPEGURL"));
21 #endif
22 }
23
24 TEST(MimeUtilTest, StrictMediaMimeType) { 12 TEST(MimeUtilTest, StrictMediaMimeType) {
25 EXPECT_TRUE(IsStrictMediaMimeType("video/webm")); 13 EXPECT_TRUE(IsStrictMediaMimeType("video/webm"));
26 EXPECT_TRUE(IsStrictMediaMimeType("Video/WEBM")); 14 EXPECT_TRUE(IsStrictMediaMimeType("Video/WEBM"));
27 EXPECT_TRUE(IsStrictMediaMimeType("audio/webm")); 15 EXPECT_TRUE(IsStrictMediaMimeType("audio/webm"));
28 16
29 EXPECT_TRUE(IsStrictMediaMimeType("audio/wav")); 17 EXPECT_TRUE(IsStrictMediaMimeType("audio/wav"));
30 EXPECT_TRUE(IsStrictMediaMimeType("audio/x-wav")); 18 EXPECT_TRUE(IsStrictMediaMimeType("audio/x-wav"));
31 19
32 EXPECT_TRUE(IsStrictMediaMimeType("video/ogg")); 20 EXPECT_TRUE(IsStrictMediaMimeType("video/ogg"));
33 EXPECT_TRUE(IsStrictMediaMimeType("audio/ogg")); 21 EXPECT_TRUE(IsStrictMediaMimeType("audio/ogg"));
(...skipping 12 matching lines...) Expand all
46 EXPECT_TRUE(IsStrictMediaMimeType("application/vnd.apple.mpegurl")); 34 EXPECT_TRUE(IsStrictMediaMimeType("application/vnd.apple.mpegurl"));
47 35
48 EXPECT_FALSE(IsStrictMediaMimeType("video/unknown")); 36 EXPECT_FALSE(IsStrictMediaMimeType("video/unknown"));
49 EXPECT_FALSE(IsStrictMediaMimeType("Video/UNKNOWN")); 37 EXPECT_FALSE(IsStrictMediaMimeType("Video/UNKNOWN"));
50 EXPECT_FALSE(IsStrictMediaMimeType("audio/unknown")); 38 EXPECT_FALSE(IsStrictMediaMimeType("audio/unknown"));
51 EXPECT_FALSE(IsStrictMediaMimeType("application/unknown")); 39 EXPECT_FALSE(IsStrictMediaMimeType("application/unknown"));
52 EXPECT_FALSE(IsStrictMediaMimeType("unknown/unknown")); 40 EXPECT_FALSE(IsStrictMediaMimeType("unknown/unknown"));
53 } 41 }
54 42
55 TEST(MimeUtilTest, CommonMediaMimeType) { 43 TEST(MimeUtilTest, CommonMediaMimeType) {
56 #if defined(OS_ANDROID)
57 bool HLSSupported;
58 if (base::android::BuildInfo::GetInstance()->sdk_int() < 14)
59 HLSSupported = false;
60 else
61 HLSSupported = true;
62 #endif
63
64 EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm")); 44 EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm"));
65 EXPECT_TRUE(IsSupportedMediaMimeType("video/webm")); 45 EXPECT_TRUE(IsSupportedMediaMimeType("video/webm"));
66 46
67 EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav")); 47 EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav"));
68 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav")); 48 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav"));
69 49
70 EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg")); 50 EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg"));
71 EXPECT_TRUE(IsSupportedMediaMimeType("application/ogg")); 51 EXPECT_TRUE(IsSupportedMediaMimeType("application/ogg"));
72 #if defined(OS_ANDROID) 52 #if defined(OS_ANDROID)
73 EXPECT_FALSE(IsSupportedMediaMimeType("video/ogg")); 53 EXPECT_FALSE(IsSupportedMediaMimeType("video/ogg"));
74 EXPECT_EQ(HLSSupported, IsSupportedMediaMimeType("application/x-mpegurl")); 54
75 EXPECT_EQ(HLSSupported, 55 // HLS is supported on Android API level 14 and higher and Chrome supports
76 IsSupportedMediaMimeType("application/vnd.apple.mpegurl")); 56 // API levels 15 and higher, so these are expected to be supported.
57 EXPECT_TRUE(IsSupportedMediaMimeType("application/x-mpegurl"));
ddorwin 2015/05/06 20:00:20 alternatively, you could do this: bool kHlsSuppo
servolk 2015/05/06 20:32:22 Wait, but that would be the same code as before? I
Ryan Sleevi 2015/05/06 21:40:02 No it wouldn't bool hls_supported = false; #if de
58 EXPECT_TRUE(IsSupportedMediaMimeType("Application/X-MPEGURL"));
59 EXPECT_TRUE(IsSupportedMediaMimeType("application/vnd.apple.mpegurl"));
77 #else 60 #else
78 EXPECT_TRUE(IsSupportedMediaMimeType("video/ogg")); 61 EXPECT_TRUE(IsSupportedMediaMimeType("video/ogg"));
79 EXPECT_FALSE(IsSupportedMediaMimeType("application/x-mpegurl")); 62 EXPECT_FALSE(IsSupportedMediaMimeType("application/x-mpegurl"));
80 EXPECT_FALSE(IsSupportedMediaMimeType("application/vnd.apple.mpegurl")); 63 EXPECT_FALSE(IsSupportedMediaMimeType("application/vnd.apple.mpegurl"));
81 #endif // OS_ANDROID 64 #endif // OS_ANDROID
82 65
83 #if defined(USE_PROPRIETARY_CODECS) 66 #if defined(USE_PROPRIETARY_CODECS)
84 EXPECT_TRUE(IsSupportedMediaMimeType("audio/mp4")); 67 EXPECT_TRUE(IsSupportedMediaMimeType("audio/mp4"));
85 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-m4a")); 68 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-m4a"));
86 EXPECT_TRUE(IsSupportedMediaMimeType("video/mp4")); 69 EXPECT_TRUE(IsSupportedMediaMimeType("video/mp4"));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 127
145 // Test without stripping the codec type. 128 // Test without stripping the codec type.
146 std::vector<std::string> codecs_out; 129 std::vector<std::string> codecs_out;
147 ParseCodecString("avc1.42E01E, mp4a.40.2", &codecs_out, false); 130 ParseCodecString("avc1.42E01E, mp4a.40.2", &codecs_out, false);
148 ASSERT_EQ(2u, codecs_out.size()); 131 ASSERT_EQ(2u, codecs_out.size());
149 EXPECT_EQ("avc1.42E01E", codecs_out[0]); 132 EXPECT_EQ("avc1.42E01E", codecs_out[0]);
150 EXPECT_EQ("mp4a.40.2", codecs_out[1]); 133 EXPECT_EQ("mp4a.40.2", codecs_out[1]);
151 } 134 }
152 135
153 } // namespace media 136 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698