Version 18.1

Updates to OEMCrypto API, OPK, ODK, and unit tests.

See the file CHANGELOG.md for details.
This commit is contained in:
Fred Gylys-Colwell
2023-03-08 22:05:11 -08:00
committed by John "Juce" Bruce
parent 5232c51e33
commit 562f64f292
499 changed files with 29039 additions and 15184 deletions

View File

@@ -0,0 +1,64 @@
// 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 "string_format.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <string>
namespace wvutil {
TEST(StringFormatTest, SignedInteger) {
constexpr char kFormat[] = "Version %d";
constexpr char kResult[] = "Version -123";
std::string result;
EXPECT_TRUE(FormatString(&result, kFormat, -123));
EXPECT_EQ(result, kResult);
}
TEST(StringFormatTest, UnsignedInteger) {
constexpr char kFormat[] = "Version %u";
constexpr char kResult[] = "Version 27";
std::string result;
EXPECT_TRUE(FormatString(&result, kFormat, 27));
EXPECT_EQ(result, kResult);
}
TEST(StringFormatTest, HexInteger) {
constexpr char kFormat[] = "Version %X";
constexpr char kResult[] = "Version FF";
std::string result;
EXPECT_TRUE(FormatString(&result, kFormat, 0xFF));
EXPECT_EQ(result, kResult);
}
TEST(StringFormatTest, Strings) {
constexpr char kFormat[] = "Hello, %s.";
constexpr char kResult[] = "Hello, DRM.";
std::string result;
EXPECT_TRUE(FormatString(&result, kFormat, "DRM"));
EXPECT_EQ(result, kResult);
}
TEST(StringFormatTest, Nothing) {
constexpr char kString[] = "No format fields.";
std::string result;
EXPECT_TRUE(FormatString(&result, kString));
EXPECT_EQ(result, kString);
}
TEST(StringFormatTest, NullOutput) {
constexpr char kString[] = "This will never be referenced.";
EXPECT_FALSE(FormatString(nullptr, kString));
}
TEST(StringFormatTest, NullFormat) {
std::string result;
EXPECT_FALSE(FormatString(&result, nullptr));
EXPECT_TRUE(result.empty());
}
} // namespace wvutil

View File

@@ -2,7 +2,9 @@
// source code may only be used and distributed under the Widevine License
// Agreement.
//
// Clock - A fake clock just for running tests.
// Clock - A fake clock just for running tests. This is used when running
// OEMCrypto unit tests. It is not used when tests include the CE CDM source
// code because that uses the clock in cdm/test_host.cpp instead.
#include <chrono>