SF: Set up libscheduler and libscheduler_test
Fix up dependencies to migrate Timer files for starters.
Bug: 185535769
Test: libscheduler_test
Change-Id: I028cb04f2e355e2096be9efe3c1a80f0dfd75602
diff --git a/services/surfaceflinger/tests/unittests/VSyncDispatchTimerQueueTest.cpp b/services/surfaceflinger/tests/unittests/VSyncDispatchTimerQueueTest.cpp
index ddc02bf..b7f968d 100644
--- a/services/surfaceflinger/tests/unittests/VSyncDispatchTimerQueueTest.cpp
+++ b/services/surfaceflinger/tests/unittests/VSyncDispatchTimerQueueTest.cpp
@@ -23,16 +23,19 @@
#define LOG_TAG "LibSurfaceFlingerUnittests"
#define LOG_NDEBUG 0
-#include "Scheduler/TimeKeeper.h"
-#include "Scheduler/VSyncDispatchTimerQueue.h"
-#include "Scheduler/VSyncTracker.h"
+#include <thread>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include <thread>
+
+#include <scheduler/TimeKeeper.h>
+
+#include "Scheduler/VSyncDispatchTimerQueue.h"
+#include "Scheduler/VSyncTracker.h"
using namespace testing;
using namespace std::literals;
+
namespace android::scheduler {
class MockVSyncTracker : public VSyncTracker {
@@ -71,10 +74,10 @@
ON_CALL(*this, now()).WillByDefault(Invoke(this, &ControllableClock::fakeTime));
}
- MOCK_CONST_METHOD0(now, nsecs_t());
- MOCK_METHOD2(alarmAt, void(std::function<void()> const&, nsecs_t time));
- MOCK_METHOD0(alarmCancel, void());
- MOCK_CONST_METHOD1(dump, void(std::string&));
+ MOCK_METHOD(nsecs_t, now, (), (const));
+ MOCK_METHOD(void, alarmAt, (std::function<void()>, nsecs_t), (override));
+ MOCK_METHOD(void, alarmCancel, (), (override));
+ MOCK_METHOD(void, dump, (std::string&), (const, override));
void alarmAtDefaultBehavior(std::function<void()> const& callback, nsecs_t time) {
mCallback = callback;
@@ -196,11 +199,14 @@
class TimeKeeperWrapper : public TimeKeeper {
public:
TimeKeeperWrapper(TimeKeeper& control) : mControllableClock(control) {}
- void alarmAt(std::function<void()> const& callback, nsecs_t time) final {
- mControllableClock.alarmAt(callback, time);
- }
- void alarmCancel() final { mControllableClock.alarmCancel(); }
+
nsecs_t now() const final { return mControllableClock.now(); }
+
+ void alarmAt(std::function<void()> callback, nsecs_t time) final {
+ mControllableClock.alarmAt(std::move(callback), time);
+ }
+
+ void alarmCancel() final { mControllableClock.alarmCancel(); }
void dump(std::string&) const final {}
private: