2012-10-04 09:18:14 -07:00
|
|
|
#filter substitution
|
|
|
|
package @ANDROID_PACKAGE_NAME@.tests;
|
|
|
|
|
|
|
|
import @ANDROID_PACKAGE_NAME@.*;
|
|
|
|
import android.widget.ListView;
|
|
|
|
import android.app.Activity;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import android.view.View;
|
2012-11-12 10:49:25 -08:00
|
|
|
import android.view.ViewGroup;
|
2012-10-04 09:18:14 -07:00
|
|
|
|
2013-08-13 05:37:48 -07:00
|
|
|
public class testHistory extends AboutHomeTest {
|
2012-10-04 09:18:14 -07:00
|
|
|
private View mFirstChild;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected int getTestType() {
|
|
|
|
return TEST_MOCHITEST;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void testHistory() {
|
2012-10-25 12:37:39 -07:00
|
|
|
blockForGeckoReady();
|
2012-10-04 09:18:14 -07:00
|
|
|
|
|
|
|
String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
|
|
|
|
String url2 = getAbsoluteUrl("/robocop/robocop_blank_02.html");
|
|
|
|
String url3 = getAbsoluteUrl("/robocop/robocop_blank_03.html");
|
|
|
|
|
2013-08-19 13:33:49 -07:00
|
|
|
inputAndLoadUrl(url);
|
2012-10-04 09:18:14 -07:00
|
|
|
verifyPageTitle("Browser Blank Page 01");
|
2013-08-19 13:33:49 -07:00
|
|
|
inputAndLoadUrl(url2);
|
2012-10-04 09:18:14 -07:00
|
|
|
verifyPageTitle("Browser Blank Page 02");
|
2013-08-19 13:33:49 -07:00
|
|
|
inputAndLoadUrl(url3);
|
2012-10-04 09:18:14 -07:00
|
|
|
verifyPageTitle("Browser Blank Page 03");
|
|
|
|
|
2013-08-17 06:24:27 -07:00
|
|
|
openAboutHomeTab(AboutHomeTabs.MOST_RECENT);
|
|
|
|
|
|
|
|
final ListView hList = findListViewWithTag("most_recent");
|
|
|
|
mAsserter.is(waitForListToLoad(hList), true, "list is properly loaded");
|
2012-10-04 09:18:14 -07:00
|
|
|
|
|
|
|
// Click on the history item and wait for the page to load
|
2012-11-12 10:49:25 -08:00
|
|
|
// wait for the history list to be populated
|
2012-10-04 09:18:14 -07:00
|
|
|
mFirstChild = null;
|
2012-11-12 10:49:25 -08:00
|
|
|
boolean success = waitForTest(new BooleanTest() {
|
2013-02-26 21:48:00 -08:00
|
|
|
@Override
|
2012-11-12 10:49:25 -08:00
|
|
|
public boolean test() {
|
|
|
|
mFirstChild = hList.getChildAt(1);
|
|
|
|
if (mFirstChild == null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (mFirstChild instanceof android.view.ViewGroup) {
|
|
|
|
ViewGroup group = (ViewGroup)mFirstChild;
|
|
|
|
if (group.getChildCount() < 1) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for (int i = 0; i < group.getChildCount(); i++) {
|
|
|
|
View grandChild = group.getChildAt(i);
|
|
|
|
if (grandChild instanceof android.widget.TextView) {
|
|
|
|
mAsserter.ok(true, "found TextView:", ((android.widget.TextView)grandChild).getText().toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mAsserter.dumpLog("first child not a ViewGroup: "+mFirstChild);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2012-12-28 15:06:50 -08:00
|
|
|
}, MAX_WAIT_MS);
|
2012-11-12 10:49:25 -08:00
|
|
|
|
2012-10-04 09:18:14 -07:00
|
|
|
mAsserter.isnot(mFirstChild, null, "Got history item");
|
|
|
|
mSolo.clickOnView(mFirstChild);
|
2013-08-02 15:56:02 -07:00
|
|
|
|
2013-05-09 17:42:14 -07:00
|
|
|
// The first item here (since it was just visited) should be a "Switch to tab" item
|
|
|
|
// i.e. don't expect a DOMCOntentLoaded event
|
|
|
|
verifyPageTitle("Browser Blank Page 03");
|
2012-10-04 09:18:14 -07:00
|
|
|
verifyUrl(url3);
|
|
|
|
}
|
|
|
|
}
|