Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chromecast / base / metrics / cast_metrics_test_helper.cc
blob7344b1a05231e51b60608ff30951ffe783c423b4
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 LogTimeToBufferAv(BufferingType buffering_type,
27 base::TimeDelta time) override;
28 std::string GetMetricsNameWithAppName(
29 const std::string& prefix, const std::string& suffix) const override;
30 void SetMetricsSink(MetricsSink* delegate) override;
32 private:
33 DISALLOW_COPY_AND_ASSIGN(CastMetricsHelperStub);
36 bool stub_instance_exists = false;
38 CastMetricsHelperStub::CastMetricsHelperStub()
39 : CastMetricsHelper() {
40 DCHECK(!stub_instance_exists);
41 stub_instance_exists = true;
44 CastMetricsHelperStub::~CastMetricsHelperStub() {
45 DCHECK(stub_instance_exists);
46 stub_instance_exists = false;
49 void CastMetricsHelperStub::UpdateCurrentAppInfo(
50 const std::string& app_id,
51 const std::string& session_id) {
54 void CastMetricsHelperStub::UpdateSDKInfo(const std::string& sdk_version) {
57 void CastMetricsHelperStub::LogMediaPlay() {
60 void CastMetricsHelperStub::LogMediaPause() {
63 void CastMetricsHelperStub::LogTimeToBufferAv(BufferingType buffering_type,
64 base::TimeDelta time) {
67 std::string CastMetricsHelperStub::GetMetricsNameWithAppName(
68 const std::string& prefix,
69 const std::string& suffix) const {
70 return "";
73 void CastMetricsHelperStub::SetMetricsSink(MetricsSink* delegate) {
76 } // namespace
78 void InitializeMetricsHelperForTesting() {
79 if (!stub_instance_exists) {
80 new CastMetricsHelperStub();
84 } // namespace metrics
85 } // namespace chromecast