Bug 963561 - Test case for new home banner dismiss handler. r=mcomella

This commit is contained in:
Margaret Leibovic 2014-02-14 16:51:44 -08:00
Родитель 61b6952e2c
Коммит adc15912ee
3 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -117,6 +117,14 @@ public class AboutHomeComponent extends BaseComponent {
return this;
}
public AboutHomeComponent dismissBanner() {
assertBannerVisible();
mTestContext.dumpLog(LOGTAG, "Clicking on HomeBanner close button.");
mSolo.clickOnView(getHomeBannerView().findViewById(R.id.close));
return this;
}
public AboutHomeComponent swipeToPanelOnRight() {
mTestContext.dumpLog(LOGTAG, "Swiping to the panel on the right.");
swipeToPanel(Solo.RIGHT);

Просмотреть файл

@ -25,6 +25,9 @@ function addMessage() {
},
onshown: function() {
sendMessageToJava({ type: "TestHomeBanner:MessageShown" });
},
ondismiss: function() {
sendMessageToJava({ type: "TestHomeBanner:MessageDismissed" });
}
});
sendMessageToJava({ type: "TestHomeBanner:MessageAdded" });

Просмотреть файл

@ -49,6 +49,19 @@ public class testHomeBanner extends UITest {
NavigationHelper.enterAndLoadUrl("about:home");
mAboutHome.assertVisible()
.assertBannerNotVisible();
// Add back the banner message to test the dismiss functionality.
addBannerMessage();
NavigationHelper.enterAndLoadUrl("about:home");
mAboutHome.assertVisible();
// Test to make sure the ondismiss handler is called when the close button is clicked.
eventExpecter = getActions().expectGeckoEvent("TestHomeBanner:MessageDismissed");
mAboutHome.dismissBanner();
eventExpecter.blockForEvent();
mAboutHome.assertBannerNotVisible();
}
/**