diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-10-07 16:57:34 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-10-07 16:57:34 +0000 |
commit | b288e591b5546b00c17dc78634c87aeee6af4746 (patch) | |
tree | 1bca85935788654055cf665af42a53634cef23bf /services/surfaceflinger/tests/unittests/mock | |
parent | 3ee6879e91eb132e0b24e2adefd4d8eae2491a62 (diff) | |
parent | 38afbfd13622e10b8e74b9c114fa05f30ba480bb (diff) | |
download | native-b288e591b5546b00c17dc78634c87aeee6af4746.tar.gz |
Snap for 7803083 from 38afbfd13622e10b8e74b9c114fa05f30ba480bb to mainline-tzdata2-release
Change-Id: Ic05c46aa04f9072b3dc93e023a17408956f14474
Diffstat (limited to 'services/surfaceflinger/tests/unittests/mock')
26 files changed, 392 insertions, 330 deletions
diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.cpp b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.cpp index 0780af1f26..7de187207e 100644 --- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.cpp +++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.cpp @@ -18,19 +18,16 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wconversion" +#define LOG_TAG "MockComposer" #include "mock/DisplayHardware/MockComposer.h" -namespace android { -namespace Hwc2 { -namespace mock { +namespace android::Hwc2::mock { // Explicit default instantiation is recommended. Composer::Composer() = default; Composer::~Composer() = default; -} // namespace mock -} // namespace Hwc2 -} // namespace android +} // namespace android::Hwc2::mock // TODO(b/129481165): remove the #pragma below and fix conversion issues #pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h index c2c5072b24..cb3bd73920 100644 --- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h +++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h @@ -24,8 +24,7 @@ namespace android { class GraphicBuffer; -namespace Hwc2 { -namespace mock { +namespace Hwc2::mock { using android::hardware::graphics::common::V1_0::ColorTransform; using android::hardware::graphics::common::V1_0::Transform; @@ -52,12 +51,11 @@ public: MOCK_METHOD0(getCapabilities, std::vector<IComposer::Capability>()); MOCK_METHOD0(dumpDebugInfo, std::string()); MOCK_METHOD1(registerCallback, void(const sp<IComposerCallback>&)); - MOCK_METHOD0(isRemote, bool()); MOCK_METHOD0(resetCommands, void()); MOCK_METHOD0(executeCommands, Error()); MOCK_METHOD0(getMaxVirtualDisplayCount, uint32_t()); - MOCK_CONST_METHOD0(isUsingVrComposer, bool()); - MOCK_METHOD4(createVirtualDisplay, Error(uint32_t, uint32_t, PixelFormat*, Display*)); + MOCK_METHOD5(createVirtualDisplay, + Error(uint32_t, uint32_t, PixelFormat*, std::optional<Display>, Display*)); MOCK_METHOD1(destroyVirtualDisplay, Error(Display)); MOCK_METHOD1(acceptDisplayChanges, Error(Display)); MOCK_METHOD2(createLayer, Error(Display, Layer* outLayer)); @@ -110,7 +108,6 @@ public: MOCK_METHOD3(setLayerVisibleRegion, Error(Display, Layer, const std::vector<IComposerClient::Rect>&)); MOCK_METHOD3(setLayerZOrder, Error(Display, Layer, uint32_t)); - MOCK_METHOD4(setLayerInfo, Error(Display, Layer, uint32_t, uint32_t)); MOCK_METHOD3(getRenderIntents, Error(Display, ColorMode, std::vector<RenderIntent>*)); MOCK_METHOD3(setLayerColorTransform, Error(Display, Layer, const float*)); MOCK_METHOD4(getDisplayedContentSamplingAttributes, @@ -143,6 +140,5 @@ public: MOCK_METHOD2(getClientTargetProperty, Error(Display, IComposerClient::ClientTargetProperty*)); }; -} // namespace mock -} // namespace Hwc2 +} // namespace Hwc2::mock } // namespace android diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockDisplay.h b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockDisplay.h deleted file mode 100644 index fe99e77158..0000000000 --- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockDisplay.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include <gmock/gmock.h> - -#include "DisplayHardware/HWC2.h" - -using android::HWC2::Layer; - -namespace android { -namespace Hwc2 { -namespace mock { - -namespace hal = android::hardware::graphics::composer::hal; - -class Display : public HWC2::Display { -public: - using Layer = ::Layer; - - Display(); - ~Display(); - - MOCK_CONST_METHOD0(getId, hal::HWDisplayId()); - MOCK_CONST_METHOD0(isConnected, bool()); - MOCK_METHOD1(setConnected, void(bool)); - MOCK_CONST_METHOD0(getCapabilities, const std::unordered_set<hal::DisplayCapability>&()); - - MOCK_METHOD0(acceptChanges, hal::Error()); - MOCK_METHOD1(createLayer, hal::Error(Layer**)); - MOCK_METHOD1(destroyLayer, hal::Error(Layer*)); - MOCK_CONST_METHOD1(getActiveConfig, hal::Error(std::shared_ptr<const Config>*)); - MOCK_CONST_METHOD1(getActiveConfigIndex, hal::Error(int* outIndex)); - MOCK_METHOD1(getChangedCompositionTypes, - hal::Error(std::unordered_map<Layer*, hal::Composition>*)); - MOCK_CONST_METHOD1(getColorModes, hal::Error(std::vector<hal::ColorMode>*)); - - MOCK_CONST_METHOD0(getSupportedPerFrameMetadata, int32_t()); - MOCK_CONST_METHOD2(getRenderIntents, - hal::Error(hal::ColorMode, std::vector<hal::RenderIntent>*)); - MOCK_METHOD2(getDataspaceSaturationMatrix, hal::Error(hal::Dataspace, android::mat4*)); - MOCK_CONST_METHOD0(getConfigs, std::vector<std::shared_ptr<const Config>>()); - - MOCK_CONST_METHOD1(getName, hal::Error(std::string*)); - MOCK_METHOD2(getRequests, - hal::Error(hal::DisplayRequest*, std::unordered_map<Layer*, hal::LayerRequest>*)); - MOCK_CONST_METHOD1(getType, hal::Error(hal::DisplayType*)); - MOCK_CONST_METHOD1(supportsDoze, hal::Error(bool*)); - MOCK_CONST_METHOD1(getHdrCapabilities, hal::Error(android::HdrCapabilities*)); - MOCK_CONST_METHOD3(getDisplayedContentSamplingAttributes, - hal::Error(hal::PixelFormat*, hal::Dataspace*, uint8_t*)); - MOCK_CONST_METHOD3(setDisplayContentSamplingEnabled, hal::Error(bool, uint8_t, uint64_t)); - MOCK_CONST_METHOD3(getDisplayedContentSample, - hal::Error(uint64_t, uint64_t, android::DisplayedFrameStats*)); - MOCK_CONST_METHOD1( - getReleaseFences, - hal::Error(std::unordered_map<Layer*, android::sp<android::Fence>>* outFences)); - MOCK_METHOD1(present, hal::Error(android::sp<android::Fence>*)); - MOCK_METHOD1(setActiveConfig, hal::Error(const std::shared_ptr<const HWC2::Display::Config>&)); - MOCK_METHOD4(setClientTarget, - hal::Error(uint32_t, const android::sp<android::GraphicBuffer>&, - const android::sp<android::Fence>&, hal::Dataspace)); - MOCK_METHOD2(setColorMode, hal::Error(hal::ColorMode, hal::RenderIntent)); - MOCK_METHOD2(setColorTransform, hal::Error(const android::mat4&, hal::ColorTransform)); - MOCK_METHOD2(setOutputBuffer, - hal::Error(const android::sp<android::GraphicBuffer>&, - const android::sp<android::Fence>&)); - MOCK_METHOD1(setPowerMode, hal::Error(hal::PowerMode)); - MOCK_METHOD1(setVsyncEnabled, hal::Error(hal::Vsync)); - MOCK_METHOD2(validate, hal::Error(uint32_t*, uint32_t*)); - MOCK_METHOD4(presentOrValidate, - hal::Error(uint32_t*, uint32_t*, android::sp<android::Fence>*, uint32_t*)); - MOCK_METHOD1(setDisplayBrightness, std::future<hal::Error>(float)); - MOCK_CONST_METHOD1(getDisplayVsyncPeriod, hal::Error(nsecs_t*)); - MOCK_METHOD3(setActiveConfigWithConstraints, - hal::Error(const std::shared_ptr<const HWC2::Display::Config>&, - const hal::VsyncPeriodChangeConstraints&, - hal::VsyncPeriodChangeTimeline*)); - MOCK_METHOD1(setAutoLowLatencyMode, hal::Error(bool on)); - MOCK_CONST_METHOD1(getSupportedContentTypes, hal::Error(std::vector<hal::ContentType>*)); - MOCK_METHOD1(setContentType, hal::Error(hal::ContentType)); - MOCK_METHOD1(getClientTargetProperty, hal::Error(hal::ClientTargetProperty*)); - MOCK_CONST_METHOD1(getConnectionType, hal::Error(android::DisplayConnectionType*)); - MOCK_CONST_METHOD0(isVsyncPeriodSwitchSupported, bool()); -}; - -} // namespace mock -} // namespace Hwc2 -} // namespace android diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockDisplay.cpp b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.cpp index 2ec37c1e76..2647bf4f9d 100644 --- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockDisplay.cpp +++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2019 The Android Open Source Project + * Copyright 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,16 +14,18 @@ * limitations under the License. */ -#include "mock/DisplayHardware/MockDisplay.h" +#undef LOG_TAG +#define LOG_TAG "MockHWC2" -namespace android { -namespace Hwc2 { -namespace mock { +#include "mock/DisplayHardware/MockHWC2.h" + +namespace android::HWC2::mock { // Explicit default instantiation is recommended. Display::Display() = default; Display::~Display() = default; -} // namespace mock -} // namespace Hwc2 -} // namespace android
\ No newline at end of file +Layer::Layer() = default; +Layer::~Layer() = default; + +} // namespace android::HWC2::mock diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.h b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.h new file mode 100644 index 0000000000..c3919d9310 --- /dev/null +++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.h @@ -0,0 +1,122 @@ +/* + * Copyright 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <gmock/gmock.h> + +#include "DisplayHardware/HWC2.h" + +namespace android::HWC2::mock { + +class Display : public HWC2::Display { +public: + Display(); + ~Display() override; + + MOCK_METHOD(hal::HWDisplayId, getId, (), (const, override)); + MOCK_METHOD(bool, isConnected, (), (const, override)); + MOCK_METHOD(void, setConnected, (bool), (override)); + MOCK_METHOD(const std::unordered_set<hal::DisplayCapability> &, getCapabilities, (), + (const, override)); + MOCK_METHOD(bool, isVsyncPeriodSwitchSupported, (), (const, override)); + MOCK_METHOD(void, onLayerDestroyed, (hal::HWLayerId), (override)); + + MOCK_METHOD(hal::Error, acceptChanges, (), (override)); + MOCK_METHOD((base::expected<std::shared_ptr<HWC2::Layer>, hal::Error>), createLayer, (), + (override)); + MOCK_METHOD(hal::Error, getChangedCompositionTypes, + ((std::unordered_map<Layer *, hal::Composition> *)), (override)); + MOCK_METHOD(hal::Error, getColorModes, (std::vector<hal::ColorMode> *), (const, override)); + MOCK_METHOD(int32_t, getSupportedPerFrameMetadata, (), (const, override)); + MOCK_METHOD(hal::Error, getRenderIntents, (hal::ColorMode, std::vector<hal::RenderIntent> *), + (const, override)); + MOCK_METHOD(hal::Error, getDataspaceSaturationMatrix, (hal::Dataspace, android::mat4 *), + (override)); + MOCK_METHOD(hal::Error, getName, (std::string *), (const, override)); + MOCK_METHOD(hal::Error, getRequests, + (hal::DisplayRequest *, (std::unordered_map<Layer *, hal::LayerRequest> *)), + (override)); + MOCK_METHOD(hal::Error, getConnectionType, (ui::DisplayConnectionType *), (const, override)); + MOCK_METHOD(hal::Error, supportsDoze, (bool *), (const, override)); + MOCK_METHOD(hal::Error, getHdrCapabilities, (android::HdrCapabilities *), (const, override)); + MOCK_METHOD(hal::Error, getDisplayedContentSamplingAttributes, + (hal::PixelFormat *, hal::Dataspace *, uint8_t *), (const, override)); + MOCK_METHOD(hal::Error, setDisplayContentSamplingEnabled, (bool, uint8_t, uint64_t), + (const, override)); + MOCK_METHOD(hal::Error, getDisplayedContentSample, + (uint64_t, uint64_t, android::DisplayedFrameStats *), (const, override)); + MOCK_METHOD(hal::Error, getReleaseFences, + ((std::unordered_map<Layer *, android::sp<android::Fence>> *)), (const, override)); + MOCK_METHOD(hal::Error, present, (android::sp<android::Fence> *), (override)); + MOCK_METHOD(hal::Error, setClientTarget, + (uint32_t, const android::sp<android::GraphicBuffer> &, + const android::sp<android::Fence> &, hal::Dataspace), + (override)); + MOCK_METHOD(hal::Error, setColorMode, (hal::ColorMode, hal::RenderIntent), (override)); + MOCK_METHOD(hal::Error, setColorTransform, (const android::mat4 &, hal::ColorTransform), + (override)); + MOCK_METHOD(hal::Error, setOutputBuffer, + (const android::sp<android::GraphicBuffer> &, const android::sp<android::Fence> &), + (override)); + MOCK_METHOD(hal::Error, setPowerMode, (hal::PowerMode), (override)); + MOCK_METHOD(hal::Error, setVsyncEnabled, (hal::Vsync), (override)); + MOCK_METHOD(hal::Error, validate, (uint32_t *, uint32_t *), (override)); + MOCK_METHOD(hal::Error, presentOrValidate, + (uint32_t *, uint32_t *, android::sp<android::Fence> *, uint32_t *), (override)); + MOCK_METHOD(std::future<hal::Error>, setDisplayBrightness, (float), (override)); + MOCK_METHOD(hal::Error, setActiveConfigWithConstraints, + (hal::HWConfigId, const hal::VsyncPeriodChangeConstraints &, + hal::VsyncPeriodChangeTimeline *), + (override)); + MOCK_METHOD(hal::Error, setAutoLowLatencyMode, (bool), (override)); + MOCK_METHOD(hal::Error, getSupportedContentTypes, (std::vector<hal::ContentType> *), + (const, override)); + MOCK_METHOD(hal::Error, setContentType, (hal::ContentType), (override)); + MOCK_METHOD(hal::Error, getClientTargetProperty, (hal::ClientTargetProperty *), (override)); +}; + +class Layer : public HWC2::Layer { +public: + Layer(); + ~Layer() override; + + MOCK_METHOD(hal::HWLayerId, getId, (), (const, override)); + MOCK_METHOD(hal::Error, setCursorPosition, (int32_t, int32_t), (override)); + MOCK_METHOD(hal::Error, setBuffer, + (uint32_t, const android::sp<android::GraphicBuffer> &, + const android::sp<android::Fence> &), + (override)); + MOCK_METHOD(hal::Error, setSurfaceDamage, (const android::Region &), (override)); + MOCK_METHOD(hal::Error, setBlendMode, (hal::BlendMode), (override)); + MOCK_METHOD(hal::Error, setColor, (hal::Color), (override)); + MOCK_METHOD(hal::Error, setCompositionType, (hal::Composition), (override)); + MOCK_METHOD(hal::Error, setDataspace, (android::ui::Dataspace), (override)); + MOCK_METHOD(hal::Error, setPerFrameMetadata, (const int32_t, const android::HdrMetadata &), + (override)); + MOCK_METHOD(hal::Error, setDisplayFrame, (const android::Rect &), (override)); + MOCK_METHOD(hal::Error, setPlaneAlpha, (float), (override)); + MOCK_METHOD(hal::Error, setSidebandStream, (const native_handle_t *), (override)); + MOCK_METHOD(hal::Error, setSourceCrop, (const android::FloatRect &), (override)); + MOCK_METHOD(hal::Error, setTransform, (hal::Transform), (override)); + MOCK_METHOD(hal::Error, setVisibleRegion, (const android::Region &), (override)); + MOCK_METHOD(hal::Error, setZOrder, (uint32_t), (override)); + MOCK_METHOD(hal::Error, setColorTransform, (const android::mat4 &), (override)); + MOCK_METHOD(hal::Error, setLayerGenericMetadata, + (const std::string &, bool, const std::vector<uint8_t> &), (override)); +}; + +} // namespace android::HWC2::mock diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerAdvisor.cpp b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerAdvisor.cpp index 8be707750b..1ba38a822a 100644 --- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerAdvisor.cpp +++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerAdvisor.cpp @@ -16,14 +16,10 @@ #include "MockPowerAdvisor.h" -namespace android { -namespace Hwc2 { -namespace mock { +namespace android::Hwc2::mock { // Explicit default instantiation is recommended. PowerAdvisor::PowerAdvisor() = default; PowerAdvisor::~PowerAdvisor() = default; -} // namespace mock -} // namespace Hwc2 -} // namespace android +} // namespace android::Hwc2::mock diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerAdvisor.h b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerAdvisor.h index e22d0cf74c..159bdf1c01 100644 --- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerAdvisor.h +++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockPowerAdvisor.h @@ -20,20 +20,18 @@ #include "DisplayHardware/PowerAdvisor.h" -namespace android { -namespace Hwc2 { -namespace mock { +namespace android::Hwc2::mock { class PowerAdvisor : public android::Hwc2::PowerAdvisor { public: PowerAdvisor(); ~PowerAdvisor() override; + MOCK_METHOD0(init, void()); MOCK_METHOD0(onBootFinished, void()); MOCK_METHOD2(setExpensiveRenderingExpected, void(DisplayId displayId, bool expected)); + MOCK_METHOD0(isUsingExpensiveRendering, bool()); MOCK_METHOD0(notifyDisplayUpdateImminent, void()); }; -} // namespace mock -} // namespace Hwc2 -} // namespace android +} // namespace android::Hwc2::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockDispSync.cpp b/services/surfaceflinger/tests/unittests/mock/MockDispSync.cpp deleted file mode 100644 index 1c8c44dca0..0000000000 --- a/services/surfaceflinger/tests/unittests/mock/MockDispSync.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mock/MockDispSync.h" -#include <thread> - -using namespace std::chrono_literals; -namespace android { -namespace mock { - -// Explicit default instantiation is recommended. -DispSync::DispSync() = default; -DispSync::~DispSync() = default; - -status_t DispSync::addEventListener(const char* /*name*/, nsecs_t phase, Callback* callback, - nsecs_t /*lastCallbackTime*/) { - if (mCallback.callback != nullptr) { - return BAD_VALUE; - } - - mCallback = {callback, phase}; - return NO_ERROR; -} -status_t DispSync::removeEventListener(Callback* callback, nsecs_t* /*outLastCallback*/) { - if (mCallback.callback != callback) { - return BAD_VALUE; - } - - mCallback = {nullptr, 0}; - return NO_ERROR; -} - -status_t DispSync::changePhaseOffset(Callback* callback, nsecs_t phase) { - if (mCallback.callback != callback) { - return BAD_VALUE; - } - - mCallback.phase = phase; - return NO_ERROR; -} - -void DispSync::triggerCallback() { - if (mCallback.callback == nullptr) return; - - const std::chrono::nanoseconds now = std::chrono::steady_clock::now().time_since_epoch(); - const auto expectedVSyncTime = now + 16ms; - mCallback.callback->onDispSyncEvent(now.count(), expectedVSyncTime.count()); -} - -} // namespace mock -} // namespace android diff --git a/services/surfaceflinger/tests/unittests/mock/MockDispSync.h b/services/surfaceflinger/tests/unittests/mock/MockDispSync.h deleted file mode 100644 index b39487ccc1..0000000000 --- a/services/surfaceflinger/tests/unittests/mock/MockDispSync.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include <gmock/gmock.h> - -#include "Scheduler/DispSync.h" - -namespace android { -namespace mock { - -class DispSync : public android::DispSync { -public: - DispSync(); - ~DispSync() override; - - MOCK_METHOD0(reset, void()); - MOCK_METHOD1(addPresentFence, bool(const std::shared_ptr<FenceTime>&)); - MOCK_METHOD0(beginResync, void()); - MOCK_METHOD3(addResyncSample, bool(nsecs_t, std::optional<nsecs_t>, bool*)); - MOCK_METHOD0(endResync, void()); - MOCK_METHOD1(setPeriod, void(nsecs_t)); - MOCK_METHOD0(getPeriod, nsecs_t()); - MOCK_METHOD0(getIntendedPeriod, nsecs_t()); - MOCK_METHOD1(setRefreshSkipCount, void(int)); - MOCK_CONST_METHOD2(computeNextRefresh, nsecs_t(int, nsecs_t)); - MOCK_METHOD1(setIgnorePresentFences, void(bool)); - MOCK_METHOD1(expectedPresentTime, nsecs_t(nsecs_t)); - - MOCK_CONST_METHOD1(dump, void(std::string&)); - - status_t addEventListener(const char* name, nsecs_t phase, Callback* callback, - nsecs_t lastCallbackTime) override; - status_t removeEventListener(Callback* callback, nsecs_t* outLastCallback) override; - status_t changePhaseOffset(Callback* callback, nsecs_t phase) override; - - nsecs_t getCallbackPhase() { return mCallback.phase; } - - void triggerCallback(); - -private: - struct CallbackType { - Callback* callback = nullptr; - nsecs_t phase; - }; - CallbackType mCallback; -}; - -} // namespace mock -} // namespace android diff --git a/services/surfaceflinger/tests/unittests/mock/MockEventThread.cpp b/services/surfaceflinger/tests/unittests/mock/MockEventThread.cpp index 408cd35f29..302dc01b23 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockEventThread.cpp +++ b/services/surfaceflinger/tests/unittests/mock/MockEventThread.cpp @@ -16,12 +16,10 @@ #include "mock/MockEventThread.h" -namespace android { -namespace mock { +namespace android::mock { // Explicit default instantiation is recommended. EventThread::EventThread() = default; EventThread::~EventThread() = default; -} // namespace mock -} // namespace android +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockEventThread.h b/services/surfaceflinger/tests/unittests/mock/MockEventThread.h index 054aaf8ae1..485b4acdce 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockEventThread.h +++ b/services/surfaceflinger/tests/unittests/mock/MockEventThread.h @@ -20,8 +20,7 @@ #include "Scheduler/EventThread.h" -namespace android { -namespace mock { +namespace android::mock { class EventThread : public android::EventThread { public: @@ -29,13 +28,18 @@ public: ~EventThread() override; MOCK_CONST_METHOD2(createEventConnection, - sp<EventThreadConnection>(ResyncCallback, ISurfaceComposer::ConfigChanged)); + sp<EventThreadConnection>(ResyncCallback, + ISurfaceComposer::EventRegistrationFlags)); MOCK_METHOD0(onScreenReleased, void()); MOCK_METHOD0(onScreenAcquired, void()); MOCK_METHOD2(onHotplugReceived, void(PhysicalDisplayId, bool)); - MOCK_METHOD3(onConfigChanged, void(PhysicalDisplayId, HwcConfigIndexType, nsecs_t)); + MOCK_METHOD3(onModeChanged, void(PhysicalDisplayId, DisplayModeId, nsecs_t)); + MOCK_METHOD2(onFrameRateOverridesChanged, + void(PhysicalDisplayId, std::vector<FrameRateOverride>)); MOCK_CONST_METHOD1(dump, void(std::string&)); - MOCK_METHOD1(setPhaseOffset, void(nsecs_t phaseOffset)); + MOCK_METHOD2(setDuration, + void(std::chrono::nanoseconds workDuration, + std::chrono::nanoseconds readyDuration)); MOCK_METHOD1(registerDisplayEventConnection, status_t(const sp<android::EventThreadConnection> &)); MOCK_METHOD2(setVsyncRate, void(uint32_t, const sp<android::EventThreadConnection> &)); @@ -45,5 +49,4 @@ public: MOCK_METHOD0(getEventThreadConnectionCount, size_t()); }; -} // namespace mock -} // namespace android +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockFrameTimeline.cpp b/services/surfaceflinger/tests/unittests/mock/MockFrameTimeline.cpp new file mode 100644 index 0000000000..ff005a0756 --- /dev/null +++ b/services/surfaceflinger/tests/unittests/mock/MockFrameTimeline.cpp @@ -0,0 +1,26 @@ +/* + * Copyright 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mock/MockFrameTimeline.h" + +namespace android::mock { + +// Explicit default instantiation is recommended. +FrameTimeline::FrameTimeline(std::shared_ptr<TimeStats> timeStats, pid_t surfaceFlingerPid) + : android::frametimeline::impl::FrameTimeline(timeStats, surfaceFlingerPid) {} +FrameTimeline::~FrameTimeline() = default; + +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockFrameTimeline.h b/services/surfaceflinger/tests/unittests/mock/MockFrameTimeline.h new file mode 100644 index 0000000000..5dc48c3703 --- /dev/null +++ b/services/surfaceflinger/tests/unittests/mock/MockFrameTimeline.h @@ -0,0 +1,41 @@ +/* + * Copyright 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <gmock/gmock.h> + +#include "FrameTimeline/FrameTimeline.h" + +namespace android::mock { + +class FrameTimeline : public android::frametimeline::impl::FrameTimeline { + // No need to create mocks for SurfaceFrame and TokenManager yet. They are very small components + // and do not have external dependencies like perfetto. +public: + FrameTimeline(std::shared_ptr<TimeStats> timeStats, pid_t surfaceFlingerPid); + ~FrameTimeline(); + + MOCK_METHOD0(onBootFinished, void()); + MOCK_METHOD1(addSurfaceFrame, void(std::shared_ptr<frametimeline::SurfaceFrame>)); + MOCK_METHOD3(setSfWakeUp, void(int64_t, nsecs_t, Fps)); + MOCK_METHOD3(setSfPresent, + void(nsecs_t, const std::shared_ptr<FenceTime>&, + const std::shared_ptr<FenceTime>&)); + MOCK_METHOD1(computeFps, float(const std::unordered_set<int32_t>&)); +}; + +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockFrameTracer.cpp b/services/surfaceflinger/tests/unittests/mock/MockFrameTracer.cpp index 358dfdb856..417dcb0869 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockFrameTracer.cpp +++ b/services/surfaceflinger/tests/unittests/mock/MockFrameTracer.cpp @@ -16,12 +16,10 @@ #include "mock/MockFrameTracer.h" -namespace android { -namespace mock { +namespace android::mock { // Explicit default instantiation is recommended. FrameTracer::FrameTracer() = default; FrameTracer::~FrameTracer() = default; -} // namespace mock -} // namespace android +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockFrameTracer.h b/services/surfaceflinger/tests/unittests/mock/MockFrameTracer.h index f768b8114d..305cb1c7c6 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockFrameTracer.h +++ b/services/surfaceflinger/tests/unittests/mock/MockFrameTracer.h @@ -20,8 +20,7 @@ #include "FrameTracer/FrameTracer.h" -namespace android { -namespace mock { +namespace android::mock { class FrameTracer : public android::FrameTracer { public: @@ -39,5 +38,4 @@ public: MOCK_METHOD0(miniDump, std::string()); }; -} // namespace mock -} // namespace android +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockLayer.h b/services/surfaceflinger/tests/unittests/mock/MockLayer.h index 078d8e07f7..ba2e4db0fa 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockLayer.h +++ b/services/surfaceflinger/tests/unittests/mock/MockLayer.h @@ -33,6 +33,7 @@ public: MOCK_CONST_METHOD0(isVisible, bool()); MOCK_METHOD0(createClone, sp<Layer>()); MOCK_CONST_METHOD0(getFrameRateForLayerTree, FrameRate()); + MOCK_CONST_METHOD0(getOwnerUid, uid_t()); }; } // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockMessageQueue.h b/services/surfaceflinger/tests/unittests/mock/MockMessageQueue.h index a82b583d6a..0e7b320787 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockMessageQueue.h +++ b/services/surfaceflinger/tests/unittests/mock/MockMessageQueue.h @@ -18,6 +18,7 @@ #include <gmock/gmock.h> +#include "FrameTimeline.h" #include "Scheduler/EventThread.h" #include "Scheduler/MessageQueue.h" @@ -29,11 +30,16 @@ public: ~MessageQueue() override; MOCK_METHOD1(init, void(const sp<SurfaceFlinger>&)); - MOCK_METHOD1(setEventConnection, void(const sp<EventThreadConnection>& connection)); + MOCK_METHOD1(setInjector, void(sp<EventThreadConnection>)); MOCK_METHOD0(waitMessage, void()); MOCK_METHOD1(postMessage, void(sp<MessageHandler>&&)); MOCK_METHOD0(invalidate, void()); MOCK_METHOD0(refresh, void()); + MOCK_METHOD3(initVsync, + void(scheduler::VSyncDispatch&, frametimeline::TokenManager&, + std::chrono::nanoseconds)); + MOCK_METHOD1(setDuration, void(std::chrono::nanoseconds workDuration)); + MOCK_METHOD0(nextExpectedInvalidate, std::optional<std::chrono::steady_clock::time_point>()); }; } // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockSchedulerCallback.h b/services/surfaceflinger/tests/unittests/mock/MockSchedulerCallback.h new file mode 100644 index 0000000000..ab19886755 --- /dev/null +++ b/services/surfaceflinger/tests/unittests/mock/MockSchedulerCallback.h @@ -0,0 +1,44 @@ +/* + * Copyright 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <gmock/gmock.h> + +#include "Scheduler/Scheduler.h" + +namespace android::mock { + +struct SchedulerCallback final : ISchedulerCallback { + MOCK_METHOD1(setVsyncEnabled, void(bool)); + MOCK_METHOD2(changeRefreshRate, + void(const scheduler::RefreshRateConfigs::RefreshRate&, + scheduler::RefreshRateConfigEvent)); + MOCK_METHOD0(repaintEverythingForHWC, void()); + MOCK_METHOD1(kernelTimerChanged, void(bool)); + MOCK_METHOD0(triggerOnFrameRateOverridesChanged, void()); +}; + +struct NoOpSchedulerCallback final : ISchedulerCallback { + void setVsyncEnabled(bool) override {} + void changeRefreshRate(const scheduler::RefreshRateConfigs::RefreshRate&, + scheduler::RefreshRateConfigEvent) override {} + void repaintEverythingForHWC() override {} + void kernelTimerChanged(bool) override {} + void triggerOnFrameRateOverridesChanged() {} +}; + +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.cpp b/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.cpp index 7e925b94ee..0a0e7b5861 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.cpp +++ b/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.cpp @@ -20,15 +20,13 @@ #include "mock/MockSurfaceInterceptor.h" -namespace android { -namespace mock { +namespace android::mock { // Explicit default instantiation is recommended. SurfaceInterceptor::SurfaceInterceptor() = default; SurfaceInterceptor::~SurfaceInterceptor() = default; -} // namespace mock -} // namespace android +} // namespace android::mock // TODO(b/129481165): remove the #pragma below and fix conversion issues #pragma clang diagnostic pop // ignored "-Wconversion" diff --git a/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.h b/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.h index 5beee1c0ec..b085027397 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.h +++ b/services/surfaceflinger/tests/unittests/mock/MockSurfaceInterceptor.h @@ -20,8 +20,7 @@ #include "SurfaceInterceptor.h" -namespace android { -namespace mock { +namespace android::mock { class SurfaceInterceptor : public android::SurfaceInterceptor { public: @@ -33,10 +32,12 @@ public: const DefaultKeyedVector<wp<IBinder>, DisplayDeviceState>&)); MOCK_METHOD0(disable, void()); MOCK_METHOD0(isEnabled, bool()); - MOCK_METHOD4(saveTransaction, + MOCK_METHOD1(addTransactionTraceListener, void(const sp<gui::ITransactionTraceListener>&)); + MOCK_METHOD1(binderDied, void(const wp<IBinder>&)); + MOCK_METHOD7(saveTransaction, void(const Vector<ComposerState>&, const DefaultKeyedVector<wp<IBinder>, DisplayDeviceState>&, - const Vector<DisplayState>&, uint32_t)); + const Vector<DisplayState>&, uint32_t, int, int, uint64_t)); MOCK_METHOD1(saveSurfaceCreation, void(const sp<const Layer>&)); MOCK_METHOD1(saveSurfaceDeletion, void(const sp<const Layer>&)); MOCK_METHOD4(saveBufferUpdate, void(int32_t, uint32_t, uint32_t, uint64_t)); @@ -46,5 +47,4 @@ public: MOCK_METHOD1(saveVSyncEvent, void(nsecs_t)); }; -} // namespace mock -} // namespace android +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockTimeStats.cpp b/services/surfaceflinger/tests/unittests/mock/MockTimeStats.cpp index d686939b3a..f8e76b290b 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockTimeStats.cpp +++ b/services/surfaceflinger/tests/unittests/mock/MockTimeStats.cpp @@ -16,12 +16,10 @@ #include "mock/MockTimeStats.h" -namespace android { -namespace mock { +namespace android::mock { // Explicit default instantiation is recommended. TimeStats::TimeStats() = default; TimeStats::~TimeStats() = default; -} // namespace mock -} // namespace android +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockTimeStats.h b/services/surfaceflinger/tests/unittests/mock/MockTimeStats.h index 4186e2b574..5aebd2f20e 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockTimeStats.h +++ b/services/surfaceflinger/tests/unittests/mock/MockTimeStats.h @@ -20,15 +20,14 @@ #include "TimeStats/TimeStats.h" -namespace android { -namespace mock { +namespace android::mock { class TimeStats : public android::TimeStats { public: TimeStats(); ~TimeStats() override; - MOCK_METHOD0(onBootFinished, void()); + MOCK_METHOD2(onPullAtom, bool(const int, std::string*)); MOCK_METHOD3(parseArgs, void(bool, const Vector<String16>&, std::string&)); MOCK_METHOD0(isEnabled, bool()); MOCK_METHOD0(miniDump, std::string()); @@ -42,15 +41,20 @@ public: MOCK_METHOD2(recordFrameDuration, void(nsecs_t, nsecs_t)); MOCK_METHOD2(recordRenderEngineDuration, void(nsecs_t, nsecs_t)); MOCK_METHOD2(recordRenderEngineDuration, void(nsecs_t, const std::shared_ptr<FenceTime>&)); - MOCK_METHOD4(setPostTime, void(int32_t, uint64_t, const std::string&, nsecs_t)); + MOCK_METHOD6(setPostTime, void(int32_t, uint64_t, const std::string&, uid_t, nsecs_t, int32_t)); MOCK_METHOD2(incrementLatchSkipped, void(int32_t layerId, LatchSkipReason reason)); MOCK_METHOD1(incrementBadDesiredPresent, void(int32_t layerId)); MOCK_METHOD3(setLatchTime, void(int32_t, uint64_t, nsecs_t)); MOCK_METHOD3(setDesiredTime, void(int32_t, uint64_t, nsecs_t)); MOCK_METHOD3(setAcquireTime, void(int32_t, uint64_t, nsecs_t)); MOCK_METHOD3(setAcquireFence, void(int32_t, uint64_t, const std::shared_ptr<FenceTime>&)); - MOCK_METHOD3(setPresentTime, void(int32_t, uint64_t, nsecs_t)); - MOCK_METHOD3(setPresentFence, void(int32_t, uint64_t, const std::shared_ptr<FenceTime>&)); + MOCK_METHOD7(setPresentTime, + void(int32_t, uint64_t, nsecs_t, Fps, std::optional<Fps>, SetFrameRateVote, + int32_t)); + MOCK_METHOD7(setPresentFence, + void(int32_t, uint64_t, const std::shared_ptr<FenceTime>&, Fps, std::optional<Fps>, + SetFrameRateVote, int32_t)); + MOCK_METHOD1(incrementJankyFrames, void(const JankyFramesInfo&)); MOCK_METHOD1(onDestroy, void(int32_t)); MOCK_METHOD2(removeTimeRecord, void(int32_t, uint64_t)); MOCK_METHOD1(setPowerMode, @@ -59,5 +63,4 @@ public: MOCK_METHOD1(setPresentFenceGlobal, void(const std::shared_ptr<FenceTime>&)); }; -} // namespace mock -} // namespace android +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockEventControlThread.cpp b/services/surfaceflinger/tests/unittests/mock/MockVSyncTracker.cpp index f9bacc8b20..bcccae5b1b 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockEventControlThread.cpp +++ b/services/surfaceflinger/tests/unittests/mock/MockVSyncTracker.cpp @@ -14,14 +14,12 @@ * limitations under the License. */ -#include "mock/MockEventControlThread.h" +#include "mock/MockVSyncTracker.h" -namespace android { -namespace mock { +namespace android::mock { // Explicit default instantiation is recommended. -EventControlThread::EventControlThread() = default; -EventControlThread::~EventControlThread() = default; +VSyncTracker::VSyncTracker() = default; +VSyncTracker::~VSyncTracker() = default; -} // namespace mock -} // namespace android +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockVSyncTracker.h b/services/surfaceflinger/tests/unittests/mock/MockVSyncTracker.h new file mode 100644 index 0000000000..5b0c1f38be --- /dev/null +++ b/services/surfaceflinger/tests/unittests/mock/MockVSyncTracker.h @@ -0,0 +1,40 @@ +/* + * Copyright 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <gmock/gmock.h> + +#include "Scheduler/VSyncTracker.h" + +namespace android::mock { + +class VSyncTracker : public android::scheduler::VSyncTracker { +public: + VSyncTracker(); + ~VSyncTracker() override; + + MOCK_METHOD1(addVsyncTimestamp, bool(nsecs_t)); + MOCK_CONST_METHOD1(nextAnticipatedVSyncTimeFrom, nsecs_t(nsecs_t)); + MOCK_CONST_METHOD0(currentPeriod, nsecs_t()); + MOCK_METHOD1(setPeriod, void(nsecs_t)); + MOCK_METHOD0(resetModel, void()); + MOCK_CONST_METHOD0(needsMoreSamples, bool()); + MOCK_CONST_METHOD2(isVSyncInPhase, bool(nsecs_t, Fps)); + MOCK_CONST_METHOD1(dump, void(std::string&)); +}; + +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockEventControlThread.h b/services/surfaceflinger/tests/unittests/mock/MockVsyncController.cpp index 6ef352a548..25ae1bd312 100644 --- a/services/surfaceflinger/tests/unittests/mock/MockEventControlThread.h +++ b/services/surfaceflinger/tests/unittests/mock/MockVsyncController.cpp @@ -14,22 +14,14 @@ * limitations under the License. */ -#pragma once +#include "mock/MockVsyncController.h" +#include <thread> -#include <gmock/gmock.h> +using namespace std::chrono_literals; +namespace android::mock { -#include "Scheduler/EventControlThread.h" +// Explicit default instantiation is recommended. +VsyncController::VsyncController() = default; +VsyncController::~VsyncController() = default; -namespace android { -namespace mock { - -class EventControlThread : public android::EventControlThread { -public: - EventControlThread(); - ~EventControlThread() override; - - MOCK_METHOD1(setVsyncEnabled, void(bool)); -}; - -} // namespace mock -} // namespace android +} // namespace android::mock diff --git a/services/surfaceflinger/tests/unittests/mock/MockVsyncController.h b/services/surfaceflinger/tests/unittests/mock/MockVsyncController.h new file mode 100644 index 0000000000..94d99665ce --- /dev/null +++ b/services/surfaceflinger/tests/unittests/mock/MockVsyncController.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include <gmock/gmock.h> + +#include "Scheduler/VsyncController.h" + +namespace android::mock { + +class VsyncController : public android::scheduler::VsyncController { +public: + VsyncController(); + ~VsyncController() override; + + MOCK_METHOD1(addPresentFence, bool(const std::shared_ptr<FenceTime>&)); + MOCK_METHOD3(addHwVsyncTimestamp, bool(nsecs_t, std::optional<nsecs_t>, bool*)); + MOCK_METHOD1(startPeriodTransition, void(nsecs_t)); + MOCK_METHOD1(setIgnorePresentFences, void(bool)); + + MOCK_CONST_METHOD1(dump, void(std::string&)); +}; + +} // namespace android::mock |