Correctly sets provisioning state for test.
[ Merge from http://go/wvgerrit/78383 ] Bug: http://b/121049662 Test: Re-ran the unit test. Change-Id: I62c00f425c93b588e123ddd8b1093177f2e9b241
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
// This file contains unit tests for the WvContentDecryptionModule class
|
// This file contains unit tests for the WvContentDecryptionModule class
|
||||||
// that pertain to collecting and reporting metrics.
|
// that pertain to collecting and reporting metrics.
|
||||||
|
|
||||||
|
#include "cdm_identifier.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "metrics.pb.h"
|
#include "metrics.pb.h"
|
||||||
@@ -32,9 +33,12 @@ namespace wvcdm {
|
|||||||
|
|
||||||
// This class is used to test the metrics-related feaures of the
|
// This class is used to test the metrics-related feaures of the
|
||||||
// WvContentDecryptionModule class.
|
// WvContentDecryptionModule class.
|
||||||
class WvContentDecryptionModuleMetricsTest : public ::testing::Test {
|
class WvContentDecryptionModuleMetricsTest : public WvCdmTestBase {
|
||||||
protected:
|
protected:
|
||||||
|
void Unprovision(CdmIdentifier identifier) {
|
||||||
|
EXPECT_EQ(NO_ERROR, decryptor_.Unprovision(kSecurityLevelL1, identifier));
|
||||||
|
EXPECT_EQ(NO_ERROR, decryptor_.Unprovision(kSecurityLevelL3, identifier));
|
||||||
|
}
|
||||||
wvcdm::WvContentDecryptionModule decryptor_;
|
wvcdm::WvContentDecryptionModule decryptor_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -92,6 +96,7 @@ TEST_F(WvContentDecryptionModuleMetricsTest, EngineOnlyMetrics) {
|
|||||||
TEST_F(WvContentDecryptionModuleMetricsTest, EngineAndSessionMetrics) {
|
TEST_F(WvContentDecryptionModuleMetricsTest, EngineAndSessionMetrics) {
|
||||||
CdmSessionId session_id;
|
CdmSessionId session_id;
|
||||||
wvcdm::CdmKeySystem key_system("com.widevine");
|
wvcdm::CdmKeySystem key_system("com.widevine");
|
||||||
|
Unprovision(kDefaultCdmIdentifier);
|
||||||
|
|
||||||
// Openning the session will fail with NEEDS_PROVISIONING error. But it will
|
// Openning the session will fail with NEEDS_PROVISIONING error. But it will
|
||||||
// still create some session-level stats.
|
// still create some session-level stats.
|
||||||
@@ -138,6 +143,12 @@ TEST_F(WvContentDecryptionModuleMetricsTest,
|
|||||||
// as the one above except for the unique_id.
|
// as the one above except for the unique_id.
|
||||||
{ "foo", "bar", "baz", 8 }};
|
{ "foo", "bar", "baz", 8 }};
|
||||||
const int cdm_engine_count = 3;
|
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++) {
|
for (int i = 0; i < cdm_engine_count; i++) {
|
||||||
// To make sure we can detect different engine metrics,
|
// To make sure we can detect different engine metrics,
|
||||||
// make the open session call a different number of times for
|
// make the open session call a different number of times for
|
||||||
|
|||||||
Reference in New Issue
Block a user