Files
android/libwvdrmengine/cdm/core/test/mock_clock.h
Rahul Frias 6a1f050ffc Update Widevine Copyright header for core CDM
[ Merge of http://go/wvgerrit/108064 ]

The Widevine License Agreement has been renamed to use inclusive
language. This covers files in the core directory.

Bug: 168562298
Test: verified compilation (comment only change)
Change-Id: I8ae5a10cbfdf7faae6a2735e57b33729763f10b8
2020-10-21 12:05:05 -07:00

33 lines
859 B
C++

// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
#ifndef CDM_TEST_MOCK_CLOCK_H_
#define CDM_TEST_MOCK_CLOCK_H_
#include "clock.h"
#include <gmock/gmock.h>
namespace wvcdm {
class MockClock : public Clock {
public:
MOCK_METHOD0(GetCurrentTime, int64_t());
};
// Frozen clock will always return the same value for the current time.
// Intended to be used for testing where using the actual time would
// cause flaky tests.
class FrozenClock : public Clock {
int64_t always_time_;
public:
FrozenClock(int64_t always_time = 0) : always_time_(always_time) {}
int64_t GetCurrentTime() override { return always_time_; }
void SetTime(int64_t new_time) { always_time_ = new_time; }
};
} // wvcdm
#endif // CDM_TEST_MOCK_CLOCK_H_