diff -r 000000000000 -r 6474c204b198 mobile/android/base/tests/testAboutPage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mobile/android/base/tests/testAboutPage.java Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,50 @@ +package org.mozilla.gecko.tests; + +import org.mozilla.gecko.Actions; +import org.mozilla.gecko.Element; +import org.mozilla.gecko.R; + +/* Tests related to the about: page: + * - check that about: loads from the URL bar + * - check that about: loads from Settings/About... + */ +public class testAboutPage extends PixelTest { + private void ensureTitleMatches(final String regex) { + Element urlBarTitle = mDriver.findElement(getActivity(), R.id.url_bar_title); + mAsserter.isnot(urlBarTitle, null, "Got the URL bar title"); + assertMatches(urlBarTitle.getText(), regex, "page title match"); + } + + public void testAboutPage() { + blockForGeckoReady(); + + // Load the about: page and verify its title. + String url = "about:"; + loadAndPaint(url); + + ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); + + // Open a new page to remove the about: page from the current tab. + url = getAbsoluteUrl("/robocop/robocop_blank_01.html"); + inputAndLoadUrl(url); + + // At this point the page title should have been set. + ensureTitleMatches("Browser Blank Page 01"); + + // Set up listeners to catch the page load we're about to do. + Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added"); + Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded"); + + selectSettingsItem("Mozilla", "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); + + // Wait for the new tab and page to load + tabEventExpecter.blockForEvent(); + contentEventExpecter.blockForEvent(); + + tabEventExpecter.unregisterListener(); + contentEventExpecter.unregisterListener(); + + // Grab the title to make sure the about: page was loaded. + ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); + } +}