Bug 1075531 - Part 2: Check for url in place of page titles on new tablet. r=lucasr
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 10 Oct 2014 11:35:41 -0700
changeset 210891 9eb089d7c2b99cd6e8e16b55b11e778f812d29e7
parent 210890 8882bf98a437f42c2bb0a76cda48d8d0b435ca3e
child 210892 ae71da76c7334651de8bcc069d51c42ed8a70b1d
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerslucasr
bugs1075531
milestone36.0a1
Bug 1075531 - Part 2: Check for url in place of page titles on new tablet. r=lucasr
mobile/android/base/tests/BaseTest.java
mobile/android/base/tests/SessionTest.java
mobile/android/base/tests/components/ToolbarComponent.java
mobile/android/base/tests/helpers/NavigationHelper.java
mobile/android/base/tests/testAboutHomeVisibility.java
mobile/android/base/tests/testAboutPage.java
mobile/android/base/tests/testAddSearchEngine.java
mobile/android/base/tests/testAddonManager.java
mobile/android/base/tests/testAppMenuPathways.java
mobile/android/base/tests/testBookmark.java
mobile/android/base/tests/testBookmarkFolders.java
mobile/android/base/tests/testBookmarkKeyword.java
mobile/android/base/tests/testBookmarklets.java
mobile/android/base/tests/testClearPrivateData.java
mobile/android/base/tests/testHistory.java
mobile/android/base/tests/testInputConnection.java
mobile/android/base/tests/testPictureLinkContextMenu.java
mobile/android/base/tests/testReaderMode.java
mobile/android/base/tests/testSelectionHandler.java
mobile/android/base/tests/testSessionHistory.java
mobile/android/base/tests/testShareLink.java
mobile/android/base/tests/testTitleBar.java
--- a/mobile/android/base/tests/BaseTest.java
+++ b/mobile/android/base/tests/BaseTest.java
@@ -20,16 +20,17 @@ import org.mozilla.gecko.Driver;
 import org.mozilla.gecko.Element;
 import org.mozilla.gecko.FennecNativeActions;
 import org.mozilla.gecko.FennecNativeDriver;
 import org.mozilla.gecko.GeckoAppShell;
 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;
 import org.mozilla.gecko.Tabs;
 
 import android.app.Activity;
 import android.content.ContentValues;
 import android.content.Intent;
@@ -64,16 +65,18 @@ abstract class BaseTest extends BaseRobo
     private static final int MAX_WAIT_ENABLED_TEXT_MS = 10000;
     private static final int MAX_WAIT_HOME_PAGER_HIDDEN_MS = 15000;
     private static final int MAX_WAIT_VERIFY_PAGE_TITLE_MS = 15000;
     public static final int MAX_WAIT_MS = 4500;
     public static final int LONG_PRESS_TIME = 6000;
     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;
     protected Driver mDriver;
     protected Actions mActions;
     protected String mBaseUrl;
     protected String mRawBaseUrl;
     protected String mProfile;
@@ -522,26 +525,44 @@ abstract class BaseTest extends BaseRobo
             }
         }, MAX_WAIT_HOME_PAGER_HIDDEN_MS);
 
         if (!rc) {
             mAsserter.ok(rc, "Verify HomePager is hidden", "HomePager is hidden");
         }
     }
 
-    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) {
             // Wait for the title to make sure it has been displayed in case the view
             // does not update fast enough
             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) {
         Element tabCount = mDriver.findElement(getActivity(), R.id.tabs_counter);
         String tabCountText = tabCount.getText();
         int tabCountInt = Integer.parseInt(tabCountText);
         mAsserter.is(tabCountInt, expectedTabCount, "The correct number of tabs are opened");
     }
