Files
android/libwvdrmengine/test/unit/legacy_src/WVDrmFactory_test.cpp
Jiyong Park 853773dd93 Build widevine tests with BOARD_VNDK_VERSION set
The tests are using vendor only libs such as libcdm and libwvlevel3,
thus marked as LOCAL_PROPRIETARY_MODULE to use the libs. In addition,
the dependency to libmedia is changed to libmedia_omx since libmedia is
not available to vendor modules. UniquePtr is replaced with
std::unique_ptr since UniquePtr.h in /libnativehelper is not available
to vendors (and will not be completely removed in a near future).

Bug: 37342627
Test: BOARD_VNDK_VERSION=current m -j tests

Change-Id: I4e9d3267b20c1d52f57664b89f15330e2ebd953d
2017-08-07 16:28:28 +09:00

87 lines
3.0 KiB
C++

/*
* Copyright 2012 Google Inc. All Rights Reserved.
*/
#include "gtest/gtest.h"
#include "WVDrmFactory.h"
using namespace wvdrm;
using namespace android;
const uint8_t kWidevineUUID[16] = {
0xED,0xEF,0x8B,0xA9,0x79,0xD6,0x4A,0xCE,
0xA3,0xC8,0x27,0xDC,0xD5,0x1D,0x21,0xED
};
const uint8_t kOldNetflixWidevineUUID[16] = {
0x29,0x70,0x1F,0xE4,0x3C,0xC7,0x4A,0x34,
0x8C,0x5B,0xAE,0x90,0xC7,0x43,0x9A,0x47
};
const uint8_t kUnknownUUID[16] = {
0x6A,0x7F,0xAA,0xB0,0x83,0xC7,0x9E,0x20,
0x08,0xBC,0xEF,0x32,0x34,0x1A,0x9A,0x26
};
TEST(WVDrmFactoryTest, SupportsSupportedCryptoSchemes) {
WVDrmFactory factory;
EXPECT_TRUE(factory.isCryptoSchemeSupported(kWidevineUUID)) <<
"WVPluginFactory does not support Widevine's UUID";
EXPECT_TRUE(factory.isCryptoSchemeSupported(kOldNetflixWidevineUUID)) <<
"WVPluginFactory does not support the old Netflix Widevine UUID";
}
TEST(WVDrmFactoryTest, DoesNotSupportUnsupportedCryptoSchemes) {
WVDrmFactory factory;
EXPECT_FALSE(factory.isCryptoSchemeSupported(kUnknownUUID)) <<
"WVPluginFactory incorrectly claims to support an unknown UUID";
}
TEST(WVDrmFactoryTest, SupportsSupportedContainerFormats) {
WVDrmFactory factory;
EXPECT_TRUE(factory.isContentTypeSupported(String8("video/mp4"))) <<
"WVPluginFactory does not support ISO-BMFF video";
EXPECT_TRUE(factory.isContentTypeSupported(String8("audio/mp4"))) <<
"WVPluginFactory does not support ISO-BMFF audio";
EXPECT_TRUE(factory.isContentTypeSupported(String8("video/webm"))) <<
"WVPluginFactory does not support WebM video";
EXPECT_TRUE(factory.isContentTypeSupported(String8("audio/webm"))) <<
"WVPluginFactory does not support WebM audio";
}
TEST(WVDrmFactoryTest, DoesNotSupportUnsupportedContainerFormats) {
WVDrmFactory factory;
// Taken from Encoding.com's list of the most common internet video MIME-types
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-matroska"))) <<
"WVPluginFactory incorrectly claims to support Matroska";
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-flv"))) <<
"WVPluginFactory incorrectly claims to support Flash Video";
EXPECT_FALSE(factory.isContentTypeSupported(String8("application/x-mpegURL"))) <<
"WVPluginFactory incorrectly claims to support m3u8 Indexes";
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/MP2T"))) <<
"WVPluginFactory incorrectly claims to support MPEG-2 TS";
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/3gpp"))) <<
"WVPluginFactory incorrectly claims to support 3GP Mobile";
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/quicktime"))) <<
"WVPluginFactory incorrectly claims to support Quicktime";
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-msvideo"))) <<
"WVPluginFactory incorrectly claims to support AVI";
EXPECT_FALSE(factory.isContentTypeSupported(String8("video/x-ms-wmv"))) <<
"WVPluginFactory incorrectly claims to support WMV";
}