summaryrefslogtreecommitdiff
path: root/libs/gui/ConsumerBase.cpp
diff options
context:
space:
mode:
author Prabir Pradhan <prabirmsp@google.com> 2024-07-24 21:19:08 +0000
committer Prabir Pradhan <prabirmsp@google.com> 2024-07-25 14:13:04 +0000
commit31d05c4c78e7924e4bb6dc45092e612a9c7d5bfb (patch)
treec5d1dd9e1f7189534f1944ed0d29bebe60afd7b7 /libs/gui/ConsumerBase.cpp
parentd2dfdc6123ffcc98c78073c633567c6f22f8d7c2 (diff)
Mock InputDevice in the InputMapper unit tests
This makes the InputMapperUnitTest subclasses easier to test, as the tests will not have to rely on the behavior of actual InputDevice implementation. Unfortunately, this means InputDevice must now be a virtual class to allow its mocked subclass to define its behavior for the methods that we want to change. In this CL, we take the approach of only marking the methods that we need to customize as virtual to avoid the overhead of vtable lookups at runtime. An alternative approach would be to introduce a type parameter to InputDeviceContext to allow us to specify a different InputDevice implementation in the tests. This would eliminate any addtional runtime overheads resulting from vtable lookups. However, this would mean every InputMapper class would need to have this new type parameter, adding verbosity and complextity to the codebase. For this reason, the virtual member approach was preferred. Bug: 354270482 Test: atest inputflinger_tests Flag: EXEMPT refactor Change-Id: Id7e103e1f04812c92ee8ecfdfe1e75a9949efa9e
Diffstat (limited to 'libs/gui/ConsumerBase.cpp')
0 files changed, 0 insertions, 0 deletions