--- a/mobile/android/base/tests/SessionTest.java
+++ b/mobile/android/base/tests/SessionTest.java
@@ -192,17 +192,17 @@ public abstract class SessionTest extend
                 (new NavigationWalker<PageInfo>(tab) {
                     @Override
                     public void onItem(PageInfo page, int currentIndex) {
                         if (page.url.equals(StringHelper.ABOUT_HOME_URL)) {
                             waitForText("Enter Search or Address");
                             verifyUrl(page.url);
                         } else {
                             waitForText(page.title);
-                            verifyPageTitle(page.title);
+                            verifyPageTitle(page.title, page.url);
                         }
                     }
 
                     @Override
                     public void goBack() {
                         mNavigation.back();
                     }
 
--- a/mobile/android/base/tests/components/ToolbarComponent.java
+++ b/mobile/android/base/tests/components/ToolbarComponent.java
@@ -4,48 +4,73 @@
 
 package org.mozilla.gecko.tests.components;
 
 import static org.mozilla.gecko.tests.helpers.AssertionHelper.fAssertEquals;
 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;
 import android.widget.EditText;
 import android.widget.ImageButton;
 import android.widget.TextView;
 
 import com.jayway.android.robotium.solo.Condition;
 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);
     }
 
     public ToolbarComponent assertIsEditing() {
         fAssertTrue("The toolbar is in the editing state", isEditing());
         return this;
     }
 
     public ToolbarComponent assertIsNotEditing() {
         fAssertFalse("The toolbar is not in the editing state", isEditing());
         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;
     }
 
     public ToolbarComponent assertUrl(final String expected) {
         assertIsEditing();
         fAssertEquals("The Toolbar url is " + expected, expected, getUrlEditText().getText());
         return this;
--- a/mobile/android/base/tests/helpers/NavigationHelper.java
+++ b/mobile/android/base/tests/helpers/NavigationHelper.java
@@ -39,17 +39,17 @@ final public class NavigationHelper {
         sToolbar.enterEditingMode()
                 .enterUrl(url)
                 .commitEditingMode();
     }
 
     /**
      * 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:")) {
             return url;
         }
 
         return sContext.getAbsoluteHostnameUrl(url);
     }
--- a/mobile/android/base/tests/testAboutHomeVisibility.java
+++ b/mobile/android/base/tests/testAboutHomeVisibility.java
@@ -8,48 +8,48 @@ import org.mozilla.gecko.tests.helpers.N
 /**
  * Tests the visibility of about:home after various interactions with the browser.
  */
 public class testAboutHomeVisibility extends UITest {
     public void testAboutHomeVisibility() {
         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.
         mToolbar.enterEditingMode();
         mAboutHome.assertVisible()
                   .assertCurrentPanel(PanelType.TOP_SITES);
 
         // Dismiss editing mode, where the about:home UI should be gone.
         mToolbar.dismissEditingMode();
         mAboutHome.assertNotVisible();
 
         // 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);
 
         // We can navigate to about:home panels by panel UUID.
         mAboutHome.navigateToBuiltinPanelType(PanelType.BOOKMARKS)
                   .assertVisible()
                   .assertCurrentPanel(PanelType.BOOKMARKS);
         mAboutHome.navigateToBuiltinPanelType(PanelType.HISTORY)
                   .assertVisible()
                   .assertCurrentPanel(PanelType.HISTORY);
-
-        // TODO: Type in a url and assert the go button is visible.
     }
 }
--- a/mobile/android/base/tests/testAboutPage.java
+++ b/mobile/android/base/tests/testAboutPage.java
@@ -1,50 +1,57 @@
 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");
         Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
 
         selectSettingsItem(StringHelper.MOZILLA_SECTION_LABEL, StringHelper.ABOUT_LABEL);
 
         // Wait for the new tab and page to load
         tabEventExpecter.blockForEvent();
         contentEventExpecter.blockForEvent();
 
         tabEventExpecter.unregisterListener();
         contentEventExpecter.unregisterListener();
 
         // Grab the title to make sure the about: page was loaded.
-        ensureTitleMatches(StringHelper.ABOUT_LABEL);
+        verifyPageTitle(StringHelper.ABOUT_LABEL, StringHelper.ABOUT_SCHEME);
     }
 }
--- a/mobile/android/base/tests/testAddSearchEngine.java
+++ b/mobile/android/base/tests/testAddSearchEngine.java
@@ -56,17 +56,17 @@ public class testAddSearchEngine extends
         mAsserter.dumpLog("Search Engines list = " + searchEngines.toString());
 
         // Verify that the number of displayed search engines is the same as the one received through the SearchEngines:Data event.
         verifyDisplayedSearchEnginesCount(initialNumSearchEngines);
 
         // 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();
         mAsserter.dumpLog("Long Clicking at width = " + String.valueOf(width) + " and height = " + String.valueOf(height));
         mSolo.clickLongOnScreen(width,height);
 
         ImageView view = waitForViewWithDescription(ImageView.class, ADD_SEARCHENGINE_OPTION_TEXT);
         mAsserter.isnot(view, null, "The action mode was opened");
