Roll leveldb 3f7758:803d69 (v1.17 -> v1.18)
[chromium-blink-merge.git] / chromecast / base / metrics / cast_metrics_test_helper.cc
blob6aa2a86a6c84c9180b80321ba2040a3ebabc10c6
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 virtual ~CastMetricsHelperStub();
21 virtual void TagAppStart(const std::string& arg_app_name) override;
22 virtual void LogMediaPlay() override;
23 virtual void LogMediaPause() override;
24 virtual void LogTimeToDisplayVideo() override;
25 virtual void LogTimeToBufferAv(BufferingType buffering_type,
26 base::TimeDelta time) override;
27 virtual void ResetVideoFrameSampling() override;
28 virtual void LogFramesPer5Seconds(
29 int displayed_frames, int dropped_frames,
30 int delayed_frames, int error_frames) override;
31 virtual std::string GetMetricsNameWithAppName(
32 const std::string& prefix, const std::string& suffix) const override;
33 virtual void SetMetricsSink(MetricsSink* delegate) override;
35 private:
36 DISALLOW_COPY_AND_ASSIGN(CastMetricsHelperStub);
39 bool stub_instance_exists = false;
41 CastMetricsHelperStub::CastMetricsHelperStub()
42 : CastMetricsHelper() {
43 DCHECK(!stub_instance_exists);
44 stub_instance_exists = true;
47 CastMetricsHelperStub::~CastMetricsHelperStub() {
48 DCHECK(stub_instance_exists);
49 stub_instance_exists = false;
52 void CastMetricsHelperStub::TagAppStart(const std::string& arg_app_name) {
55 void CastMetricsHelperStub::LogMediaPlay() {
58 void CastMetricsHelperStub::LogMediaPause() {
61 void CastMetricsHelperStub::LogTimeToDisplayVideo() {
64 void CastMetricsHelperStub::LogTimeToBufferAv(BufferingType buffering_type,
65 base::TimeDelta time) {
68 void CastMetricsHelperStub::ResetVideoFrameSampling() {
71 void CastMetricsHelperStub::LogFramesPer5Seconds(int displayed_frames,
72 int dropped_frames,
73 int delayed_frames,
74 int error_frames) {
77 std::string CastMetricsHelperStub::GetMetricsNameWithAppName(
78 const std::string& prefix,
79 const std::string& suffix) const {
80 return "";
83 void CastMetricsHelperStub::SetMetricsSink(MetricsSink* delegate) {
86 } // namespace
88 void InitializeMetricsHelperForTesting() {
89 if (!stub_instance_exists) {
90 new CastMetricsHelperStub();
94 } // namespace metrics
95 } // namespace chromecast