diff --git a/mobile/android/base/tests/BaseTest.java b/mobile/android/base/tests/BaseTest.java index 2e8207fb36a..2f7ddb42412 100644 --- a/mobile/android/base/tests/BaseTest.java +++ b/mobile/android/base/tests/BaseTest.java @@ -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; @@ -68,6 +69,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; @@ -446,7 +449,7 @@ abstract class BaseTest extends BaseRobocopTest { } - /** + /** * Select from Menu > "Settings" >
. */ public void selectSettingsItem(String section, String item) { @@ -504,7 +507,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) { @@ -513,7 +534,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) { @@ -935,7 +956,7 @@ abstract class BaseTest extends BaseRobocopTest { public void setPreferenceAndWaitForChange(final JSONObject jsonPref) { mActions.sendGeckoEvent("Preferences:Set", jsonPref.toString()); - // Get the preference name from the json and store it in an array. This array + // Get the preference name from the json and store it in an array. This array // will be used later while fetching the preference data. String[] prefNames = new String[1]; try { diff --git a/mobile/android/base/tests/SessionTest.java b/mobile/android/base/tests/SessionTest.java index 53c1e40031d..4ff05e690d0 100644 --- a/mobile/android/base/tests/SessionTest.java +++ b/mobile/android/base/tests/SessionTest.java @@ -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); } } diff --git a/mobile/android/base/tests/components/ToolbarComponent.java b/mobile/android/base/tests/components/ToolbarComponent.java index 4642a2b3948..2aa79eb42d3 100644 --- a/mobile/android/base/tests/components/ToolbarComponent.java +++ b/mobile/android/base/tests/components/ToolbarComponent.java @@ -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; } @@ -91,7 +116,7 @@ public class ToolbarComponent extends BaseComponent { return (ImageButton) getToolbarView().findViewById(R.id.edit_cancel); } - private CharSequence getTitle() { + private String getTitle() { return getTitleHelper(true); } @@ -100,16 +125,16 @@ public class ToolbarComponent extends BaseComponent { * may return a value that may never be visible to the user. Callers likely want to use * {@link assertTitle} instead. */ - public CharSequence getPotentiallyInconsistentTitle() { + public String getPotentiallyInconsistentTitle() { return getTitleHelper(false); } - private CharSequence getTitleHelper(final boolean shouldAssertNotEditing) { + private String getTitleHelper(final boolean shouldAssertNotEditing) { if (shouldAssertNotEditing) { assertIsNotEditing(); } - return getUrlTitleText().getText(); + return getUrlTitleText().getText().toString(); } private boolean isEditing() { diff --git a/mobile/android/base/tests/helpers/NavigationHelper.java b/mobile/android/base/tests/helpers/NavigationHelper.java index 8d7f1f0b73a..eb80f71faca 100644 --- a/mobile/android/base/tests/helpers/NavigationHelper.java +++ b/mobile/android/base/tests/helpers/NavigationHelper.java @@ -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:")) { diff --git a/mobile/android/base/tests/testAboutHomeVisibility.java b/mobile/android/base/tests/testAboutHomeVisibility.java index 3f408c11970..979eb412a60 100644 --- a/mobile/android/base/tests/testAboutHomeVisibility.java +++ b/mobile/android/base/tests/testAboutHomeVisibility.java @@ -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. } } diff --git a/mobile/android/base/tests/testAboutPage.java b/mobile/android/base/tests/testAboutPage.java index cd47be2703e..abca8e5a5ac 100644 --- a/mobile/android/base/tests/testAboutPage.java +++ b/mobile/android/base/tests/testAboutPage.java @@ -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); } } diff --git a/mobile/android/base/tests/testAddSearchEngine.java b/mobile/android/base/tests/testAddSearchEngine.java index d218fedd3a9..4b64f2efd69 100644 --- a/mobile/android/base/tests/testAddSearchEngine.java +++ b/mobile/android/base/tests/testAddSearchEngine.java @@ -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); diff --git a/mobile/android/base/tests/testAddonManager.java b/mobile/android/base/tests/testAddonManager.java index d4033cc374a..8336dfb2693 100644 --- a/mobile/android/base/tests/testAddonManager.java +++ b/mobile/android/base/tests/testAddonManager.java @@ -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); diff --git a/mobile/android/base/tests/testAppMenuPathways.java b/mobile/android/base/tests/testAppMenuPathways.java index 42c369ebcb4..d1f4485186d 100644 --- a/mobile/android/base/tests/testAppMenuPathways.java +++ b/mobile/android/base/tests/testAppMenuPathways.java @@ -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. diff --git a/mobile/android/base/tests/testBookmark.java b/mobile/android/base/tests/testBookmark.java index 83922e7698b..1e48eac7a39 100644 --- a/mobile/android/base/tests/testBookmark.java +++ b/mobile/android/base/tests/testBookmark.java @@ -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); diff --git a/mobile/android/base/tests/testBookmarkFolders.java b/mobile/android/base/tests/testBookmarkFolders.java index b584633bdd6..ec65c68e026 100644 --- a/mobile/android/base/tests/testBookmarkFolders.java +++ b/mobile/android/base/tests/testBookmarkFolders.java @@ -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 diff --git a/mobile/android/base/tests/testBookmarkKeyword.java b/mobile/android/base/tests/testBookmarkKeyword.java index f17c36d47a2..f7cd6cca678 100644 --- a/mobile/android/base/tests/testBookmarkKeyword.java +++ b/mobile/android/base/tests/testBookmarkKeyword.java @@ -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); diff --git a/mobile/android/base/tests/testBookmarklets.java b/mobile/android/base/tests/testBookmarklets.java index c191625b54b..637cf522500 100644 --- a/mobile/android/base/tests/testBookmarklets.java +++ b/mobile/android/base/tests/testBookmarklets.java @@ -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); diff --git a/mobile/android/base/tests/testClearPrivateData.java b/mobile/android/base/tests/testClearPrivateData.java index ec1aacfb755..fe6ded6e96a 100644 --- a/mobile/android/base/tests/testClearPrivateData.java +++ b/mobile/android/base/tests/testClearPrivateData.java @@ -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); @@ -64,7 +64,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(){ @@ -74,24 +74,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); diff --git a/mobile/android/base/tests/testHistory.java b/mobile/android/base/tests/testHistory.java index 73db0c88f26..73fce7a221d 100644 --- a/mobile/android/base/tests/testHistory.java +++ b/mobile/android/base/tests/testHistory.java @@ -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); } } diff --git a/mobile/android/base/tests/testInputConnection.java b/mobile/android/base/tests/testInputConnection.java index 96f365fc1b6..e7d3bc73948 100644 --- a/mobile/android/base/tests/testInputConnection.java +++ b/mobile/android/base/tests/testInputConnection.java @@ -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() diff --git a/mobile/android/base/tests/testPictureLinkContextMenu.java b/mobile/android/base/tests/testPictureLinkContextMenu.java index 0e6f77ba92b..1801936341d 100644 --- a/mobile/android/base/tests/testPictureLinkContextMenu.java +++ b/mobile/android/base/tests/testPictureLinkContextMenu.java @@ -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); diff --git a/mobile/android/base/tests/testReaderMode.java b/mobile/android/base/tests/testReaderMode.java index 491bc82b81e..3b10e4609ce 100644 --- a/mobile/android/base/tests/testReaderMode.java +++ b/mobile/android/base/tests/testReaderMode.java @@ -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); diff --git a/mobile/android/base/tests/testSelectionHandler.java b/mobile/android/base/tests/testSelectionHandler.java index 5684bafd582..14206a362d6 100644 --- a/mobile/android/base/tests/testSelectionHandler.java +++ b/mobile/android/base/tests/testSelectionHandler.java @@ -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 diff --git a/mobile/android/base/tests/testSessionHistory.java b/mobile/android/base/tests/testSessionHistory.java index e1e3c258371..ad13c65f273 100644 --- a/mobile/android/base/tests/testSessionHistory.java +++ b/mobile/android/base/tests/testSessionHistory.java @@ -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); } } diff --git a/mobile/android/base/tests/testShareLink.java b/mobile/android/base/tests/testShareLink.java index 1e6c5d8ce61..6b8062a287b 100644 --- a/mobile/android/base/tests/testShareLink.java +++ b/mobile/android/base/tests/testShareLink.java @@ -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 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) { diff --git a/mobile/android/base/tests/testTitleBar.java b/mobile/android/base/tests/testTitleBar.java index 403d9b809a5..dde15de551f 100644 --- a/mobile/android/base/tests/testTitleBar.java +++ b/mobile/android/base/tests/testTitleBar.java @@ -1,5 +1,6 @@ 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,18 +8,22 @@ 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(); } public void checkOption() { - String blank1 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL); String title = StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE; // Loading a page inputAndLoadUrl(blank1); - verifyPageTitle(title); + verifyPageTitle(title, blank1); // Verifing the full URL is displayed in the URL Bar selectOption(StringHelper.SHOW_PAGE_ADDRESS_LABEL); @@ -28,7 +33,7 @@ public class testTitleBar extends PixelTest { // Verifing 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