@@ -94,17 +94,17 @@ public class testAddSearchEngine extends
             searchEngines = getSearchEnginesNames(eventData);
         } catch (JSONException e) {
             mAsserter.ok(false, "Fatal exception in testAddSearchEngine while decoding JSON search engine string from Gecko after adding of new engine.", e.toString());
             return;
         }
 
         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();
 
         // Verify that the search plugin XML file for the new engine ended up where we expected it to.
         // This file name is created in nsSearchService.js based on the name of the new engine.
         final File f = GeckoProfile.get(getActivity()).getFile("searchplugins/robocop-search-engine.xml");
         mAsserter.ok(f.exists(), "Checking that new search plugin file exists", "");
@@ -146,15 +146,15 @@ public class testAddSearchEngine extends
                 }
                 ListAdapter adapter = list.getAdapter();
                 if (adapter == null) {
                     return false;
                 }
                 return (adapter.getCount() == expectedCount);
             }
         }, MAX_WAIT_TEST_MS);
-        
+
         // Exit about:home
         mActions.sendSpecialKey(Actions.SpecialKey.BACK);
         waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
         mAsserter.ok(correctNumSearchEnginesDisplayed, expectedCount + " Search Engines should be displayed" , "The correct number of Search Engines has been displayed");
     }
 }
--- a/mobile/android/base/tests/testAddonManager.java
+++ b/mobile/android/base/tests/testAddonManager.java
@@ -12,17 +12,17 @@ import android.util.DisplayMetrics;
  * 2) Open the Add-on Manager by visiting about:addons in the URL bar.
  * 3) Open a new tab, select the Add-ons menu item, then verify that the existing
  *    Add-on Manager tab was selected, instead of opening a new tab.
  */
 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();
 
         // Use the menu to open the Addon Manger
         selectMenuItem(StringHelper.ADDONS_LABEL);
 
         // Set up listeners to catch the page load we're about to do
         tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
@@ -31,44 +31,45 @@ public class testAddonManager extends Pi
         // Wait for the new tab and page to load
         tabEventExpecter.blockForEvent();
         contentEventExpecter.blockForEvent();
 
         tabEventExpecter.unregisterListener();
         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();
         contentEventExpecter.blockForEvent();
 
         tabEventExpecter.unregisterListener();
         contentEventExpecter.unregisterListener();
 
         // Verify tab count has increased
         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);
 
         // Verify tab count not increased
         verifyTabCount(2);
     }
 }
--- a/mobile/android/base/tests/testAppMenuPathways.java
+++ b/mobile/android/base/tests/testAppMenuPathways.java
@@ -43,16 +43,17 @@ public class testAppMenuPathways extends
         Tabs.getInstance().handleMessage("Content:LocationChange", message);
 
         // Save as pdf menu is disabled while playing video.
         mAppMenu.assertMenuItemIsDisabledAndVisible(AppMenuComponent.PageMenuItem.SAVE_AS_PDF);
 
         // 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.
         // NOTE: save as pdf functionality must be done at the end as it is slow and cause other test operations to fail.
         mAppMenu.pressMenuItem(AppMenuComponent.PageMenuItem.SAVE_AS_PDF);
     }
 }
