diff --git a/libwvdrmengine/cdm/test/wv_cdm_metrics_test.cpp b/libwvdrmengine/cdm/test/wv_cdm_metrics_test.cpp index ba3f635b..9abfb11c 100644 --- a/libwvdrmengine/cdm/test/wv_cdm_metrics_test.cpp +++ b/libwvdrmengine/cdm/test/wv_cdm_metrics_test.cpp @@ -5,6 +5,7 @@ // This file contains unit tests for the WvContentDecryptionModule class // that pertain to collecting and reporting metrics. +#include "cdm_identifier.h" #include "gmock/gmock.h" #include "log.h" #include "metrics.pb.h" @@ -32,9 +33,12 @@ namespace wvcdm { // This class is used to test the metrics-related feaures of the // WvContentDecryptionModule class. -class WvContentDecryptionModuleMetricsTest : public ::testing::Test { +class WvContentDecryptionModuleMetricsTest : public WvCdmTestBase { protected: - + void Unprovision(CdmIdentifier identifier) { + EXPECT_EQ(NO_ERROR, decryptor_.Unprovision(kSecurityLevelL1, identifier)); + EXPECT_EQ(NO_ERROR, decryptor_.Unprovision(kSecurityLevelL3, identifier)); + } wvcdm::WvContentDecryptionModule decryptor_; }; @@ -92,6 +96,7 @@ TEST_F(WvContentDecryptionModuleMetricsTest, EngineOnlyMetrics) { TEST_F(WvContentDecryptionModuleMetricsTest, EngineAndSessionMetrics) { CdmSessionId session_id; wvcdm::CdmKeySystem key_system("com.widevine"); + Unprovision(kDefaultCdmIdentifier); // Openning the session will fail with NEEDS_PROVISIONING error. But it will // still create some session-level stats. @@ -138,6 +143,12 @@ TEST_F(WvContentDecryptionModuleMetricsTest, // as the one above except for the unique_id. { "foo", "bar", "baz", 8 }}; const int cdm_engine_count = 3; + + // Force Unprovision. + for (int i = 0; i < cdm_engine_count; i++) { + Unprovision(identifiers[i]); + } + for (int i = 0; i < cdm_engine_count; i++) { // To make sure we can detect different engine metrics, // make the open session call a different number of times for