Fix breakages in https://codereview.chromium.org/1155713003/
[chromium-blink-merge.git] / chromecast / base / metrics / cast_metrics_test_helper.cc
blobc78abe10409bf66563c9b75a2c8c600f99849f8e
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromecast/base/metrics/cast_metrics_test_helper.h"
7 #include "base/logging.h"
8 #include "base/macros.h"
9 #include "chromecast/base/metrics/cast_metrics_helper.h"
11 namespace chromecast {
12 namespace metrics {
14 namespace {
16 class CastMetricsHelperStub : public CastMetricsHelper {
17 public:
18 CastMetricsHelperStub();
19 ~CastMetricsHelperStub() override;
21 void UpdateCurrentAppInfo(const std::string& app_id,
22 const std::string& session_id) override;
23 void UpdateSDKInfo(const std::string& sdk_version) override;
24 void LogMediaPlay() override;
25 void LogMediaPause() override;
26 void LogTimeToDisplayVideo() override;
27 void LogTimeToBufferAv(BufferingType buffering_type,
28 base::TimeDelta time) override;
29 void ResetVideoFrameSampling() override;
30 void LogFramesPer5Seconds(
31 int displayed_frames, int dropped_frames,
32 int delayed_frames, int error_frames) override;
33 std::string GetMetricsNameWithAppName(
34 const std::string& prefix, const std::string& suffix) const override;
35 void SetMetricsSink(MetricsSink* delegate) override;
37 private:
38 DISALLOW_COPY_AND_ASSIGN(CastMetricsHelperStub);
41 bool stub_instance_exists = false;
43 CastMetricsHelperStub::CastMetricsHelperStub()
44 : CastMetricsHelper() {
45 DCHECK(!stub_instance_exists);
46 stub_instance_exists = true;
49 CastMetricsHelperStub::~CastMetricsHelperStub() {
50 DCHECK(stub_instance_exists);
51 stub_instance_exists = false;
54 void CastMetricsHelperStub::UpdateCurrentAppInfo(
55 const std::string& app_id,
56 const std::string& session_id) {
59 void CastMetricsHelperStub::UpdateSDKInfo(const std::string& sdk_version) {
62 void CastMetricsHelperStub::LogMediaPlay() {
65 void CastMetricsHelperStub::LogMediaPause() {
68 void CastMetricsHelperStub::LogTimeToDisplayVideo() {
71 void CastMetricsHelperStub::LogTimeToBufferAv(BufferingType buffering_type,
72 base::TimeDelta time) {
75 void CastMetricsHelperStub::ResetVideoFrameSampling() {
78 void CastMetricsHelperStub::LogFramesPer5Seconds(int displayed_frames,
79 int dropped_frames,
80 int delayed_frames,
81 int error_frames) {
84 std::string CastMetricsHelperStub::GetMetricsNameWithAppName(
85 const std::string& prefix,
86 const std::string& suffix) const {
87 return "";
90 void CastMetricsHelperStub::SetMetricsSink(MetricsSink* delegate) {
93 } // namespace
95 void InitializeMetricsHelperForTesting() {
96 if (!stub_instance_exists) {
97 new CastMetricsHelperStub();
101 } // namespace metrics
102 } // namespace chromecast