OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "chromecast/base/metrics/cast_metrics_test_helper.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/macros.h" |
| 9 #include "chromecast/base/metrics/cast_metrics_helper.h" |
| 10 |
| 11 namespace chromecast { |
| 12 namespace metrics { |
| 13 |
| 14 namespace { |
| 15 |
| 16 class CastMetricsHelperStub : public CastMetricsHelper { |
| 17 public: |
| 18 CastMetricsHelperStub(); |
| 19 virtual ~CastMetricsHelperStub(); |
| 20 |
| 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; |
| 34 |
| 35 private: |
| 36 DISALLOW_COPY_AND_ASSIGN(CastMetricsHelperStub); |
| 37 }; |
| 38 |
| 39 bool stub_instance_exists = false; |
| 40 |
| 41 CastMetricsHelperStub::CastMetricsHelperStub() |
| 42 : CastMetricsHelper() { |
| 43 DCHECK(!stub_instance_exists); |
| 44 stub_instance_exists = true; |
| 45 } |
| 46 |
| 47 CastMetricsHelperStub::~CastMetricsHelperStub() { |
| 48 DCHECK(stub_instance_exists); |
| 49 stub_instance_exists = false; |
| 50 } |
| 51 |
| 52 void CastMetricsHelperStub::TagAppStart(const std::string& arg_app_name) { |
| 53 } |
| 54 |
| 55 void CastMetricsHelperStub::LogMediaPlay() { |
| 56 } |
| 57 |
| 58 void CastMetricsHelperStub::LogMediaPause() { |
| 59 } |
| 60 |
| 61 void CastMetricsHelperStub::LogTimeToDisplayVideo() { |
| 62 } |
| 63 |
| 64 void CastMetricsHelperStub::LogTimeToBufferAv(BufferingType buffering_type, |
| 65 base::TimeDelta time) { |
| 66 } |
| 67 |
| 68 void CastMetricsHelperStub::ResetVideoFrameSampling() { |
| 69 } |
| 70 |
| 71 void CastMetricsHelperStub::LogFramesPer5Seconds(int displayed_frames, |
| 72 int dropped_frames, |
| 73 int delayed_frames, |
| 74 int error_frames) { |
| 75 } |
| 76 |
| 77 std::string CastMetricsHelperStub::GetMetricsNameWithAppName( |
| 78 const std::string& prefix, |
| 79 const std::string& suffix) const { |
| 80 return ""; |
| 81 } |
| 82 |
| 83 void CastMetricsHelperStub::SetMetricsSink(MetricsSink* delegate) { |
| 84 } |
| 85 |
| 86 } // namespace |
| 87 |
| 88 void InitializeMetricsHelperForTesting() { |
| 89 if (!stub_instance_exists) { |
| 90 new CastMetricsHelperStub(); |
| 91 } |
| 92 } |
| 93 |
| 94 } // namespace metrics |
| 95 } // namespace chromecast |
OLD | NEW |