Widevine Metrics System
This change is the complete Widevine metrics system. It will measure and record runtime information about what is happening in the CDM - such as errors and throughput. Bug: 33745339 Bug: 26027857 Change-Id: Ic9a82074f1e2b72c72d751b235f8ae361232787d
This commit is contained in:
47
libwvdrmengine/cdm/metrics/test/distribution_test.cpp
Normal file
47
libwvdrmengine/cdm/metrics/test/distribution_test.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Unit tests for Distribution.
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#include "distribution.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace wvcdm {
|
||||
namespace metrics {
|
||||
|
||||
TEST(DistributionTest, NoValuesRecorded) {
|
||||
Distribution distribution;
|
||||
EXPECT_EQ(DBL_MAX, distribution.Min());
|
||||
EXPECT_EQ(-DBL_MAX, distribution.Max());
|
||||
EXPECT_EQ(0, distribution.Mean());
|
||||
EXPECT_EQ(0, distribution.Count());
|
||||
EXPECT_EQ(0, distribution.Variance());
|
||||
}
|
||||
|
||||
TEST(DistributionTest, OneValueRecorded) {
|
||||
Distribution distribution;
|
||||
distribution.Record(5.0);
|
||||
EXPECT_EQ(5, distribution.Min());
|
||||
EXPECT_EQ(5, distribution.Max());
|
||||
EXPECT_EQ(5, distribution.Mean());
|
||||
EXPECT_EQ(1, distribution.Count());
|
||||
EXPECT_EQ(0, distribution.Variance());
|
||||
}
|
||||
|
||||
TEST(DistributionTest, MultipleValuesRecorded) {
|
||||
Distribution distribution;
|
||||
distribution.Record(5.0);
|
||||
distribution.Record(10.0);
|
||||
distribution.Record(15.0);
|
||||
EXPECT_EQ(5, distribution.Min());
|
||||
EXPECT_EQ(15, distribution.Max());
|
||||
EXPECT_EQ(10, distribution.Mean());
|
||||
EXPECT_EQ(3, distribution.Count());
|
||||
EXPECT_NEAR(16.6667, distribution.Variance(), 0.0001);
|
||||
}
|
||||
|
||||
} // namespace metrics
|
||||
} // namespace wvcdm
|
||||
|
||||
Reference in New Issue
Block a user