Bug 944144 - Implement NavigationHelper.reload. r=mcomella

This commit is contained in:
Vivek Balakrishnan 2014-05-07 16:24:00 -04:00
Родитель ec4efe3858
Коммит 6823c231cd
4 изменённых файлов: 23 добавлений и 8 удалений

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

@ -29,7 +29,8 @@ import com.jayway.android.robotium.solo.Solo;
public class AppMenuComponent extends BaseComponent {
public enum MenuItem {
FORWARD(R.string.forward),
NEW_TAB(R.string.new_tab);
NEW_TAB(R.string.new_tab),
RELOAD(R.string.reload);
private final int resourceID;
private String stringResource;

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

@ -80,6 +80,10 @@ public class ToolbarComponent extends BaseComponent {
return (ImageButton) getToolbarView().findViewById(R.id.forward);
}
private ImageButton getReloadButton() {
DeviceHelper.assertIsTablet();
return (ImageButton) getToolbarView().findViewById(R.id.reload);
}
/**
* Returns the View for the edit cancel button in the browser toolbar.
*/
@ -190,6 +194,11 @@ public class ToolbarComponent extends BaseComponent {
return pressButton(forwardButton, "forward");
}
public ToolbarComponent pressReloadButton() {
final ImageButton reloadButton = getReloadButton();
return pressButton(reloadButton, "reload");
}
private ToolbarComponent pressButton(final View view, final String buttonName) {
fAssertNotNull("The " + buttonName + " button View is not null", view);
fAssertTrue("The " + buttonName + " button is enabled", view.isEnabled());

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

@ -88,9 +88,17 @@ final public class NavigationHelper {
}
public static void reload() {
// TODO: On tablets, press reload in TOOLBAR. Note that this is technically
// an app menu item so tread carefully.
// On phones, press reload in APPMENU.
throw new UnsupportedOperationException("Not yet implemented.");
if (DeviceHelper.isTablet()) {
sToolbar.pressReloadButton(); // Waits for page load & asserts isNotEditing.
return;
}
sToolbar.assertIsNotEditing();
WaitHelper.waitForPageLoad(new Runnable() {
@Override
public void run() {
sAppMenu.pressMenuItem(AppMenuComponent.MenuItem.RELOAD);
}
});
}
}

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

@ -28,10 +28,7 @@ public class testSessionHistory extends UITest {
NavigationHelper.goForward();
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
// TODO: Implement this functionality and uncomment.
/*
NavigationHelper.reload();
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
*/
}
}