diff options
Diffstat (limited to 'services/inputflinger/tests/TestInputListener.cpp')
-rw-r--r-- | services/inputflinger/tests/TestInputListener.cpp | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/services/inputflinger/tests/TestInputListener.cpp b/services/inputflinger/tests/TestInputListener.cpp index 9bff166565..fb7de97b49 100644 --- a/services/inputflinger/tests/TestInputListener.cpp +++ b/services/inputflinger/tests/TestInputListener.cpp @@ -14,11 +14,10 @@ * limitations under the License. */ +#include "TestInputListener.h" #include <gtest/gtest.h> -#include "TestInputListener.h" - namespace android { // --- TestInputListener --- @@ -28,7 +27,7 @@ TestInputListener::TestInputListener(std::chrono::milliseconds eventHappenedTime : mEventHappenedTimeout(eventHappenedTimeout), mEventDidNotHappenTimeout(eventDidNotHappenTimeout) {} -TestInputListener::~TestInputListener() { } +TestInputListener::~TestInputListener() {} void TestInputListener::assertNotifyConfigurationChangedWasCalled( NotifyConfigurationChangedArgs* outEventArgs) { @@ -43,8 +42,7 @@ void TestInputListener::assertNotifyConfigurationChangedWasNotCalled() { "notifyConfigurationChanged() should not be called.")); } -void TestInputListener::assertNotifyDeviceResetWasCalled( - NotifyDeviceResetArgs* outEventArgs) { +void TestInputListener::assertNotifyDeviceResetWasCalled(NotifyDeviceResetArgs* outEventArgs) { ASSERT_NO_FATAL_FAILURE( assertCalled< NotifyDeviceResetArgs>(outEventArgs, @@ -73,7 +71,7 @@ void TestInputListener::assertNotifyMotionWasCalled(NotifyMotionArgs* outEventAr void TestInputListener::assertNotifyMotionWasNotCalled() { ASSERT_NO_FATAL_FAILURE( - assertNotCalled<NotifySwitchArgs>("notifySwitch() should not be called.")); + assertNotCalled<NotifyMotionArgs>("notifyMotion() should not be called.")); } void TestInputListener::assertNotifySwitchWasCalled(NotifySwitchArgs* outEventArgs) { @@ -82,6 +80,26 @@ void TestInputListener::assertNotifySwitchWasCalled(NotifySwitchArgs* outEventAr "Expected notifySwitch() to have been called.")); } +void TestInputListener::assertNotifySensorWasCalled(NotifySensorArgs* outEventArgs) { + ASSERT_NO_FATAL_FAILURE( + assertCalled<NotifySensorArgs>(outEventArgs, + "Expected notifySensor() to have been called.")); +} + +void TestInputListener::assertNotifyVibratorStateWasCalled(NotifyVibratorStateArgs* outEventArgs) { + ASSERT_NO_FATAL_FAILURE(assertCalled<NotifyVibratorStateArgs>(outEventArgs, + "Expected notifyVibratorState() " + "to have been called.")); +} + +void TestInputListener::assertNotifyCaptureWasCalled( + NotifyPointerCaptureChangedArgs* outEventArgs) { + ASSERT_NO_FATAL_FAILURE( + assertCalled<NotifyPointerCaptureChangedArgs>(outEventArgs, + "Expected notifyPointerCaptureChanged() " + "to have been called.")); +} + template <class NotifyArgsType> void TestInputListener::assertCalled(NotifyArgsType* outEventArgs, std::string message) { std::unique_lock<std::mutex> lock(mLock); @@ -145,4 +163,16 @@ void TestInputListener::notifySwitch(const NotifySwitchArgs* args) { notify<NotifySwitchArgs>(args); } +void TestInputListener::notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs* args) { + notify<NotifyPointerCaptureChangedArgs>(args); +} + +void TestInputListener::notifySensor(const NotifySensorArgs* args) { + notify<NotifySensorArgs>(args); +} + +void TestInputListener::notifyVibratorState(const NotifyVibratorStateArgs* args) { + notify<NotifyVibratorStateArgs>(args); +} + } // namespace android |