Add tests for AndroidInputEventProtoConverter::toProtoMotionEvent
We use mocked classes as stand-ins for the Perfetto proto classes. Since Perfetto uses ProtoZero where the generated C++ classes do not allow for readback, they cannot be used directly in the tests. The generated proto classes' methods are also non-virtual, so we cannot override them in tests. We are therefore using a templating strategy to provide separte mock implementations of the proto classes for testing. This has the additional benefits of: - giving a build error if a new unmocked method is used in the test, reminding us to add tests for newly traced fields; and - allowing us to use strict mocks to easily enforce that more information is not traced compared to what is expected by the tests. Bug: 391468016 Test: Presubmit Flag: TEST_ONLY Change-Id: I73c090e86b30eaed416fc8d2b05a162832d4ec00
Loading
Please register or sign in to comment