Bug 814282 - Attempt to fix intermittent failure in testVkbOverlap. r=gbrown

This commit is contained in:
Kartikaya Gupta 2012-12-06 13:57:36 -05:00
parent 11bdd71483
commit 9db80b1724

View File

@ -13,6 +13,7 @@ import @ANDROID_PACKAGE_NAME@.*;
public class testVkbOverlap extends PixelTest {
private static final int CURSOR_BLINK_PERIOD = 500;
private static final int LESS_THAN_CURSOR_BLINK_PERIOD = CURSOR_BLINK_PERIOD - 50;
private static final int PAGE_SETTLE_TIME = 5000;
@Override
protected int getTestType() {
@ -43,6 +44,17 @@ public class testVkbOverlap extends PixelTest {
paintExpecter = mActions.expectPaint();
// the input field should be in the bottom-left corner, so tap thereabouts
meh.tap(5, mDriver.getGeckoHeight() - 5);
// After tapping in the input field, the page needs some time to do stuff, like draw and undraw the focus highlight
// on the input field, trigger the VKB, process any resulting events generated by the system, and scroll the page. So
// we give it a few seconds to do all that. We are sufficiently generous with our definition of "few seconds" to
// prevent intermittent test failures.
try {
Thread.sleep(PAGE_SETTLE_TIME);
} catch (InterruptedException ie) {
ie.printStackTrace();
}
// now that the focus is in the text field we will repaint every 500ms as the cursor blinks, so we need to use a smaller
// "no paints" threshold to consider the page painted
paintExpecter.blockUntilClear(LESS_THAN_CURSOR_BLINK_PERIOD);