mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 22:55:23 +00:00
24927b8136
--HG-- extra : rebase_source : de92ecbb4812bd8ff62e43403ccc2c35213e0b04
60 lines
2.1 KiB
Java
60 lines
2.1 KiB
Java
#filter substitution
|
|
package @ANDROID_PACKAGE_NAME@.tests;
|
|
|
|
import com.jayway.android.robotium.solo.Solo;
|
|
|
|
import android.app.Activity;
|
|
import android.view.View;
|
|
import android.widget.ListView;
|
|
import android.widget.TabWidget;
|
|
import android.support.v4.view.ViewPager;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import @ANDROID_PACKAGE_NAME@.*;
|
|
|
|
/* Tests opening the all pages tab, that items look correct, clicking on an item
|
|
and long tapping on an item
|
|
*/
|
|
|
|
public class testAwesomebarSwipes extends BaseTest {
|
|
@Override
|
|
protected int getTestType() {
|
|
return TEST_MOCHITEST;
|
|
}
|
|
|
|
public void testAwesomebarSwipes() {
|
|
mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
|
|
|
|
ListView list = getAllPagesList("about:firefox");
|
|
|
|
// Test normal sliding of the list left and right
|
|
ViewPager pager = (ViewPager)mSolo.getView(ViewPager.class, 0);
|
|
mAsserter.is(pager.getCurrentItem(), 0, "All pages is selected");
|
|
|
|
int width = mDriver.getGeckoWidth() / 2;
|
|
int y = mDriver.getGeckoHeight() / 2;
|
|
mActions.drag(width, 0, y, y);
|
|
mAsserter.is(pager.getCurrentItem(), 1, "Bookmarks page is selected");
|
|
|
|
mActions.drag(0, width, y, y);
|
|
mAsserter.is(pager.getCurrentItem(), 0, "All pages is selected");
|
|
|
|
// Test tapping on the tab strip changes tabs
|
|
TabWidget tabwidget = (TabWidget)mSolo.getView(TabWidget.class, 0);
|
|
mSolo.clickOnView(tabwidget.getChildAt(1));
|
|
mAsserter.is(pager.getCurrentItem(), 1, "Clicking on tab selected bookmarks page");
|
|
|
|
// Test typing in the awesomebar changes tabs and prevents panning
|
|
mSolo.typeText(0, "woot");
|
|
mAsserter.is(pager.getCurrentItem(), 0, "Searching switched to all pages tab");
|
|
mSolo.scrollToSide(Solo.LEFT);
|
|
mAsserter.is(pager.getCurrentItem(), 0, "Dragging left is not allowed when searching");
|
|
|
|
mSolo.scrollToSide(Solo.RIGHT);
|
|
mAsserter.is(pager.getCurrentItem(), 0, "Dragging right is not allowed when searching");
|
|
|
|
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
|
|
}
|
|
}
|