Add unit tests for AIDL service
[ Merged from http://go/wvgerrit/150029 ] Test: m libwvdrmengine_hal_test -j128 Test: m libwvdrmengine_hal_test WV_UNITTESTS_BUILD_TARGET=hidl -j128 Test: adb push $(OUT)/data/nativetest/libwvdrmengine_hal_test /data/nativetest/. Test: adb shell LD_LIBRARY_PATH=/vendor/lib64 /data/nativetest/libwvdrmengine_hal_test Bug: 217247987 Change-Id: Ib4f22c976b8ae6c2983cb611a958ddc3a29aebdb
This commit is contained in:
50
libwvdrmengine/test/unit/WVCryptoFactory_hal_test.cpp
Normal file
50
libwvdrmengine/test/unit/WVCryptoFactory_hal_test.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2022 Google LLC. All Rights Reserved. This file and proprietary
|
||||
* source code may only be used and distributed under the Widevine License
|
||||
* Agreement.
|
||||
*/
|
||||
|
||||
#include "WVDrmFactory.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace wvdrm {
|
||||
namespace hardware {
|
||||
namespace drm {
|
||||
namespace widevine {
|
||||
|
||||
using ::aidl::android::hardware::drm::Uuid;
|
||||
using ::wvdrm::hardware::drm::widevine::WVDrmFactory;
|
||||
|
||||
const Uuid kWidevineUUID = {0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE,
|
||||
0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED};
|
||||
|
||||
const Uuid kOldNetflixWidevineUUID = {0x29, 0x70, 0x1F, 0xE4, 0x3C, 0xC7,
|
||||
0x4A, 0x34, 0x8C, 0x5B, 0xAE, 0x90,
|
||||
0xC7, 0x43, 0x9A, 0x47};
|
||||
|
||||
const Uuid kUnknownUUID = {0x6A, 0x7F, 0xAA, 0xB0, 0x83, 0xC7, 0x9E, 0x20,
|
||||
0x08, 0xBC, 0xEF, 0x32, 0x34, 0x1A, 0x9A, 0x26};
|
||||
|
||||
TEST(WVCryptoFactoryTest, SupportsSupportedCryptoSchemes) {
|
||||
std::shared_ptr<WVDrmFactory> factory =
|
||||
::ndk::SharedRefBase::make<WVDrmFactory>();
|
||||
|
||||
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(WVCryptoFactoryTest, DoesNotSupportUnsupportedCryptoSchemes) {
|
||||
std::shared_ptr<WVDrmFactory> factory =
|
||||
::ndk::SharedRefBase::make<WVDrmFactory>();
|
||||
|
||||
EXPECT_FALSE(factory->isCryptoSchemeSupported(kUnknownUUID))
|
||||
<< "WVPluginFactory incorrectly claims to support an unknown UUID";
|
||||
}
|
||||
|
||||
} // namespace widevine
|
||||
} // namespace drm
|
||||
} // namespace hardware
|
||||
} // namespace wvdrm
|
||||
Reference in New Issue
Block a user