\ No newline at end of file
--- a/mobile/android/base/tests/testBookmark.java
+++ b/mobile/android/base/tests/testBookmark.java
@@ -27,17 +27,18 @@ public class testBookmark extends AboutH
         }
 
         mDatabaseHelper.addOrUpdateMobileBookmark(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE, BOOKMARK_URL);
         waitForBookmarked(true);
 
         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);
     }
 
     private void waitForBookmarked(final boolean isBookmarked) {
         boolean bookmarked = waitForTest(new BooleanTest() {
             @Override
--- a/mobile/android/base/tests/testBookmarkFolders.java
+++ b/mobile/android/base/tests/testBookmarkFolders.java
@@ -47,17 +47,17 @@ public class testBookmarkFolders extends
 
         clickOnBookmarkFolder(StringHelper.DESKTOP_FOLDER_LABEL);
         clickOnBookmarkFolder(StringHelper.TOOLBAR_FOLDER_LABEL);
         isBookmarkDisplayed(DESKTOP_BOOKMARK_URL);
 
         // 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
         boolean success = waitForCondition(new Condition() {
             @Override
             public boolean isSatisfied() {
                 View desktopFolder = getBookmarkFolderView(StringHelper.DESKTOP_FOLDER_LABEL);
                 if (desktopFolder == null) {
--- a/mobile/android/base/tests/testBookmarkKeyword.java
+++ b/mobile/android/base/tests/testBookmarkKeyword.java
@@ -14,14 +14,15 @@ public class testBookmarkKeyword extends
 
         // Enter the keyword in the urlbar.
         inputAndLoadUrl(keyword);
 
         // Wait for the page to load.
         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);
     }
 }
--- a/mobile/android/base/tests/testBookmarklets.java
+++ b/mobile/android/base/tests/testBookmarklets.java
@@ -13,17 +13,19 @@ public class testBookmarklets extends Ab
         final String title = "alertBookmarklet";
         final String js = "javascript:alert(12 + .34)";
         boolean alerted;
 
         blockForGeckoReady();
 
         // 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);
         mActions.sendSpecialKey(Actions.SpecialKey.ENTER);
         alerted = waitForTest(new BooleanTest() {
             @Override
             public boolean test() {
                 return mSolo.searchButton("OK", true) || mSolo.searchText("12.34", true);
--- a/mobile/android/base/tests/testClearPrivateData.java
+++ b/mobile/android/base/tests/testClearPrivateData.java
@@ -25,24 +25,24 @@ public class testClearPrivateData extend
 
     private void clearHistory() {
 
         // Loading a page and adding a second one as bookmark to have user made bookmarks and history
         String blank1 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
         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);
 
         // Checking that the user made bookmark is not removed
         mAsserter.ok(mDatabaseHelper.isBookmark(blank2), "Checking that bookmarks have not been removed", "User made bookmarks were not removed with private data");
     }
 
@@ -60,44 +60,40 @@ public class testClearPrivateData extend
         String shareStrings[] = {"Share your location with", "Share", "Don't share", "There are no settings to clear"};
         String titleGeolocation = StringHelper.ROBOCOP_GEOLOCATION_TITLE;
         String url = getAbsoluteUrl(StringHelper.ROBOCOP_GEOLOCATION_URL);
         loadCheckDismiss(shareStrings[1], url, shareStrings[0]);
         checkOption(shareStrings[1], "Clear");
         checkOption(shareStrings[3], "Cancel");
         loadCheckDismiss(shareStrings[2], url, shareStrings[0]);
         checkOption(shareStrings[2], "Cancel");
-        checkDevice(titleGeolocation);
+        checkDevice(titleGeolocation, url);
     }
 
     public void clearPassword(){
         String passwordStrings[] = {"Save password", "Save", "Don't save"};
         String title = StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE;
         String loginUrl = getAbsoluteUrl(StringHelper.ROBOCOP_LOGIN_URL);
         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);
         waitForText(message);
         mAsserter.is(mSolo.searchText(message), true, "Doorhanger:" + message + " has been displayed");
         mSolo.clickOnButton(option);
         mAsserter.is(mSolo.searchText(message), false, "Doorhanger:" + message + " has been hidden");
     }
--- a/mobile/android/base/tests/testHistory.java
+++ b/mobile/android/base/tests/testHistory.java
@@ -12,21 +12,21 @@ public class testHistory extends AboutHo
     public void testHistory() {
         blockForGeckoReady();
 
         String url = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
         String url2 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_02_URL);
         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);
 
         final ListView hList = findListViewWithTag(HomePager.LIST_TAG_HISTORY);
         mAsserter.is(waitForNonEmptyListToLoad(hList), true, "list is properly loaded");
 
         // Click on the history item and wait for the page to load
         // wait for the history list to be populated
@@ -57,12 +57,12 @@ public class testHistory extends AboutHo
             }
         }, MAX_WAIT_MS);
 
         mAsserter.isnot(mFirstChild, null, "Got history item");
         mSolo.clickOnView(mFirstChild);
 
         // 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);
     }
 }
