Clean-up PersisterQueue tests

Previously, the code will get the latch count down in onPreProcessItem,
and use the latch to count process waiting time. Move the latch
countdown to actual process to reflect the waiting time. However, the
timeout time needs to increase a little, as there are more steps before
process the queue items.

When it tests the process time, use the moved latch, which is in the
mFactory to reflect the actual item processing. When the test is about
callback, use the old latch, which is moved into mListener.

Another improvement is to avoid let the whole test class implement the
listener. Additionally, make the two test item class as static class, to
make the interaction between the outer class and the test item class
cleaner. Introduced a factory class to deal with processed latch and the
test items.

Test: atest PersisterQueueTests
Bug: 128526085
Change-Id: I3d1fa2d44abdcdfe7d91d3ebab9b3196269f6e58
1 file changed