Source release 17.1.0
This commit is contained in:
@@ -1,23 +1,22 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
// Copyright 2017 Google LLC. All Rights Reserved. This file and proprietary
|
||||
// source code may only be used and distributed under the Widevine License
|
||||
// Agreement.
|
||||
//
|
||||
// Unit tests for EventMetric
|
||||
|
||||
#include "event_metric.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "string_conversions.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using drm_metrics::TestMetrics;
|
||||
using testing::IsNull;
|
||||
using testing::NotNull;
|
||||
#include "string_conversions.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
namespace metrics {
|
||||
using drm_metrics::TestMetrics;
|
||||
|
||||
class EventMetricTest : public ::testing::Test {
|
||||
public:
|
||||
void SetUp() {}
|
||||
void SetUp() override {}
|
||||
|
||||
protected:
|
||||
};
|
||||
@@ -46,7 +45,7 @@ TEST_F(EventMetricTest, NoFieldsSuccess) {
|
||||
EXPECT_EQ(2u, metric_proto.test_distributions(0).operation_count());
|
||||
EXPECT_FALSE(metric_proto.test_distributions(0).has_attributes())
|
||||
<< std::string("Unexpected attributes value. Serialized metrics: ")
|
||||
<< wvcdm::b2a_hex(serialized_metrics);
|
||||
<< wvutil::b2a_hex(serialized_metrics);
|
||||
}
|
||||
|
||||
TEST_F(EventMetricTest, OneFieldSuccess) {
|
||||
@@ -71,7 +70,8 @@ TEST_F(EventMetricTest, OneFieldSuccess) {
|
||||
|
||||
TEST_F(EventMetricTest, TwoFieldsSuccess) {
|
||||
EventMetric<drm_metrics::Attributes::kErrorCodeFieldNumber, int,
|
||||
drm_metrics::Attributes::kLengthFieldNumber, Pow2Bucket> metric;
|
||||
drm_metrics::Attributes::kLengthFieldNumber, Pow2Bucket>
|
||||
metric;
|
||||
|
||||
metric.Record(1, 7, Pow2Bucket(23));
|
||||
metric.Record(2, 7, Pow2Bucket(33));
|
||||
@@ -114,7 +114,8 @@ TEST_F(EventMetricTest, TwoFieldsSuccess) {
|
||||
TEST_F(EventMetricTest, ThreeFieldsSuccess) {
|
||||
EventMetric<drm_metrics::Attributes::kErrorCodeFieldNumber, int,
|
||||
drm_metrics::Attributes::kLengthFieldNumber, Pow2Bucket,
|
||||
drm_metrics::Attributes::kErrorCodeBoolFieldNumber, bool> metric;
|
||||
drm_metrics::Attributes::kErrorCodeBoolFieldNumber, bool>
|
||||
metric;
|
||||
metric.Record(10LL, 7, Pow2Bucket(13), false);
|
||||
metric.Record(11LL, 8, Pow2Bucket(17), true);
|
||||
|
||||
@@ -127,14 +128,16 @@ TEST_F(EventMetricTest, ThreeFieldsSuccess) {
|
||||
EXPECT_FALSE(metric_proto.test_distributions(0).has_variance());
|
||||
EXPECT_EQ(7, metric_proto.test_distributions(0).attributes().error_code());
|
||||
EXPECT_EQ(8u, metric_proto.test_distributions(0).attributes().length());
|
||||
EXPECT_FALSE(metric_proto.test_distributions(0).attributes().error_code_bool());
|
||||
EXPECT_FALSE(
|
||||
metric_proto.test_distributions(0).attributes().error_code_bool());
|
||||
|
||||
EXPECT_EQ(1u, metric_proto.test_distributions(1).operation_count());
|
||||
EXPECT_EQ(11LL, metric_proto.test_distributions(1).mean());
|
||||
EXPECT_FALSE(metric_proto.test_distributions(1).has_variance());
|
||||
EXPECT_EQ(8, metric_proto.test_distributions(1).attributes().error_code());
|
||||
EXPECT_EQ(16u, metric_proto.test_distributions(1).attributes().length());
|
||||
EXPECT_TRUE(metric_proto.test_distributions(1).attributes().error_code_bool());
|
||||
EXPECT_TRUE(
|
||||
metric_proto.test_distributions(1).attributes().error_code_bool());
|
||||
}
|
||||
|
||||
TEST_F(EventMetricTest, FourFieldsSuccess) {
|
||||
@@ -142,7 +145,8 @@ TEST_F(EventMetricTest, FourFieldsSuccess) {
|
||||
drm_metrics::Attributes::kLengthFieldNumber, Pow2Bucket,
|
||||
drm_metrics::Attributes::kErrorCodeBoolFieldNumber, bool,
|
||||
drm_metrics::Attributes::kCdmSecurityLevelFieldNumber,
|
||||
CdmSecurityLevel> metric;
|
||||
CdmSecurityLevel>
|
||||
metric;
|
||||
|
||||
metric.Record(10LL, 7, Pow2Bucket(13), true, kSecurityLevelL3);
|
||||
|
||||
@@ -155,7 +159,8 @@ TEST_F(EventMetricTest, FourFieldsSuccess) {
|
||||
EXPECT_FALSE(metric_proto.test_distributions(0).has_variance());
|
||||
EXPECT_EQ(7, metric_proto.test_distributions(0).attributes().error_code());
|
||||
EXPECT_EQ(8u, metric_proto.test_distributions(0).attributes().length());
|
||||
EXPECT_TRUE(metric_proto.test_distributions(0).attributes().error_code_bool());
|
||||
EXPECT_TRUE(
|
||||
metric_proto.test_distributions(0).attributes().error_code_bool());
|
||||
EXPECT_EQ(
|
||||
3u, metric_proto.test_distributions(0).attributes().cdm_security_level());
|
||||
}
|
||||
@@ -185,6 +190,5 @@ TEST_F(EventMetricTest, Pow2BucketTest) {
|
||||
value << Pow2Bucket(0x7FFFFFFF);
|
||||
EXPECT_EQ("1073741824", value.str());
|
||||
}
|
||||
|
||||
} // namespace metrics
|
||||
} // namespace wvcdm
|
||||
|
||||
Reference in New Issue
Block a user