Updated copyright notice and cleaned up includes.
[ Merge of http://go/wvgerrit/137810 ] Bug: 204946540 Test: Metric unit tests Change-Id: I78f839fafd27604a2bb78c04d587c40919c5372d
This commit is contained in:
@@ -1,21 +1,18 @@
|
|||||||
// Copyright 2018 Google Inc. All Rights Reserved.
|
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
||||||
|
// source code may only be used and distributed under the Widevine License
|
||||||
|
// Agreement.
|
||||||
//
|
//
|
||||||
// This file contains the declarations for the EventMetric class and related
|
// This file contains the declarations for the EventMetric class and related
|
||||||
// types.
|
// types.
|
||||||
#ifndef WVCDM_METRICS_ATTRIBUTE_HANDLER_H_
|
#ifndef WVCDM_METRICS_ATTRIBUTE_HANDLER_H_
|
||||||
#define WVCDM_METRICS_ATTRIBUTE_HANDLER_H_
|
#define WVCDM_METRICS_ATTRIBUTE_HANDLER_H_
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "OEMCryptoCENC.h"
|
|
||||||
#include "field_tuples.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "pow2bucket.h"
|
|
||||||
#include "value_metric.h"
|
|
||||||
#include "wv_cdm_types.h"
|
|
||||||
#include "wv_metrics.pb.h"
|
#include "wv_metrics.pb.h"
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
// This method is used to set the value of a single proto field.
|
// This method is used to set the value of a single proto field.
|
||||||
// Specializations handle setting each value.
|
// Specializations handle setting each value.
|
||||||
template <int I, typename F>
|
template <int I, typename F>
|
||||||
@@ -47,7 +44,6 @@ class AttributeHandler {
|
|||||||
return serialized_attributes;
|
return serialized_attributes;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
#endif // WVCDM_METRICS_ATTRIBUTE_HANDLER_H_
|
#endif // WVCDM_METRICS_ATTRIBUTE_HANDLER_H_
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
// 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.
|
||||||
//
|
//
|
||||||
// This file contains the declarations for the Metric class and related
|
// This file contains the declarations for the Metric class and related
|
||||||
// types.
|
// types.
|
||||||
#ifndef WVCDM_METRICS_COUNTER_METRIC_H_
|
#ifndef WVCDM_METRICS_COUNTER_METRIC_H_
|
||||||
#define WVCDM_METRICS_COUNTER_METRIC_H_
|
#define WVCDM_METRICS_COUNTER_METRIC_H_
|
||||||
|
|
||||||
#include <cstdarg>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "attribute_handler.h"
|
#include "attribute_handler.h"
|
||||||
#include "field_tuples.h"
|
#include "field_tuples.h"
|
||||||
|
#include "wv_metrics.pb.h"
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
class CounterMetricTest;
|
class CounterMetricTest;
|
||||||
|
|
||||||
// This base class provides the common defintion used by all templated
|
// This base class provides the common defintion used by all templated
|
||||||
@@ -144,8 +144,6 @@ inline void CounterMetric<I1, F1, I2, F2, I3, F3, I4, F4>::ToProto(
|
|||||||
new_counter->set_count(it->second);
|
new_counter->set_count(it->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|
||||||
#endif // WVCDM_METRICS_COUNTER_METRIC_H_
|
#endif // WVCDM_METRICS_COUNTER_METRIC_H_
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// 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.
|
||||||
//
|
//
|
||||||
// This file contains the definition of a Distribution class which computes
|
// This file contains the definition of a Distribution class which computes
|
||||||
// the distribution values of a series of samples.
|
// the distribution values of a series of samples.
|
||||||
@@ -10,7 +12,6 @@
|
|||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
// The Distribution class holds statistics about a series of values that the
|
// The Distribution class holds statistics about a series of values that the
|
||||||
// client provides via the Record method. A caller will call Record once for
|
// client provides via the Record method. A caller will call Record once for
|
||||||
// each of the values in a series. The Distribution instance will calculate the
|
// each of the values in a series. The Distribution instance will calculate the
|
||||||
@@ -46,8 +47,6 @@ class Distribution {
|
|||||||
float mean_;
|
float mean_;
|
||||||
double sum_squared_deviation_;
|
double sum_squared_deviation_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|
||||||
#endif // WVCDM_METRICS_DISTRIBUTION_H_
|
#endif // WVCDM_METRICS_DISTRIBUTION_H_
|
||||||
|
|||||||
@@ -1,26 +1,24 @@
|
|||||||
// 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.
|
||||||
//
|
//
|
||||||
// This file contains the declarations for the EventMetric class and related
|
// This file contains the declarations for the EventMetric class and related
|
||||||
// types.
|
// types.
|
||||||
#ifndef WVCDM_METRICS_EVENT_METRIC_H_
|
#ifndef WVCDM_METRICS_EVENT_METRIC_H_
|
||||||
#define WVCDM_METRICS_EVENT_METRIC_H_
|
#define WVCDM_METRICS_EVENT_METRIC_H_
|
||||||
|
|
||||||
#include <cstdarg>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "OEMCryptoCENC.h"
|
|
||||||
#include "attribute_handler.h"
|
#include "attribute_handler.h"
|
||||||
#include "distribution.h"
|
#include "distribution.h"
|
||||||
|
#include "field_tuples.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "pow2bucket.h"
|
#include "pow2bucket.h"
|
||||||
#include "wv_metrics.pb.h"
|
#include "wv_metrics.pb.h"
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
class EventMetricTest;
|
class EventMetricTest;
|
||||||
|
|
||||||
// This base class provides the common defintion used by all templated
|
// This base class provides the common defintion used by all templated
|
||||||
@@ -166,8 +164,6 @@ inline void EventMetric<I1, F1, I2, F2, I3, F3, I4, F4>::ToProto(
|
|||||||
SetDistributionValues(*it->second, new_metric);
|
SetDistributionValues(*it->second, new_metric);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|
||||||
#endif // WVCDM_METRICS_EVENT_METRIC_H_
|
#endif // WVCDM_METRICS_EVENT_METRIC_H_
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
// 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.
|
||||||
//
|
//
|
||||||
// This file contains the helper classes and methods for using field tuples
|
// This file contains the helper classes and methods for using field tuples
|
||||||
// used by metrics classes to record variations of a single metric.
|
// used by metrics classes to record variations of a single metric.
|
||||||
#ifndef WVCDM_METRICS_FIELD_TUPLES_H_
|
#ifndef WVCDM_METRICS_FIELD_TUPLES_H_
|
||||||
#define WVCDM_METRICS_FIELD_TUPLES_H_
|
#define WVCDM_METRICS_FIELD_TUPLES_H_
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
namespace util {
|
namespace util {
|
||||||
|
|
||||||
// TODO(blueeyes): Change to use C++ 11 support for variadic template args.
|
// TODO(blueeyes): Change to use C++ 11 support for variadic template args.
|
||||||
// The C++ 03 pattern is no longer needed since we require C++11. b/68766426.
|
// The C++ 03 pattern is no longer needed since we require C++11. b/68766426.
|
||||||
|
|
||||||
@@ -23,9 +22,7 @@ struct Unused {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace util
|
} // namespace util
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|
||||||
#endif // WVCDM_METRICS_FIELD_TUPLES_H_
|
#endif // WVCDM_METRICS_FIELD_TUPLES_H_
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
// Copyright 2016 Google Inc. All Rights Reserved.
|
// Copyright 2016 Google LLC. All Rights Reserved. This file and proprietary
|
||||||
|
// source code may only be used and distributed under the Widevine License
|
||||||
|
// Agreement.
|
||||||
//
|
//
|
||||||
// This file contains definitions for metrics being collected throughout the
|
// This file contains definitions for metrics being collected throughout the
|
||||||
// CDM.
|
// CDM.
|
||||||
|
#ifndef WVCDM_METRICS_METRICS_COLLECTIONS_H_
|
||||||
#ifndef WVCDM_METRICS_METRICS_GROUP_H_
|
#define WVCDM_METRICS_METRICS_COLLECTIONS_H_
|
||||||
#define WVCDM_METRICS_METRICS_GROUP_H_
|
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "OEMCryptoCENC.h"
|
#include "OEMCryptoCENC.h"
|
||||||
#include "counter_metric.h"
|
#include "counter_metric.h"
|
||||||
@@ -58,9 +61,7 @@
|
|||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Short name definitions to ease AttributeHandler definitions.
|
// Short name definitions to ease AttributeHandler definitions.
|
||||||
// Internal namespace to help simplify declarations.
|
// Internal namespace to help simplify declarations.
|
||||||
const int kErrorCodeFieldNumber =
|
const int kErrorCodeFieldNumber =
|
||||||
@@ -88,8 +89,7 @@ const int kKeyRequestTypeFieldNumber =
|
|||||||
::drm_metrics::Attributes::kKeyRequestTypeFieldNumber;
|
::drm_metrics::Attributes::kKeyRequestTypeFieldNumber;
|
||||||
const int kLicenseTypeFieldNumber =
|
const int kLicenseTypeFieldNumber =
|
||||||
::drm_metrics::Attributes::kLicenseTypeFieldNumber;
|
::drm_metrics::Attributes::kLicenseTypeFieldNumber;
|
||||||
|
} // namespace
|
||||||
} // anonymous namespace
|
|
||||||
|
|
||||||
// The maximum number of completed sessions that can be stored. More than this
|
// The maximum number of completed sessions that can be stored. More than this
|
||||||
// will cause some metrics to be discarded.
|
// will cause some metrics to be discarded.
|
||||||
@@ -292,7 +292,7 @@ class CryptoMetrics {
|
|||||||
oemcrypto_load_provisioning_;
|
oemcrypto_load_provisioning_;
|
||||||
ValueMetric<uint32_t> oemcrypto_minor_api_version_;
|
ValueMetric<uint32_t> oemcrypto_minor_api_version_;
|
||||||
ValueMetric<uint32_t> oemcrypto_maximum_usage_table_header_size_;
|
ValueMetric<uint32_t> oemcrypto_maximum_usage_table_header_size_;
|
||||||
};
|
}; // class CryptoMetrics
|
||||||
|
|
||||||
// This class contains session-scoped metrics. All properties and
|
// This class contains session-scoped metrics. All properties and
|
||||||
// statistics related to operations within a single session are
|
// statistics related to operations within a single session are
|
||||||
@@ -350,7 +350,7 @@ class SessionMetrics {
|
|||||||
CdmSessionId session_id_;
|
CdmSessionId session_id_;
|
||||||
bool completed_;
|
bool completed_;
|
||||||
CryptoMetrics crypto_metrics_;
|
CryptoMetrics crypto_metrics_;
|
||||||
};
|
}; // class SessionMetrics
|
||||||
|
|
||||||
// This class contains metrics for the OEMCrypto Dynamic Adapter. They are
|
// This class contains metrics for the OEMCrypto Dynamic Adapter. They are
|
||||||
// separated from other metrics because they need to be encapsulated in a
|
// separated from other metrics because they need to be encapsulated in a
|
||||||
@@ -389,7 +389,7 @@ class OemCryptoDynamicAdapterMetrics {
|
|||||||
previous_oemcrypto_initialization_failure_;
|
previous_oemcrypto_initialization_failure_;
|
||||||
ValueMetric<uint32_t> oemcrypto_l1_api_version_;
|
ValueMetric<uint32_t> oemcrypto_l1_api_version_;
|
||||||
ValueMetric<uint32_t> oemcrypto_l1_min_api_version_;
|
ValueMetric<uint32_t> oemcrypto_l1_min_api_version_;
|
||||||
};
|
}; // class OemCryptoDynamicAdapterMetrics
|
||||||
|
|
||||||
// This will fetch the singleton instance for dynamic adapter metrics.
|
// This will fetch the singleton instance for dynamic adapter metrics.
|
||||||
// This method is safe only if we use C++ 11. In C++ 11, static function-local
|
// This method is safe only if we use C++ 11. In C++ 11, static function-local
|
||||||
@@ -494,9 +494,7 @@ class EngineMetrics {
|
|||||||
|
|
||||||
void SerializeEngineMetrics(
|
void SerializeEngineMetrics(
|
||||||
drm_metrics::WvCdmMetrics::EngineMetrics* engine_metrics) const;
|
drm_metrics::WvCdmMetrics::EngineMetrics* engine_metrics) const;
|
||||||
};
|
}; // class EngineMetrics
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
#endif // WVCDM_METRICS_METRICS_COLLECTIONS_H_
|
||||||
#endif // WVCDM_METRICS_METRICS_GROUP_H_
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
// Copyright 2018 Google Inc. All Rights Reserved.
|
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
||||||
|
// source code may only be used and distributed under the Widevine License
|
||||||
|
// Agreement.
|
||||||
//
|
//
|
||||||
// This file contains the declaration of the Pow2Bucket class which
|
// This file contains the declaration of the Pow2Bucket class which
|
||||||
// is a convenient way to bucketize sampled values into powers of 2.
|
// is a convenient way to bucketize sampled values into powers of 2.
|
||||||
#ifndef WVCDM_METRICS_POW2BUCKET_H_
|
#ifndef WVCDM_METRICS_POW2BUCKET_H_
|
||||||
#define WVCDM_METRICS_POW2BUCKET_H_
|
#define WVCDM_METRICS_POW2BUCKET_H_
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
// This class converts the size_t value into the highest power of two
|
// This class converts the size_t value into the highest power of two
|
||||||
// below the value. E.g. for 7, the value is 4. For 11, the value is 8.
|
// below the value. E.g. for 7, the value is 4. For 11, the value is 8.
|
||||||
// This class is intended to simplify the use of EventMetric Fields that may
|
// This class is intended to simplify the use of EventMetric Fields that may
|
||||||
@@ -43,8 +43,6 @@ class Pow2Bucket {
|
|||||||
|
|
||||||
size_t value_;
|
size_t value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|
||||||
#endif // WVCDM_METRICS_POW2BUCKET_H_
|
#endif // WVCDM_METRICS_POW2BUCKET_H_
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
|
// Copyright 2017 Google LLC. All Rights Reserved. This file and proprietary
|
||||||
|
// source code may only be used and distributed under the Widevine License
|
||||||
|
// Agreement.
|
||||||
#ifndef WVCDM_METRICS_TIMER_METRIC_H_
|
#ifndef WVCDM_METRICS_TIMER_METRIC_H_
|
||||||
#define WVCDM_METRICS_TIMER_METRIC_H_
|
#define WVCDM_METRICS_TIMER_METRIC_H_
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
class TimerMetric {
|
class TimerMetric {
|
||||||
public:
|
public:
|
||||||
// Constructs a new TimerMetric.
|
// Constructs a new TimerMetric.
|
||||||
@@ -28,7 +29,6 @@ class TimerMetric {
|
|||||||
std::chrono::time_point<std::chrono::steady_clock> start_;
|
std::chrono::time_point<std::chrono::steady_clock> start_;
|
||||||
bool is_started_;
|
bool is_started_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
#endif
|
#endif // WVCDM_METRICS_TIMER_METRIC_H_
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
// 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.
|
||||||
//
|
//
|
||||||
// This file contains the declarations for the Metric class and related
|
// This file contains the declarations for the Metric class and related
|
||||||
// types.
|
// types.
|
||||||
#ifndef WVCDM_METRICS_VALUE_METRIC_H_
|
#ifndef WVCDM_METRICS_VALUE_METRIC_H_
|
||||||
#define WVCDM_METRICS_VALUE_METRIC_H_
|
#define WVCDM_METRICS_VALUE_METRIC_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -13,14 +15,11 @@
|
|||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
// Internal namespace for helper methods.
|
// Internal namespace for helper methods.
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
// Helper function for setting a value in the proto.
|
// Helper function for setting a value in the proto.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void SetValue(drm_metrics::ValueMetric* value_proto, const T& value);
|
void SetValue(drm_metrics::ValueMetric* value_proto, const T& value);
|
||||||
|
|
||||||
} // namespace impl
|
} // namespace impl
|
||||||
|
|
||||||
// The ValueMetric class supports storing a single, overwritable value or an
|
// The ValueMetric class supports storing a single, overwritable value or an
|
||||||
@@ -118,9 +117,7 @@ class ValueMetric {
|
|||||||
* in const methods.
|
* in const methods.
|
||||||
*/
|
*/
|
||||||
mutable std::mutex internal_lock_;
|
mutable std::mutex internal_lock_;
|
||||||
};
|
}; // class ValueMetric
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|
||||||
#endif // WVCDM_METRICS_VALUE_METRIC_H_
|
#endif // WVCDM_METRICS_VALUE_METRIC_H_
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
// Copyright 2018 Google Inc. All Rights Reserved.
|
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
||||||
|
// source code may only be used and distributed under the Widevine License
|
||||||
|
// Agreement.
|
||||||
//
|
//
|
||||||
// This file contains implementations for the AttributeHandler.
|
// This file contains implementations for the AttributeHandler.
|
||||||
|
|
||||||
#include "attribute_handler.h"
|
#include "attribute_handler.h"
|
||||||
|
|
||||||
#include "OEMCryptoCENC.h"
|
#include "OEMCryptoCENC.h"
|
||||||
|
#include "field_tuples.h"
|
||||||
#include "pow2bucket.h"
|
#include "pow2bucket.h"
|
||||||
#include "wv_cdm_types.h"
|
#include "wv_cdm_types.h"
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Specializations for setting attribute fields.
|
// Specializations for setting attribute fields.
|
||||||
//
|
//
|
||||||
@@ -106,6 +109,5 @@ void SetAttributeField<drm_metrics::Attributes::kErrorCodeFieldNumber, int>(
|
|||||||
const int& cdm_error, drm_metrics::Attributes* attributes) {
|
const int& cdm_error, drm_metrics::Attributes* attributes) {
|
||||||
attributes->set_error_code(cdm_error);
|
attributes->set_error_code(cdm_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
// 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.
|
||||||
//
|
//
|
||||||
// This file contains implementations for the BaseCounterMetric, the base class
|
// This file contains implementations for the BaseCounterMetric, the base class
|
||||||
// for CounterMetric.
|
// for CounterMetric.
|
||||||
|
|
||||||
#include "counter_metric.h"
|
#include "counter_metric.h"
|
||||||
|
|
||||||
#include "wv_metrics.pb.h"
|
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
void BaseCounterMetric::Increment(const std::string& counter_key,
|
void BaseCounterMetric::Increment(const std::string& counter_key,
|
||||||
int64_t value) {
|
int64_t value) {
|
||||||
std::unique_lock<std::mutex> lock(internal_lock_);
|
std::unique_lock<std::mutex> lock(internal_lock_);
|
||||||
@@ -20,6 +19,5 @@ void BaseCounterMetric::Increment(const std::string& counter_key,
|
|||||||
value_map_[counter_key] = value_map_[counter_key] + value;
|
value_map_[counter_key] = value_map_[counter_key] + value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// 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.
|
||||||
//
|
//
|
||||||
// This file contains the definitions for the Distribution class members.
|
// This file contains the definitions for the Distribution class members.
|
||||||
|
|
||||||
@@ -8,7 +10,6 @@
|
|||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
Distribution::Distribution()
|
Distribution::Distribution()
|
||||||
: count_(0ULL),
|
: count_(0ULL),
|
||||||
min_(FLT_MAX),
|
min_(FLT_MAX),
|
||||||
@@ -26,6 +27,5 @@ void Distribution::Record(float value) {
|
|||||||
min_ = min_ < value ? min_ : value;
|
min_ = min_ < value ? min_ : value;
|
||||||
max_ = max_ > value ? max_ : value;
|
max_ = max_ > value ? max_ : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
// 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.
|
||||||
//
|
//
|
||||||
// This file contains implementations for the BaseEventMetric.
|
// This file contains implementations for the BaseEventMetric.
|
||||||
|
|
||||||
#include "event_metric.h"
|
#include "event_metric.h"
|
||||||
|
|
||||||
using ::google::protobuf::RepeatedPtrField;
|
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
BaseEventMetric::~BaseEventMetric() {
|
BaseEventMetric::~BaseEventMetric() {
|
||||||
std::unique_lock<std::mutex> lock(internal_lock_);
|
std::unique_lock<std::mutex> lock(internal_lock_);
|
||||||
|
|
||||||
for (std::map<std::string, Distribution*>::iterator it = value_map_.begin();
|
for (std::map<std::string, Distribution*>::iterator it = value_map_.begin();
|
||||||
it != value_map_.end(); it++) {
|
it != value_map_.end(); it++) {
|
||||||
delete it->second;
|
delete it->second;
|
||||||
@@ -20,9 +17,7 @@ BaseEventMetric::~BaseEventMetric() {
|
|||||||
|
|
||||||
void BaseEventMetric::Record(const std::string& key, double value) {
|
void BaseEventMetric::Record(const std::string& key, double value) {
|
||||||
std::unique_lock<std::mutex> lock(internal_lock_);
|
std::unique_lock<std::mutex> lock(internal_lock_);
|
||||||
|
|
||||||
Distribution* distribution;
|
Distribution* distribution;
|
||||||
|
|
||||||
if (value_map_.find(key) == value_map_.end()) {
|
if (value_map_.find(key) == value_map_.end()) {
|
||||||
distribution = new Distribution();
|
distribution = new Distribution();
|
||||||
value_map_[key] = distribution;
|
value_map_[key] = distribution;
|
||||||
@@ -32,6 +27,5 @@ void BaseEventMetric::Record(const std::string& key, double value) {
|
|||||||
|
|
||||||
distribution->Record(value);
|
distribution->Record(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// Copyright 2016 Google Inc. All Rights Reserved.
|
// Copyright 2016 Google LLC. All Rights Reserved. This file and proprietary
|
||||||
|
// source code may only be used and distributed under the Widevine License
|
||||||
|
// Agreement.
|
||||||
#include "metrics_collections.h"
|
#include "metrics_collections.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -7,13 +8,13 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "wv_metrics.pb.h"
|
#include "wv_metrics.pb.h"
|
||||||
|
|
||||||
|
namespace wvcdm {
|
||||||
|
namespace metrics {
|
||||||
using ::drm_metrics::Attributes;
|
using ::drm_metrics::Attributes;
|
||||||
using ::drm_metrics::WvCdmMetrics;
|
using ::drm_metrics::WvCdmMetrics;
|
||||||
using ::google::protobuf::RepeatedPtrField;
|
using ::google::protobuf::RepeatedPtrField;
|
||||||
using ::wvcdm::metrics::EventMetric;
|
using ::wvcdm::metrics::EventMetric;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Helper struct for comparing session ids.
|
// Helper struct for comparing session ids.
|
||||||
struct CompareSessionIds {
|
struct CompareSessionIds {
|
||||||
const std::string& target_;
|
const std::string& target_;
|
||||||
@@ -25,11 +26,7 @@ struct CompareSessionIds {
|
|||||||
return metrics->GetSessionId() == target_;
|
return metrics->GetSessionId() == target_;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} // namespace
|
||||||
} // anonymous namespace
|
|
||||||
|
|
||||||
namespace wvcdm {
|
|
||||||
namespace metrics {
|
|
||||||
|
|
||||||
void CryptoMetrics::Serialize(
|
void CryptoMetrics::Serialize(
|
||||||
WvCdmMetrics::CryptoMetrics* crypto_metrics) const {
|
WvCdmMetrics::CryptoMetrics* crypto_metrics) const {
|
||||||
@@ -458,6 +455,5 @@ void EngineMetrics::SerializeEngineMetrics(
|
|||||||
|
|
||||||
crypto_metrics_.Serialize(engine_metrics->mutable_crypto_metrics());
|
crypto_metrics_.Serialize(engine_metrics->mutable_crypto_metrics());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
// Copyright 2017 Google LLC. All Rights Reserved. This file and proprietary
|
||||||
|
// source code may only be used and distributed under the Widevine License
|
||||||
|
// Agreement.
|
||||||
#include "timer_metric.h"
|
#include "timer_metric.h"
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
void TimerMetric::Start() {
|
void TimerMetric::Start() {
|
||||||
start_ = clock_.now();
|
start_ = clock_.now();
|
||||||
is_started_ = true;
|
is_started_ = true;
|
||||||
@@ -17,6 +19,5 @@ double TimerMetric::AsMs() const {
|
|||||||
double TimerMetric::AsUs() const {
|
double TimerMetric::AsUs() const {
|
||||||
return (clock_.now() - start_) / std::chrono::microseconds(1);
|
return (clock_.now() - start_) / std::chrono::microseconds(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
// 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.
|
||||||
//
|
//
|
||||||
// This file contains the specializations for helper methods for the
|
// This file contains the specializations for helper methods for the
|
||||||
// ValueMetric class.
|
// ValueMetric class.
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "value_metric.h"
|
#include "value_metric.h"
|
||||||
|
|
||||||
#include "OEMCryptoCENC.h"
|
#include "OEMCryptoCENC.h"
|
||||||
@@ -14,9 +12,7 @@
|
|||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void SetValue<int>(drm_metrics::ValueMetric* value_proto, const int& value) {
|
void SetValue<int>(drm_metrics::ValueMetric* value_proto, const int& value) {
|
||||||
value_proto->set_int_value(value);
|
value_proto->set_int_value(value);
|
||||||
@@ -106,7 +102,6 @@ void SetValue<std::string>(drm_metrics::ValueMetric* value_proto,
|
|||||||
const std::string& value) {
|
const std::string& value) {
|
||||||
value_proto->set_string_value(value);
|
value_proto->set_string_value(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace impl
|
} // namespace impl
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// 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.
|
||||||
//
|
//
|
||||||
// This file contains a proto definition for serialization of metrics data.
|
// This file contains a proto definition for serialization of metrics data.
|
||||||
//
|
//
|
||||||
@@ -15,10 +17,7 @@ option optimize_for = LITE_RUNTIME;
|
|||||||
// want to count all of the operations with a give error code.
|
// want to count all of the operations with a give error code.
|
||||||
message Attributes {
|
message Attributes {
|
||||||
// Reserved for compatibility with logging proto.
|
// Reserved for compatibility with logging proto.
|
||||||
// TODO(blueeyes): The reserved keyword is not supported in the older version
|
reserved 8, 10 to 13;
|
||||||
// of protoc in the CE CDM third_party directory. Uncomment the reserved
|
|
||||||
// line when we upgrade. b/67016366.
|
|
||||||
// reserved 8, 10 to 13;
|
|
||||||
|
|
||||||
// The error code. See CdmResponseType in wv_cdm_types.h
|
// The error code. See CdmResponseType in wv_cdm_types.h
|
||||||
optional int32 error_code = 1;
|
optional int32 error_code = 1;
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
// 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 CounterMetric
|
// Unit tests for CounterMetric
|
||||||
|
|
||||||
#include "counter_metric.h"
|
#include "counter_metric.h"
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include <gtest/gtest.h>
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "string_conversions.h"
|
|
||||||
|
|
||||||
using drm_metrics::TestMetrics;
|
#include "pow2bucket.h"
|
||||||
using testing::IsNull;
|
#include "string_conversions.h"
|
||||||
using testing::NotNull;
|
#include "wv_cdm_types.h"
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
using drm_metrics::TestMetrics;
|
||||||
|
|
||||||
TEST(CounterMetricTest, NoFieldsEmpty) {
|
TEST(CounterMetricTest, NoFieldsEmpty) {
|
||||||
wvcdm::metrics::CounterMetric<> metric;
|
wvcdm::metrics::CounterMetric<> metric;
|
||||||
@@ -126,6 +126,5 @@ TEST(CounterMetricTest, FourFieldsSuccess) {
|
|||||||
EXPECT_EQ(kLevel3,
|
EXPECT_EQ(kLevel3,
|
||||||
metric_proto.test_counters(0).attributes().security_level());
|
metric_proto.test_counters(0).attributes().security_level());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
// 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 Distribution.
|
// Unit tests for Distribution.
|
||||||
|
|
||||||
#include <float.h>
|
|
||||||
|
|
||||||
#include "distribution.h"
|
#include "distribution.h"
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include <float.h>
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
TEST(DistributionTest, NoValuesRecorded) {
|
TEST(DistributionTest, NoValuesRecorded) {
|
||||||
Distribution distribution;
|
Distribution distribution;
|
||||||
EXPECT_EQ(FLT_MAX, distribution.Min());
|
EXPECT_EQ(FLT_MAX, distribution.Min());
|
||||||
@@ -41,6 +42,5 @@ TEST(DistributionTest, MultipleValuesRecorded) {
|
|||||||
EXPECT_EQ(3u, distribution.Count());
|
EXPECT_EQ(3u, distribution.Count());
|
||||||
EXPECT_NEAR(16.6667, distribution.Variance(), 0.0001);
|
EXPECT_NEAR(16.6667, distribution.Variance(), 0.0001);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
// 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
|
// Unit tests for EventMetric
|
||||||
|
|
||||||
#include "event_metric.h"
|
#include "event_metric.h"
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include <gtest/gtest.h>
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "string_conversions.h"
|
|
||||||
|
|
||||||
using drm_metrics::TestMetrics;
|
#include "string_conversions.h"
|
||||||
using testing::IsNull;
|
#include "wv_cdm_types.h"
|
||||||
using testing::NotNull;
|
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
using drm_metrics::TestMetrics;
|
||||||
|
|
||||||
class EventMetricTest : public ::testing::Test {
|
class EventMetricTest : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
@@ -191,6 +190,5 @@ TEST_F(EventMetricTest, Pow2BucketTest) {
|
|||||||
value << Pow2Bucket(0x7FFFFFFF);
|
value << Pow2Bucket(0x7FFFFFFF);
|
||||||
EXPECT_EQ("1073741824", value.str());
|
EXPECT_EQ("1073741824", value.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,24 +1,20 @@
|
|||||||
// 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 the metrics collections,
|
// Unit tests for the metrics collections,
|
||||||
// EngineMetrics, SessionMetrics and CrytpoMetrics.
|
// EngineMetrics, SessionMetrics and CrytpoMetrics.
|
||||||
|
|
||||||
#include "metrics_collections.h"
|
#include "metrics_collections.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
|
||||||
#include "google/protobuf/text_format.h"
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "wv_cdm_types.h"
|
#include "wv_cdm_types.h"
|
||||||
#include "wv_metrics.pb.h"
|
#include "wv_metrics.pb.h"
|
||||||
|
|
||||||
using drm_metrics::MetricsGroup;
|
|
||||||
using google::protobuf::TextFormat;
|
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
using drm_metrics::MetricsGroup;
|
||||||
|
|
||||||
// TODO(blueeyes): Improve this implementation by supporting full message
|
// TODO(blueeyes): Improve this implementation by supporting full message
|
||||||
// API In CDM. That allows us to use MessageDifferencer.
|
// API In CDM. That allows us to use MessageDifferencer.
|
||||||
@@ -432,6 +428,5 @@ TEST_F(CryptoMetricsTest, AllCryptoMetrics) {
|
|||||||
// No subgroups should exist.
|
// No subgroups should exist.
|
||||||
EXPECT_EQ(0, actual_metrics.metric_sub_group_size());
|
EXPECT_EQ(0, actual_metrics.metric_sub_group_size());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,30 +1,27 @@
|
|||||||
// 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 the metrics collections,
|
// Unit tests for the metrics collections,
|
||||||
// EngineMetrics, SessionMetrics and CryptoMetrics.
|
// EngineMetrics, SessionMetrics and CryptoMetrics.
|
||||||
|
|
||||||
#include "metrics_collections.h"
|
#include "metrics_collections.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "device_files.h"
|
#include "device_files.h"
|
||||||
#include "gmock/gmock.h"
|
|
||||||
#include "google/protobuf/text_format.h"
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "string_conversions.h"
|
#include "string_conversions.h"
|
||||||
#include "wv_cdm_types.h"
|
#include "wv_cdm_types.h"
|
||||||
#include "wv_metrics.pb.h"
|
#include "wv_metrics.pb.h"
|
||||||
|
|
||||||
|
namespace wvcdm {
|
||||||
|
namespace metrics {
|
||||||
using drm_metrics::WvCdmMetrics;
|
using drm_metrics::WvCdmMetrics;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const char kSessionId1[] = "session_id_1";
|
const char kSessionId1[] = "session_id_1";
|
||||||
const char kSessionId2[] = "session_id_2";
|
const char kSessionId2[] = "session_id_2";
|
||||||
} // anonymous namespace
|
} // namespace
|
||||||
|
|
||||||
namespace wvcdm {
|
|
||||||
namespace metrics {
|
|
||||||
|
|
||||||
// TODO(blueeyes): Improve this implementation by supporting full message
|
// TODO(blueeyes): Improve this implementation by supporting full message
|
||||||
// API In CDM. That allows us to use MessageDifferencer.
|
// API In CDM. That allows us to use MessageDifferencer.
|
||||||
@@ -538,6 +535,5 @@ TEST_F(CryptoMetricsTest, AllCryptoMetrics) {
|
|||||||
EXPECT_EQ(321,
|
EXPECT_EQ(321,
|
||||||
actual.oemcrypto_maximum_usage_table_header_size().int_value());
|
actual.oemcrypto_maximum_usage_table_header_size().int_value());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
// 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 ValueMetric.
|
// Unit tests for ValueMetric.
|
||||||
|
#include "value_metric.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "value_metric.h"
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "wv_metrics.pb.h"
|
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
namespace metrics {
|
namespace metrics {
|
||||||
|
|
||||||
TEST(ValueMetricTest, StringValue) {
|
TEST(ValueMetricTest, StringValue) {
|
||||||
ValueMetric<std::string> metric;
|
ValueMetric<std::string> metric;
|
||||||
metric.Record("foo");
|
metric.Record("foo");
|
||||||
@@ -59,6 +57,5 @@ TEST(ValueMetricTest, SetError) {
|
|||||||
ASSERT_EQ(7, metric_proto->error_code());
|
ASSERT_EQ(7, metric_proto->error_code());
|
||||||
ASSERT_FALSE(metric_proto->has_int_value());
|
ASSERT_FALSE(metric_proto->has_int_value());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metrics
|
} // namespace metrics
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
Reference in New Issue
Block a user