Commit a92f9f0c authored by esum's avatar esum Committed by Commit bot

[Chromecast] Add mock implementation of CastMetricsHelper.

It will be used in multiple places to unit tests metrics recording,
so a separate file has been created rather than having every test
define its own.

BUG=internal b/33482814

Review-Url: https://codereview.chromium.org/2563073002
Cr-Commit-Position: refs/heads/master@{#438036}
parent bdbdbcbe
...@@ -22,6 +22,8 @@ source_set("test_support") { ...@@ -22,6 +22,8 @@ source_set("test_support") {
sources = [ sources = [
"cast_metrics_test_helper.cc", "cast_metrics_test_helper.cc",
"cast_metrics_test_helper.h", "cast_metrics_test_helper.h",
"mock_cast_metrics_helper.cc",
"mock_cast_metrics_helper.h",
] ]
public_deps = [ public_deps = [
...@@ -30,5 +32,6 @@ source_set("test_support") { ...@@ -30,5 +32,6 @@ source_set("test_support") {
deps = [ deps = [
"//base", "//base",
"//testing/gmock",
] ]
} }
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/base/metrics/mock_cast_metrics_helper.h"
namespace chromecast {
namespace metrics {
MockCastMetricsHelper::MockCastMetricsHelper() = default;
MockCastMetricsHelper::~MockCastMetricsHelper() = default;
} // namespace metrics
} // namespace chromecast
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_BASE_METRICS_MOCK_CAST_METRICS_HELPER_H_
#define CHROMECAST_BASE_METRICS_MOCK_CAST_METRICS_HELPER_H_
#include "base/macros.h"
#include "chromecast/base/metrics/cast_metrics_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace chromecast {
namespace metrics {
class MockCastMetricsHelper : public CastMetricsHelper {
public:
MockCastMetricsHelper();
~MockCastMetricsHelper() override;
MOCK_METHOD2(UpdateCurrentAppInfo,
void(const std::string& app_id, const std::string& session_id));
MOCK_METHOD1(UpdateSDKInfo, void(const std::string& sdk_version));
MOCK_METHOD0(LogMediaPlay, void());
MOCK_METHOD0(LogMediaPause, void());
MOCK_METHOD1(RecordSimpleAction, void(const std::string& action));
MOCK_METHOD2(RecordEventWithValue,
void(const std::string& action, int value));
MOCK_METHOD1(RecordApplicationEvent, void(const std::string& event));
MOCK_METHOD2(RecordApplicationEventWithValue,
void(const std::string& event, int value));
MOCK_METHOD0(LogTimeToFirstPaint, void());
MOCK_METHOD0(LogTimeToFirstAudio, void());
MOCK_METHOD2(LogTimeToBufferAv,
void(BufferingType buffering_type, base::TimeDelta time));
MOCK_CONST_METHOD2(GetMetricsNameWithAppName,
std::string(const std::string& prefix,
const std::string& suffix));
MOCK_METHOD1(SetMetricsSink, void(MetricsSink* delegate));
MOCK_METHOD1(SetRecordActionCallback,
void(const RecordActionCallback& callback));
private:
DISALLOW_COPY_AND_ASSIGN(MockCastMetricsHelper);
};
} // namespace metrics
} // namespace chromecast
#endif // CHROMECAST_BASE_METRICS_MOCK_CAST_METRICS_HELPER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment