Bug 1075531 - Part 2: Check for url in place of page titles on new tablet. r=lucasr

This commit is contained in:
Michael Comella 2014-10-10 11:35:41 -07:00
Родитель a881661108
Коммит ef9fa9a841
22 изменённых файлов: 141 добавлений и 70 удалений

Просмотреть файл

@ -25,6 +25,7 @@ import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.GeckoThread;
import org.mozilla.gecko.GeckoThread.LaunchState;
import org.mozilla.gecko.NewTabletUI;
import org.mozilla.gecko.R;
import org.mozilla.gecko.RobocopUtils;
import org.mozilla.gecko.Tab;
@ -69,6 +70,8 @@ abstract class BaseTest extends BaseRobocopTest {
private static final int GECKO_READY_WAIT_MS = 180000;
public static final int MAX_WAIT_BLOCK_FOR_EVENT_DATA_MS = 90000;
private static final String URL_HTTP_PREFIX = "http://";
private Activity mActivity;
private int mPreferenceRequestID = 0;
protected Solo mSolo;
@ -527,7 +530,25 @@ abstract class BaseTest extends BaseRobocopTest {
}
}
public final void verifyPageTitle(String title) {
public final void verifyPageTitle(final String title, String url) {
// We are asserting visible state - we shouldn't know if the title is null.
mAsserter.isnot(title, null, "The title argument is not null");
mAsserter.isnot(url, null, "The url argument is not null");
// TODO: We should also check the title bar preference.
final String expected;
if (!NewTabletUI.isEnabled(mActivity)) {
expected = title;
} else {
if (StringHelper.ABOUT_HOME_URL.equals(url)) {
expected = StringHelper.ABOUT_HOME_TITLE;
} else if (url.startsWith(URL_HTTP_PREFIX)) {
expected = url.substring(URL_HTTP_PREFIX.length());
} else {
expected = url;
}
}
final TextView urlBarTitle = (TextView) mSolo.getView(R.id.url_bar_title);
String pageTitle = null;
if (urlBarTitle != null) {
@ -536,7 +557,7 @@ abstract class BaseTest extends BaseRobocopTest {
waitForCondition(new VerifyTextViewText(urlBarTitle, title), MAX_WAIT_VERIFY_PAGE_TITLE_MS);
pageTitle = urlBarTitle.getText().toString();
}
mAsserter.is(pageTitle, title, "Page title is correct");
mAsserter.is(pageTitle, expected, "Page title is correct");
}
public final void verifyTabCount(int expectedTabCount) {

Просмотреть файл

@ -197,7 +197,7 @@ public abstract class SessionTest extends BaseTest {
verifyUrl(page.url);
} else {
waitForText(page.title);
verifyPageTitle(page.title);
verifyPageTitle(page.title, page.url);
}
}

Просмотреть файл

@ -9,9 +9,12 @@ import static org.mozilla.gecko.tests.helpers.AssertionHelper.fAssertFalse;
import static org.mozilla.gecko.tests.helpers.AssertionHelper.fAssertNotNull;
import static org.mozilla.gecko.tests.helpers.AssertionHelper.fAssertTrue;
import org.mozilla.gecko.NewTabletUI;
import org.mozilla.gecko.R;
import org.mozilla.gecko.tests.StringHelper;
import org.mozilla.gecko.tests.UITestContext;
import org.mozilla.gecko.tests.helpers.DeviceHelper;
import org.mozilla.gecko.tests.helpers.NavigationHelper;
import org.mozilla.gecko.tests.helpers.WaitHelper;
import android.view.View;
@ -26,6 +29,9 @@ import com.jayway.android.robotium.solo.Solo;
* A class representing any interactions that take place on the Toolbar.
*/
public class ToolbarComponent extends BaseComponent {
private static final String URL_HTTP_PREFIX = "http://";
public ToolbarComponent(final UITestContext testContext) {
super(testContext);
}
@ -40,7 +46,26 @@ public class ToolbarComponent extends BaseComponent {
return this;
}
public ToolbarComponent assertTitle(final String expected) {
public ToolbarComponent assertTitle(final String title, final String url) {
// We are asserting visible state - we shouldn't know if the title is null.
fAssertNotNull("The title argument is not null", title);
fAssertNotNull("The url argument is not null", url);
// TODO: We should also check the title bar preference.
final String expected;
if (!NewTabletUI.isEnabled(mActivity)) {
expected = title;
} else {
final String absoluteURL = NavigationHelper.adjustUrl(url);
if (StringHelper.ABOUT_HOME_URL.equals(absoluteURL)) {
expected = StringHelper.ABOUT_HOME_TITLE;
} else if (absoluteURL.startsWith(URL_HTTP_PREFIX)) {
expected = absoluteURL.substring(URL_HTTP_PREFIX.length());
} else {
expected = absoluteURL;
}
}
fAssertEquals("The Toolbar title is " + expected, expected, getTitle());
return this;
}

Просмотреть файл

@ -44,7 +44,7 @@ final public class NavigationHelper {
/**
* Returns a new URL with the docshell HTTP server host prefix.
*/
private static String adjustUrl(final String url) {
public static String adjustUrl(final String url) {
fAssertNotNull("url is not null", url);
if (url.startsWith("about:") || url.startsWith("chrome:")) {

Просмотреть файл

@ -13,18 +13,20 @@ public class testAboutHomeVisibility extends UITest {
GeckoHelper.blockForReady();
// Check initial state on about:home.
mToolbar.assertTitle(StringHelper.ABOUT_HOME_TITLE);
mToolbar.assertTitle(StringHelper.ABOUT_HOME_TITLE, StringHelper.ABOUT_HOME_URL);
mAboutHome.assertVisible()
.assertCurrentPanel(PanelType.TOP_SITES);
// Go to blank 01.
NavigationHelper.enterAndLoadUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE,
StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mAboutHome.assertNotVisible();
// Go to blank 02.
NavigationHelper.enterAndLoadUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE,
StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
mAboutHome.assertNotVisible();
// Enter editing mode, where the about:home UI should be visible.
@ -38,7 +40,7 @@ public class testAboutHomeVisibility extends UITest {
// Loading about:home should show about:home again.
NavigationHelper.enterAndLoadUrl(StringHelper.ABOUT_HOME_URL);
mToolbar.assertTitle(StringHelper.ABOUT_HOME_TITLE);
mToolbar.assertTitle(StringHelper.ABOUT_HOME_TITLE, StringHelper.ABOUT_HOME_URL);
mAboutHome.assertVisible()
.assertCurrentPanel(PanelType.TOP_SITES);
@ -49,7 +51,5 @@ public class testAboutHomeVisibility extends UITest {
mAboutHome.navigateToBuiltinPanelType(PanelType.HISTORY)
.assertVisible()
.assertCurrentPanel(PanelType.HISTORY);
// TODO: Type in a url and assert the go button is visible.
}
}

Просмотреть файл

@ -2,34 +2,41 @@ package org.mozilla.gecko.tests;
import org.mozilla.gecko.Actions;
import org.mozilla.gecko.Element;
import org.mozilla.gecko.NewTabletUI;
import org.mozilla.gecko.R;
import android.app.Activity;
/* 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);
private void ensureTitleMatches(final String titleRegex, final String urlRegex) {
final Activity activity = getActivity();
final Element urlBarTitle = mDriver.findElement(activity, R.id.url_bar_title);
// TODO: We should also be testing what the page title preference value is.
final String expectedTitle = NewTabletUI.isEnabled(activity) ? urlRegex : titleRegex;
mAsserter.isnot(urlBarTitle, null, "Got the URL bar title");
assertMatches(urlBarTitle.getText(), regex, "page title match");
assertMatches(urlBarTitle.getText(), expectedTitle, "page title match");
}
public void testAboutPage() {
blockForGeckoReady();
// Load the about: page and verify its title.
String url = "about:";
String url = StringHelper.ABOUT_SCHEME;
loadAndPaint(url);
ensureTitleMatches(StringHelper.ABOUT_LABEL);
verifyPageTitle(StringHelper.ABOUT_LABEL, url);
// Open a new page to remove the about: page from the current tab.
url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
inputAndLoadUrl(url);
// At this point the page title should have been set.
ensureTitleMatches(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, url);
// Set up listeners to catch the page load we're about to do.
Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
@ -45,6 +52,6 @@ public class testAboutPage extends PixelTest {
contentEventExpecter.unregisterListener();
// Grab the title to make sure the about: page was loaded.
ensureTitleMatches(StringHelper.ABOUT_LABEL);
verifyPageTitle(StringHelper.ABOUT_LABEL, StringHelper.ABOUT_SCHEME);
}
}

Просмотреть файл

@ -61,7 +61,7 @@ public class testAddSearchEngine extends AboutHomeTest {
// Load the page for the search engine to add.
inputAndLoadUrl(searchEngineURL);
waitForText(StringHelper.ROBOCOP_SEARCH_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_SEARCH_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_SEARCH_TITLE, searchEngineURL);
// Used to long-tap on the search input box for the search engine to add.
getInstrumentation().waitForIdleSync();
@ -99,7 +99,7 @@ public class testAddSearchEngine extends AboutHomeTest {
mAsserter.dumpLog("Search Engines list = " + searchEngines.toString());
mAsserter.is(searchEngines.size(), initialNumSearchEngines + 1, "Checking the number of Search Engines has increased");
// Verify that the number of displayed searchengines is the same as the one received through the SearchEngines:Data event.
verifyDisplayedSearchEnginesCount(initialNumSearchEngines + 1);
searchEngineDataEventExpector.unregisterListener();
@ -151,7 +151,7 @@ public class testAddSearchEngine extends AboutHomeTest {
return (adapter.getCount() == expectedCount);
}
}, MAX_WAIT_TEST_MS);
// Exit about:home
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);

Просмотреть файл

@ -17,7 +17,7 @@ public class testAddonManager extends PixelTest {
public void testAddonManager() {
Actions.EventExpecter tabEventExpecter;
Actions.EventExpecter contentEventExpecter;
String url = StringHelper.ABOUT_ADDONS_URL;
final String aboutAddonsURL = StringHelper.ABOUT_ADDONS_URL;
blockForGeckoReady();
@ -36,21 +36,22 @@ public class testAddonManager extends PixelTest {
contentEventExpecter.unregisterListener();
// Verify the url
verifyPageTitle(StringHelper.ADDONS_LABEL);
verifyPageTitle(StringHelper.ADDONS_LABEL, aboutAddonsURL);
// Close the Add-on Manager
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
// Load the about:addons page and verify it was loaded
loadAndPaint(url);
verifyPageTitle(StringHelper.ADDONS_LABEL);
loadAndPaint(aboutAddonsURL);
verifyPageTitle(StringHelper.ADDONS_LABEL, aboutAddonsURL);
// Setup wait for tab to spawn and load
tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
// Open a new tab
addTab(getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL));
final String blankURL = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
addTab(blankURL);
// Wait for the new tab and page to load
tabEventExpecter.blockForEvent();
@ -63,7 +64,7 @@ public class testAddonManager extends PixelTest {
verifyTabCount(2);
// Verify the page was opened
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, blankURL);
// Addons Manager is not opened 2 separate times when opened from the menu
selectMenuItem(StringHelper.ADDONS_LABEL);

Просмотреть файл

@ -48,7 +48,8 @@ public class testAppMenuPathways extends UITest {
// The above mock video playback test changes Java state, but not the associated JS state.
// Navigate to a new page so that the Java state is cleared.
NavigationHelper.enterAndLoadUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE,
StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
// Test save as pdf functionality.
// The following call doesn't wait for the resulting pdf but checks that no exception are thrown.

Просмотреть файл

@ -32,7 +32,8 @@ public class testBookmark extends AboutHomeTest {
isBookmarkDisplayed(BOOKMARK_URL);
loadBookmark(BOOKMARK_URL);
waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE,
StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mDatabaseHelper.deleteBookmark(BOOKMARK_URL);
waitForBookmarked(false);

Просмотреть файл

@ -52,7 +52,7 @@ public class testBookmarkFolders extends AboutHomeTest {
// Open the bookmark from a bookmark folder hierarchy
loadBookmark(DESKTOP_BOOKMARK_URL);
waitForText(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE, DESKTOP_BOOKMARK_URL);
openAboutHomeTab(AboutHomeTabs.BOOKMARKS);
// Check that folders don't have a context menu

Просмотреть файл

@ -19,7 +19,8 @@ public class testBookmarkKeyword extends AboutHomeTest {
waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
// Make sure the title of the page appeared.
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE,
StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
// Delete the bookmark to clean up.
mDatabaseHelper.deleteBookmark(url);

Просмотреть файл

@ -18,7 +18,9 @@ public class testBookmarklets extends AboutHomeTest {
// load a standard page so bookmarklets work
inputAndLoadUrl(url);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE); // Waiting for page title to ensure the page is loaded
// Waiting for page title to ensure the page is loaded
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE,
StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
// verify that user-entered bookmarklets do *not* work
enterUrl(js);

Просмотреть файл

@ -30,14 +30,14 @@ public class testClearPrivateData extends PixelTest {
String blank2 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
String title = StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE;
inputAndLoadUrl(blank1);
verifyPageTitle(title);
verifyPageTitle(title, blank1);
mDatabaseHelper.addOrUpdateMobileBookmark(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE, blank2);
// Checking that the history list is not empty
verifyHistoryCount(1);
//clear and check for device
checkDevice(title);
checkDevice(title, blank1);
// Checking that history list is empty
verifyHistoryCount(0);
@ -65,7 +65,7 @@ public class testClearPrivateData extends PixelTest {
checkOption(shareStrings[3], "Cancel");
loadCheckDismiss(shareStrings[2], url, shareStrings[0]);
checkOption(shareStrings[2], "Cancel");
checkDevice(titleGeolocation);
checkDevice(titleGeolocation, url);
}
public void clearPassword(){
@ -75,24 +75,20 @@ public class testClearPrivateData extends PixelTest {
loadCheckDismiss(passwordStrings[1], loginUrl, passwordStrings[0]);
checkOption(passwordStrings[1], "Clear");
loadCheckDismiss(passwordStrings[2], loginUrl, passwordStrings[0]);
checkDevice(title);
checkDevice(title, getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL));
}
// clear private data and verify the device type because for phone there is an extra back action to exit the settings menu
public void checkDevice(String title) {
public void checkDevice(final String title, final String url) {
clearPrivateData();
if (mDevice.type.equals("phone")) {
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
mAsserter.ok(waitForText(StringHelper.PRIVACY_SECTION_LABEL), "waiting to perform one back", "one back");
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
verifyPageTitle(title);
}
else {
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
verifyPageTitle(title);
}
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
verifyPageTitle(title, url);
}
// Load a URL, verify that the doorhanger appears and dismiss it
public void loadCheckDismiss(String option, String url, String message) {
inputAndLoadUrl(url);

Просмотреть файл

@ -17,11 +17,11 @@ public class testHistory extends AboutHomeTest {
String url3 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_03_URL);
inputAndLoadUrl(url);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_URL, url);
inputAndLoadUrl(url2);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_URL, url2);
inputAndLoadUrl(url3);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_03_URL);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_03_URL, url3);
openAboutHomeTab(AboutHomeTabs.HISTORY);
@ -62,7 +62,7 @@ public class testHistory extends AboutHomeTest {
// 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(StringHelper.ROBOCOP_BLANK_PAGE_03_URL);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_03_URL, StringHelper.ROBOCOP_BLANK_PAGE_03_URL);
verifyUrl(url3);
}
}

Просмотреть файл

@ -24,8 +24,9 @@ public class testInputConnection extends UITest {
public void testInputConnection() throws InterruptedException {
GeckoHelper.blockForReady();
NavigationHelper.enterAndLoadUrl(StringHelper.ROBOCOP_INPUT_URL + "#" + INITIAL_TEXT);
mToolbar.assertTitle(StringHelper.ROBOCOP_INPUT_TITLE);
final String url = StringHelper.ROBOCOP_INPUT_URL + "#" + INITIAL_TEXT;
NavigationHelper.enterAndLoadUrl(url);
mToolbar.assertTitle(StringHelper.ROBOCOP_INPUT_TITLE, url);
mGeckoView.mTextInput
.waitForInputConnection()

Просмотреть файл

@ -18,7 +18,7 @@ public class testPictureLinkContextMenu extends ContentContextMenuTest {
PICTURE_PAGE_URL=getAbsoluteUrl(StringHelper.ROBOCOP_PICTURE_LINK_URL);
BLANK_PAGE_URL=getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
loadAndPaint(PICTURE_PAGE_URL);
verifyPageTitle(PICTURE_PAGE_TITLE);
verifyPageTitle(PICTURE_PAGE_TITLE, PICTURE_PAGE_URL);
switchTabs(imageTitle);
verifyContextMenuItems(photoMenuItems);

Просмотреть файл

@ -73,7 +73,7 @@ public class testReaderMode extends AboutHomeTest {
contentPageShowExpecter.unregisterListener();
paintExpecter.blockUntilClear(EVENT_CLEAR_DELAY_MS);
paintExpecter.unregisterListener();
verifyPageTitle(StringHelper.ROBOCOP_TEXT_PAGE_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_TEXT_PAGE_TITLE, StringHelper.ROBOCOP_TEXT_PAGE_URL);
// Open the share menu for the reader toolbar
height = mDriver.getGeckoTop() + mDriver.getGeckoHeight() - 10;
@ -134,7 +134,7 @@ public class testReaderMode extends AboutHomeTest {
mSolo.clickOnView(child);
contentEventExpecter.blockForEvent();
contentEventExpecter.unregisterListener();
verifyPageTitle(StringHelper.ROBOCOP_TEXT_PAGE_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_TEXT_PAGE_TITLE, StringHelper.ROBOCOP_TEXT_PAGE_URL);
// Verify that we are in reader mode and remove the page from Reading List
height = mDriver.getGeckoTop() + mDriver.getGeckoHeight() - 10;
@ -142,7 +142,7 @@ public class testReaderMode extends AboutHomeTest {
mAsserter.dumpLog("Long Clicking at width = " + String.valueOf(width) + " and height = " + String.valueOf(height));
mSolo.clickOnScreen(width,height);
mAsserter.ok(mSolo.waitForText("Page removed from your Reading List"), "Waiting for the page to removed from your Reading List", "The page is removed from your Reading List");
verifyPageTitle(StringHelper.ROBOCOP_TEXT_PAGE_TITLE);
verifyPageTitle(StringHelper.ROBOCOP_TEXT_PAGE_TITLE, StringHelper.ROBOCOP_TEXT_PAGE_URL);
//Check if the Reading List is empty
openAboutHomeTab(AboutHomeTabs.READING_LIST);

Просмотреть файл

@ -16,8 +16,9 @@ public class testSelectionHandler extends UITest {
GeckoHelper.blockForReady();
Actions.EventExpecter robocopTestExpecter = getActions().expectGeckoEvent("Robocop:testSelectionHandler");
NavigationHelper.enterAndLoadUrl("chrome://roboextender/content/testSelectionHandler.html");
mToolbar.assertTitle(StringHelper.ROBOCOP_SELECTION_HANDLER_TITLE);
final String url = "chrome://roboextender/content/testSelectionHandler.html";
NavigationHelper.enterAndLoadUrl(url);
mToolbar.assertTitle(StringHelper.ROBOCOP_SELECTION_HANDLER_TITLE, url);
while (!test(robocopTestExpecter)) {
// do nothing

Просмотреть файл

@ -10,25 +10,32 @@ public class testSessionHistory extends UITest {
public void testSessionHistory() {
GeckoHelper.blockForReady();
NavigationHelper.enterAndLoadUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
String url = StringHelper.ROBOCOP_BLANK_PAGE_01_URL;
NavigationHelper.enterAndLoadUrl(url);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, url);
NavigationHelper.enterAndLoadUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
url = StringHelper.ROBOCOP_BLANK_PAGE_02_URL;
NavigationHelper.enterAndLoadUrl(url);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE, url);
NavigationHelper.enterAndLoadUrl(StringHelper.ROBOCOP_BLANK_PAGE_03_URL);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_03_TITLE);
url = StringHelper.ROBOCOP_BLANK_PAGE_03_URL;
NavigationHelper.enterAndLoadUrl(url);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_03_TITLE, url);
NavigationHelper.goBack();
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE,
StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
NavigationHelper.goBack();
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE,
StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
NavigationHelper.goForward();
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE,
StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
NavigationHelper.reload();
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
mToolbar.assertTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE,
StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
}
}

Просмотреть файл

@ -37,7 +37,7 @@ public class testShareLink extends AboutHomeTest {
openAboutHomeTab(AboutHomeTabs.READING_LIST);
inputAndLoadUrl(url);
verifyPageTitle(urlTitle); // Waiting for page title to ensure the page is loaded
verifyPageTitle(urlTitle, url); // Waiting for page title to ensure the page is loaded
selectMenuItem(StringHelper.SHARE_LABEL);
if (Build.VERSION.SDK_INT >= 14) {
@ -248,7 +248,7 @@ public class testShareLink extends AboutHomeTest {
public boolean test() {
ArrayList<View> views = mSolo.getCurrentViews();
for (View view : views) {
// List may be displayed in different view formats.
// List may be displayed in different view formats.
// On JB, GridView is common; on ICS-, ListView is common.
if (view instanceof ListView ||
view instanceof GridView) {

Просмотреть файл

@ -1,5 +1,7 @@
package org.mozilla.gecko.tests;
import org.mozilla.gecko.Actions;
import org.mozilla.gecko.NewTabletUI;
/**
* This patch tests the option that shows the full URL and title in the URL Bar
@ -7,6 +9,11 @@ import org.mozilla.gecko.Actions;
public class testTitleBar extends PixelTest {
public void testTitleBar() {
// Because there is no title bar option on new tablet, we don't need to run this test.
if (NewTabletUI.isEnabled(getActivity())) {
return;
}
blockForGeckoReady();
checkOption();
}
@ -18,7 +25,7 @@ public class testTitleBar extends PixelTest {
// Loading a page
inputAndLoadUrl(blank1);
verifyPageTitle(title);
verifyPageTitle(title, blank1);
// Ensure the full URL is displayed in the URL Bar
selectOption(StringHelper.SHOW_PAGE_ADDRESS_LABEL);
@ -28,7 +35,7 @@ public class testTitleBar extends PixelTest {
// Ensure the title is displayed in the URL Bar
selectOption(StringHelper.SHOW_PAGE_TITLE_LABEL);
inputAndLoadUrl(blank1);
verifyPageTitle(title);
verifyPageTitle(title, blank1);
}
// Entering settings, changing the options: show title/page address option and verifing the device type because for phone there is an extra back action to exit the settings menu