Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | package org.mozilla.gecko.tests; |
michael@0 | 2 | |
michael@0 | 3 | import org.mozilla.gecko.Actions; |
michael@0 | 4 | import org.mozilla.gecko.Element; |
michael@0 | 5 | import org.mozilla.gecko.R; |
michael@0 | 6 | |
michael@0 | 7 | /* Tests related to the about: page: |
michael@0 | 8 | * - check that about: loads from the URL bar |
michael@0 | 9 | * - check that about: loads from Settings/About... |
michael@0 | 10 | */ |
michael@0 | 11 | public class testAboutPage extends PixelTest { |
michael@0 | 12 | private void ensureTitleMatches(final String regex) { |
michael@0 | 13 | Element urlBarTitle = mDriver.findElement(getActivity(), R.id.url_bar_title); |
michael@0 | 14 | mAsserter.isnot(urlBarTitle, null, "Got the URL bar title"); |
michael@0 | 15 | assertMatches(urlBarTitle.getText(), regex, "page title match"); |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | public void testAboutPage() { |
michael@0 | 19 | blockForGeckoReady(); |
michael@0 | 20 | |
michael@0 | 21 | // Load the about: page and verify its title. |
michael@0 | 22 | String url = "about:"; |
michael@0 | 23 | loadAndPaint(url); |
michael@0 | 24 | |
michael@0 | 25 | ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); |
michael@0 | 26 | |
michael@0 | 27 | // Open a new page to remove the about: page from the current tab. |
michael@0 | 28 | url = getAbsoluteUrl("/robocop/robocop_blank_01.html"); |
michael@0 | 29 | inputAndLoadUrl(url); |
michael@0 | 30 | |
michael@0 | 31 | // At this point the page title should have been set. |
michael@0 | 32 | ensureTitleMatches("Browser Blank Page 01"); |
michael@0 | 33 | |
michael@0 | 34 | // Set up listeners to catch the page load we're about to do. |
michael@0 | 35 | Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added"); |
michael@0 | 36 | Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded"); |
michael@0 | 37 | |
michael@0 | 38 | selectSettingsItem("Mozilla", "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); |
michael@0 | 39 | |
michael@0 | 40 | // Wait for the new tab and page to load |
michael@0 | 41 | tabEventExpecter.blockForEvent(); |
michael@0 | 42 | contentEventExpecter.blockForEvent(); |
michael@0 | 43 | |
michael@0 | 44 | tabEventExpecter.unregisterListener(); |
michael@0 | 45 | contentEventExpecter.unregisterListener(); |
michael@0 | 46 | |
michael@0 | 47 | // Grab the title to make sure the about: page was loaded. |
michael@0 | 48 | ensureTitleMatches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"); |
michael@0 | 49 | } |
michael@0 | 50 | } |