1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/tests/testAboutPage.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +package org.mozilla.gecko.tests; 1.5 + 1.6 +import org.mozilla.gecko.Actions; 1.7 +import org.mozilla.gecko.Element; 1.8 +import org.mozilla.gecko.R; 1.9 + 1.10 +/* Tests related to the about: page: 1.11 + * - check that about: loads from the URL bar 1.12 + * - check that about: loads from Settings/About... 1.13 + */ 1.14 +public class testAboutPage extends PixelTest { 1.15 + private void ensureTitleMatches(final String regex) { 1.16 + Element urlBarTitle = mDriver.findElement(getActivity(), R.id.url_bar_title); 1.17 + mAsserter.isnot(urlBarTitle, null, "Got the URL bar title"); 1.18 + assertMatches(urlBarTitle.getText(), regex, "page title match"); 1.19 + } 1.20 + 1.21 + public void testAboutPage() { 1.22 + blockForGeckoReady(); 1.23 + 1.24 + // Load the about: page and verify its title. 1.25 + String url = "about:"; 1.26 + loadAndPaint(url); 1.27 + 1.28 + ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); 1.29 + 1.30 + // Open a new page to remove the about: page from the current tab. 1.31 + url = getAbsoluteUrl("/robocop/robocop_blank_01.html"); 1.32 + inputAndLoadUrl(url); 1.33 + 1.34 + // At this point the page title should have been set. 1.35 + ensureTitleMatches("Browser Blank Page 01"); 1.36 + 1.37 + // Set up listeners to catch the page load we're about to do. 1.38 + Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added"); 1.39 + Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded"); 1.40 + 1.41 + selectSettingsItem("Mozilla", "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); 1.42 + 1.43 + // Wait for the new tab and page to load 1.44 + tabEventExpecter.blockForEvent(); 1.45 + contentEventExpecter.blockForEvent(); 1.46 + 1.47 + tabEventExpecter.unregisterListener(); 1.48 + contentEventExpecter.unregisterListener(); 1.49 + 1.50 + // Grab the title to make sure the about: page was loaded. 1.51 + ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); 1.52 + } 1.53 +}