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