Update to support OEMCrypto v16 with ODK
This commit is contained in:
58
common/hash_algorithm_util_test.cc
Normal file
58
common/hash_algorithm_util_test.cc
Normal file
@@ -0,0 +1,58 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2020 Google LLC.
|
||||
//
|
||||
// This software is licensed under the terms defined in the Widevine Master
|
||||
// License Agreement. For a copy of this agreement, please contact
|
||||
// widevine-licensing@google.com.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "common/hash_algorithm_util.h"
|
||||
|
||||
#include "testing/gmock.h"
|
||||
#include "testing/gunit.h"
|
||||
#include "common/hash_algorithm.h"
|
||||
|
||||
namespace widevine {
|
||||
|
||||
TEST(HashAlgorithmTest, ProtoToEnumUnspecified) {
|
||||
EXPECT_EQ(HashAlgorithm::kUnspecified,
|
||||
HashAlgorithmProtoToEnum(HASH_ALGORITHM_UNSPECIFIED));
|
||||
}
|
||||
|
||||
TEST(HashAlgorithmTest, ProtoToEnumSha1) {
|
||||
EXPECT_EQ(HashAlgorithm::kSha1,
|
||||
HashAlgorithmProtoToEnum(HASH_ALGORITHM_SHA_1));
|
||||
}
|
||||
|
||||
TEST(HashAlgorithmTest, ProtoToEnumSha256) {
|
||||
EXPECT_EQ(HashAlgorithm::kSha256,
|
||||
HashAlgorithmProtoToEnum(HASH_ALGORITHM_SHA_256));
|
||||
}
|
||||
|
||||
TEST(HashAlgorithmTest, ProtoToEnumUnsupported) {
|
||||
EXPECT_EQ(HashAlgorithm::kUnspecified,
|
||||
HashAlgorithmProtoToEnum(static_cast<HashAlgorithmProto>(1234)));
|
||||
}
|
||||
|
||||
TEST(HashAlgorithmTest, EnumToProtoUnspecified) {
|
||||
EXPECT_EQ(HASH_ALGORITHM_UNSPECIFIED,
|
||||
HashAlgorithmEnumToProto(HashAlgorithm::kUnspecified));
|
||||
}
|
||||
|
||||
TEST(HashAlgorithmTest, EnumToProtoSha1) {
|
||||
EXPECT_EQ(HASH_ALGORITHM_SHA_1,
|
||||
HashAlgorithmEnumToProto(HashAlgorithm::kSha1));
|
||||
}
|
||||
|
||||
TEST(HashAlgorithmTest, EnumToProtoSha256) {
|
||||
EXPECT_EQ(HASH_ALGORITHM_SHA_256,
|
||||
HashAlgorithmEnumToProto(HashAlgorithm::kSha256));
|
||||
}
|
||||
|
||||
TEST(HashAlgorithmTest, EnumToProtoUnexpected) {
|
||||
int some_value = 1234;
|
||||
EXPECT_EQ(HASH_ALGORITHM_UNSPECIFIED,
|
||||
HashAlgorithmEnumToProto(static_cast<HashAlgorithm>(some_value)));
|
||||
}
|
||||
|
||||
} // namespace widevine
|
||||
Reference in New Issue
Block a user