Bug 719954 - Bracket the clicking on list items with the event expecter to avoid a race condition. r=gbrown

This commit is contained in:
Kartikaya Gupta 2012-01-21 12:48:26 -05:00
parent adc2b503ed
commit 56eca05981
2 changed files with 5 additions and 7 deletions

View File

@ -99,12 +99,6 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
contentEventExpecter.blockForEvent();
}
protected final void waitForLoad() {
Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
// wait for screen to load
contentEventExpecter.blockForEvent();
}
protected final void loadUrl(String url) {
enterUrl(url);
hitEnterAndWait();

View File

@ -18,11 +18,15 @@ public class testBookmark extends BaseTest {
//Click the top item in the bookmark list.
clickOnAwesomeBar();
mActions.sendSpecialKey(Actions.SpecialKey.RIGHT);
Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
ArrayList<TextView> l = null;
while (l == null || l.size() < 1) {
l = mSolo.clickInList(1);
}
waitForLoad();
contentEventExpecter.blockForEvent();
//Items in bookmarks aren't constant so URL can't be tested.
}