--- a/mobile/android/base/tests/testInputConnection.java
+++ b/mobile/android/base/tests/testInputConnection.java
@@ -19,18 +19,19 @@ import android.view.inputmethod.InputCon
  */
 public class testInputConnection extends UITest {
 
     private static final String INITIAL_TEXT = "foo";
 
     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()
             .testInputConnection(new BasicInputConnectionTest());
     }
 
     private class BasicInputConnectionTest implements InputConnectionTest {
         @Override
--- a/mobile/android/base/tests/testPictureLinkContextMenu.java
+++ b/mobile/android/base/tests/testPictureLinkContextMenu.java
@@ -13,17 +13,17 @@ public class testPictureLinkContextMenu 
     private static final String imageTitle = "^Image$";
 
     public void testPictureLinkContextMenu() {
         blockForGeckoReady();
 
         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);
         verifyTabs(tabs);
         switchTabs(imageTitle);
         verifyCopyOption(photoMenuItems[0], "Firefox.jpg"); // Test the "Copy Image Location" option
         switchTabs(imageTitle);
         verifyShareOption(photoMenuItems[1], PICTURE_PAGE_TITLE); // Test the "Share Image" option
--- a/mobile/android/base/tests/testReaderMode.java
+++ b/mobile/android/base/tests/testReaderMode.java
@@ -68,17 +68,17 @@ public class testReaderMode extends Abou
         // Changing devices orientation to be sure that all devices are in portrait when will access the reader toolbar
         mSolo.setActivityOrientation(Solo.PORTRAIT);
         faviconExpecter.blockForEvent();
         faviconExpecter.unregisterListener();
         contentPageShowExpecter.blockForEvent();
         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;
         width = mDriver.getGeckoLeft() + mDriver.getGeckoWidth() - 10;
         mAsserter.dumpLog("Long Clicking at width = " + String.valueOf(width) + " and height = " + String.valueOf(height));
         mSolo.clickOnScreen(width,height);
         mAsserter.ok(mSolo.waitForText("Share via"), "Waiting for the share menu", "The share menu is present");
         mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Close the share menu
@@ -129,25 +129,25 @@ public class testReaderMode extends Abou
         openAboutHomeTab(AboutHomeTabs.READING_LIST);
         list = findListViewWithTag(HomePager.LIST_TAG_READING_LIST);
         child = list.getChildAt(childNo-1);
         mAsserter.ok(child != null, "Verify if the page is present to your Reading List", "The page is present in your Reading List");
         contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
         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;
         width = mDriver.getGeckoLeft() + 50;
         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);
         list = findListViewWithTag(HomePager.LIST_TAG_READING_LIST);
         child = list.getChildAt(childNo-1);
         mAsserter.ok(child == null, "Verify if the Reading List is empty", "The Reading List is empty");
     }
 
--- a/mobile/android/base/tests/testSelectionHandler.java
+++ b/mobile/android/base/tests/testSelectionHandler.java
@@ -11,18 +11,19 @@ import org.json.JSONObject;
 
 
 public class testSelectionHandler extends UITest {
 
     public void testSelectionHandler() {
         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
         }
 
         robocopTestExpecter.unregisterListener();
     }
 
--- a/mobile/android/base/tests/testSessionHistory.java
+++ b/mobile/android/base/tests/testSessionHistory.java
@@ -5,30 +5,37 @@ import org.mozilla.gecko.tests.helpers.N
 
 /**
  * Tests that navigating through session history (ex: forward, back) sets the correct UI state.
  */
 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);
     }
 }
--- a/mobile/android/base/tests/testShareLink.java
+++ b/mobile/android/base/tests/testShareLink.java
@@ -32,17 +32,17 @@ public class testShareLink extends About
         url = getAbsoluteUrl(StringHelper.ROBOCOP_BIG_LINK_URL);
         ArrayList<String> shareOptions;
         blockForGeckoReady();
 
         // FIXME: This is a temporary hack workaround for a permissions problem.
         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) {
             // Check for our own sync in the submenu.
             waitForText("Sync$");
         } else {
             waitForText("Share via");
         }
@@ -243,17 +243,17 @@ public class testShareLink extends About
 
     private AbsListView getDisplayedShareList() {
         mViewGroup = null;
         boolean success = waitForTest(new BooleanTest() {
             @Override
             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) {
                         mViewGroup = (AbsListView)view;
                         return true;
                     }
                 }
                 return false;
--- a/mobile/android/base/tests/testTitleBar.java
+++ b/mobile/android/base/tests/testTitleBar.java
@@ -1,39 +1,46 @@
 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
  */
 
 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);
 
         // Ensure the full URL is displayed in the URL Bar
         selectOption(StringHelper.SHOW_PAGE_ADDRESS_LABEL);
         inputAndLoadUrl(blank1);
         verifyUrl(blank1);
 
         // 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
     public void selectOption(String option) {
         selectSettingsItem(StringHelper.DISPLAY_SECTION_LABEL, StringHelper.TITLE_BAR_LABEL);
         mAsserter.ok(waitForText(StringHelper.SHOW_PAGE_TITLE_LABEL), "Waiting for the pop-up to open", "Pop up with the options was openend");
         mSolo.clickOnText(option);
         mAsserter.ok(waitForText(StringHelper.CHARACTER_ENCODING_LABEL), "Waiting to press the option", "The pop-up is dismissed once clicked");