mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1265011 - Add test for hardware menu key support (Bug 1229967). r=sebastian
Make sure that the app menu can be opened and closed via the hardware menu key. MozReview-Commit-ID: 3E459eCRneY --HG-- extra : transplant_source : %81%BB%C1%EB2%9A%2C%FDG%F4vwMw%19%D4%C6%EF%7C%F5
This commit is contained in:
parent
4395f4febb
commit
0e70bbab51
@ -83,7 +83,11 @@ public class AppMenuComponent extends BaseComponent {
|
||||
super(testContext);
|
||||
}
|
||||
|
||||
private void assertMenuIsNotOpen() {
|
||||
public void assertMenuIsOpen() {
|
||||
fAssertTrue("Menu is open", isMenuOpen());
|
||||
}
|
||||
|
||||
public void assertMenuIsNotOpen() {
|
||||
fAssertFalse("Menu is not open", isMenuOpen());
|
||||
}
|
||||
|
||||
@ -271,7 +275,7 @@ public class AppMenuComponent extends BaseComponent {
|
||||
return (menuItemView != null) && (menuItemView.getVisibility() == View.VISIBLE);
|
||||
}
|
||||
|
||||
private void waitForMenuOpen() {
|
||||
public void waitForMenuOpen() {
|
||||
WaitHelper.waitFor("menu to open", new Condition() {
|
||||
@Override
|
||||
public boolean isSatisfied() {
|
||||
@ -279,4 +283,13 @@ public class AppMenuComponent extends BaseComponent {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void waitForMenuClose() {
|
||||
WaitHelper.waitFor("menu to close", new Condition() {
|
||||
@Override
|
||||
public boolean isSatisfied() {
|
||||
return !isMenuOpen();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ import org.mozilla.gecko.tests.components.AppMenuComponent;
|
||||
import org.mozilla.gecko.tests.helpers.GeckoHelper;
|
||||
import org.mozilla.gecko.tests.helpers.NavigationHelper;
|
||||
|
||||
import com.robotium.solo.Solo;
|
||||
|
||||
/**
|
||||
* Set of tests to test UI App menu and submenus the user interact with.
|
||||
*/
|
||||
@ -22,9 +24,22 @@ public class testAppMenuPathways extends UITest {
|
||||
public void testAppMenuPathways() {
|
||||
GeckoHelper.blockForReady();
|
||||
|
||||
_testHardwareMenuKeyOpenClose();
|
||||
_testSaveAsPDFPathway();
|
||||
}
|
||||
|
||||
public void _testHardwareMenuKeyOpenClose() {
|
||||
mAppMenu.assertMenuIsNotOpen();
|
||||
|
||||
mSolo.sendKey(Solo.MENU);
|
||||
mAppMenu.waitForMenuOpen();
|
||||
mAppMenu.assertMenuIsOpen();
|
||||
|
||||
mSolo.sendKey(Solo.MENU);
|
||||
mAppMenu.waitForMenuClose();
|
||||
mAppMenu.assertMenuIsNotOpen();
|
||||
}
|
||||
|
||||
public void _testSaveAsPDFPathway() {
|
||||
// Page menu should be disabled in about:home.
|
||||
mAppMenu.assertMenuItemIsDisabledAndVisible(AppMenuComponent.PageMenuItem.SAVE_AS_PDF);
|
||||
|
Loading…
Reference in New Issue
Block a user