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/basictypes.h" | 6 #include "base/basictypes.h" |
6 #include "base/logging.h" | 7 #include "base/logging.h" |
7 #include "media/base/android/media_drm_bridge.h" | 8 #include "media/base/android/media_drm_bridge.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 | 10 |
10 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 11 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
11 | 12 |
12 namespace media { | 13 namespace media { |
13 | 14 |
14 #define EXPECT_TRUE_IF_AVAILABLE(a) \ | 15 #define EXPECT_TRUE_IF_AVAILABLE(a) \ |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 | 68 |
68 TEST(MediaDrmBridgeTest, IsKeySystemSupported_Widevine) { | 69 TEST(MediaDrmBridgeTest, IsKeySystemSupported_Widevine) { |
69 EXPECT_TRUE_IF_AVAILABLE(IsKeySystemSupported(kWidevineKeySystem)); | 70 EXPECT_TRUE_IF_AVAILABLE(IsKeySystemSupported(kWidevineKeySystem)); |
70 | 71 |
71 // TODO(xhwang): Enable when b/13564917 is fixed. | 72 // TODO(xhwang): Enable when b/13564917 is fixed. |
72 // EXPECT_TRUE_IF_AVAILABLE( | 73 // EXPECT_TRUE_IF_AVAILABLE( |
73 // IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioMp4)); | 74 // IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioMp4)); |
74 EXPECT_TRUE_IF_AVAILABLE( | 75 EXPECT_TRUE_IF_AVAILABLE( |
75 IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoMp4)); | 76 IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoMp4)); |
76 | 77 |
77 EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioWebM)); | 78 if (base::android::BuildInfo::GetInstance()->sdk_int() <= 19) { |
rmcilroy
2014/08/06 17:46:08
Note, this is not absolutely correct (the 'L' rele
| |
78 EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoWebM)); | 79 EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioWebM)); |
80 EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoWebM)); | |
81 } else { | |
82 EXPECT_TRUE(IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioWebM)); | |
83 EXPECT_TRUE(IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoWebM)); | |
84 } | |
85 | |
79 EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "unknown")); | 86 EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "unknown")); |
80 EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "video/avi")); | 87 EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "video/avi")); |
81 EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "audio/mp3")); | 88 EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "audio/mp3")); |
82 } | 89 } |
83 | 90 |
84 // Invalid keysytem is NOT supported regardless whether MediaDrm is available. | 91 // Invalid keysytem is NOT supported regardless whether MediaDrm is available. |
85 TEST(MediaDrmBridgeTest, IsKeySystemSupported_InvalidKeySystem) { | 92 TEST(MediaDrmBridgeTest, IsKeySystemSupported_InvalidKeySystem) { |
86 EXPECT_FALSE(IsKeySystemSupported(kInvalidKeySystem)); | 93 EXPECT_FALSE(IsKeySystemSupported(kInvalidKeySystem)); |
87 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioMp4)); | 94 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioMp4)); |
88 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kVideoMp4)); | 95 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kVideoMp4)); |
89 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioWebM)); | 96 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kAudioWebM)); |
90 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kVideoWebM)); | 97 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, kVideoWebM)); |
91 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "unknown")); | 98 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "unknown")); |
92 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "video/avi")); | 99 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "video/avi")); |
93 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "audio/mp3")); | 100 EXPECT_FALSE(IsKeySystemSupportedWithType(kInvalidKeySystem, "audio/mp3")); |
94 } | 101 } |
95 | 102 |
96 } // namespace media | 103 } // namespace media |
OLD | NEW |