I am writing some black-box, acceptance tests that run on a physical android device. The application under test (AUT) relies on the camera's preview. Specifically, it uses the setOneShotPreviewCallback
method of the android.hardware.Camera
class. I am looking for a way to inject a fake preview picture to test the app's behavior.
I thought I could fool the Camera object by having the test code call the AUT's PreviewCallback
object, but unfortunately, the instance variable mPreviewCallback
is private to the Camera object and thus my test code has no way to get a reference to the PreviewCallback
object.
Another way I thought about was to send a Message
to the Camera's EventHandler
, but again the field mEventHandler
is private, so the test code has no way to get a reference to the Handler.