OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/android/build_info.h" | 5 #include "base/android/build_info.h" |
6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/android/media_drm_bridge.h" | 8 #include "media/base/android/media_drm_bridge.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... | |
38 return MediaDrmBridge::IsKeySystemSupported(key_system); | 38 return MediaDrmBridge::IsKeySystemSupported(key_system); |
39 } | 39 } |
40 | 40 |
41 static bool IsKeySystemSupportedWithType( | 41 static bool IsKeySystemSupportedWithType( |
42 const std::string& key_system, | 42 const std::string& key_system, |
43 const std::string& container_mime_type) { | 43 const std::string& container_mime_type) { |
44 return MediaDrmBridge::IsKeySystemSupportedWithType(key_system, | 44 return MediaDrmBridge::IsKeySystemSupportedWithType(key_system, |
45 container_mime_type); | 45 container_mime_type); |
46 } | 46 } |
47 | 47 |
48 static bool IsSecurityLevelSupported( | |
49 const std::string& key_system, | |
50 MediaDrmBridge::SecurityLevel security_level) { | |
51 return MediaDrmBridge::IsSecurityLevelSupported(key_system, security_level); | |
ddorwin
2015/02/18 02:19:26
This is the only place this function is used. Does
qinmin
2015/02/18 06:45:40
i am ok to remove these tests. The function is use
ddorwin
2015/02/18 18:11:50
They were also covering setting security levels fo
| |
52 } | |
53 | |
54 TEST(MediaDrmBridgeTest, IsSecurityLevelSupported_Widevine) { | |
55 EXPECT_FALSE(IsSecurityLevelSupported(kWidevineKeySystem, kLNone)); | |
56 // We test "L3" fully. But for "L1" we don't check the result as it depends on | |
57 // whether the test device supports "L1". | |
58 EXPECT_TRUE_IF_AVAILABLE(IsSecurityLevelSupported(kWidevineKeySystem, kL3)); | |
59 IsSecurityLevelSupported(kWidevineKeySystem, kL1); | |
60 } | |
61 | |
62 // Invalid keysytem is NOT supported regardless whether MediaDrm is available. | |
63 TEST(MediaDrmBridgeTest, IsSecurityLevelSupported_InvalidKeySystem) { | |
64 EXPECT_FALSE(IsSecurityLevelSupported(kInvalidKeySystem, kLNone)); | |
65 EXPECT_FALSE(IsSecurityLevelSupported(kInvalidKeySystem, kL1)); | |
66 EXPECT_FALSE(IsSecurityLevelSupported(kInvalidKeySystem, kL3)); | |
67 } | |
68 | |
69 TEST(MediaDrmBridgeTest, IsKeySystemSupported_Widevine) { | 48 TEST(MediaDrmBridgeTest, IsKeySystemSupported_Widevine) { |
70 EXPECT_TRUE_IF_AVAILABLE(IsKeySystemSupported(kWidevineKeySystem)); | 49 EXPECT_TRUE_IF_AVAILABLE(IsKeySystemSupported(kWidevineKeySystem)); |
71 | 50 |
72 // TODO(xhwang): Enable when b/13564917 is fixed. | 51 // TODO(xhwang): Enable when b/13564917 is fixed. |
73 // EXPECT_TRUE_IF_AVAILABLE( | 52 // EXPECT_TRUE_IF_AVAILABLE( |
74 // IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioMp4)); | 53 // IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioMp4)); |
75 EXPECT_TRUE_IF_AVAILABLE( | 54 EXPECT_TRUE_IF_AVAILABLE( |
76 IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoMp4)); | 55 IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoMp4)); |
77 | 56 |
78 if (base::android::BuildInfo::GetInstance()->sdk_int() <= 19) { | 57 if (base::android::BuildInfo::GetInstance()->sdk_int() <= 19) { |
(...skipping 15 matching lines...) Expand all Loading... | |
94 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioMp4)); | 73 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioMp4)); |
95 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kVideoMp4)); | 74 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kVideoMp4)); |
96 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioWebM)); | 75 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioWebM)); |
97 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kVideoWebM)); | 76 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kVideoWebM)); |
98 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "unknown")); | 77 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "unknown")); |
99 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "video/avi")); | 78 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "video/avi")); |
100 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "audio/mp3")); | 79 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "audio/mp3")); |
101 } | 80 } |
102 | 81 |
103 } // namespace media | 82 } // namespace media |
OLD | NEW |