Backed out changeset 683b81f8a9d3 (bug 1075531) for bustage.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-10-10 16:32:17 -04:00
parent c58eee4726
commit 88d01970e9
22 changed files with 146 additions and 77 deletions

View File

@ -25,6 +25,7 @@ import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.GeckoProfile; import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.GeckoThread; import org.mozilla.gecko.GeckoThread;
import org.mozilla.gecko.GeckoThread.LaunchState; import org.mozilla.gecko.GeckoThread.LaunchState;
import org.mozilla.gecko.NewTabletUI;
import org.mozilla.gecko.R; import org.mozilla.gecko.R;
import org.mozilla.gecko.RobocopUtils; import org.mozilla.gecko.RobocopUtils;
import org.mozilla.gecko.Tab; import org.mozilla.gecko.Tab;
@ -68,6 +69,8 @@ abstract class BaseTest extends BaseRobocopTest {
private static final int GECKO_READY_WAIT_MS = 180000; private static final int GECKO_READY_WAIT_MS = 180000;
public static final int MAX_WAIT_BLOCK_FOR_EVENT_DATA_MS = 90000; public static final int MAX_WAIT_BLOCK_FOR_EVENT_DATA_MS = 90000;
private static final String URL_HTTP_PREFIX = "http://";
private Activity mActivity; private Activity mActivity;
private int mPreferenceRequestID = 0; private int mPreferenceRequestID = 0;
protected Solo mSolo; protected Solo mSolo;
@ -446,7 +449,7 @@ abstract class BaseTest extends BaseRobocopTest {
} }
/** /**
* Select <item> from Menu > "Settings" > <section>. * Select <item> from Menu > "Settings" > <section>.
*/ */
public void selectSettingsItem(String section, String item) { 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); final TextView urlBarTitle = (TextView) mSolo.getView(R.id.url_bar_title);
String pageTitle = null; String pageTitle = null;
if (urlBarTitle != null) { if (urlBarTitle != null) {
@ -513,7 +534,7 @@ abstract class BaseTest extends BaseRobocopTest {
waitForCondition(new VerifyTextViewText(urlBarTitle, title), MAX_WAIT_VERIFY_PAGE_TITLE_MS); waitForCondition(new VerifyTextViewText(urlBarTitle, title), MAX_WAIT_VERIFY_PAGE_TITLE_MS);
pageTitle = urlBarTitle.getText().toString(); 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) { public final void verifyTabCount(int expectedTabCount) {
@ -935,7 +956,7 @@ abstract class BaseTest extends BaseRobocopTest {
public void setPreferenceAndWaitForChange(final JSONObject jsonPref) { public void setPreferenceAndWaitForChange(final JSONObject jsonPref) {
mActions.sendGeckoEvent("Preferences:Set", jsonPref.toString()); 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. // will be used later while fetching the preference data.
String[] prefNames = new String[1]; String[] prefNames = new String[1];
try { try {

View File

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

View File

@ -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.fAssertNotNull;
import static org.mozilla.gecko.tests.helpers.AssertionHelper.fAssertTrue; import static org.mozilla.gecko.tests.helpers.AssertionHelper.fAssertTrue;
import org.mozilla.gecko.NewTabletUI;
import org.mozilla.gecko.R; import org.mozilla.gecko.R;
import org.mozilla.gecko.tests.StringHelper;
import org.mozilla.gecko.tests.UITestContext; import org.mozilla.gecko.tests.UITestContext;
import org.mozilla.gecko.tests.helpers.DeviceHelper; import org.mozilla.gecko.tests.helpers.DeviceHelper;
import org.mozilla.gecko.tests.helpers.NavigationHelper;
import org.mozilla.gecko.tests.helpers.WaitHelper; import org.mozilla.gecko.tests.helpers.WaitHelper;
import android.view.View; 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. * A class representing any interactions that take place on the Toolbar.
*/ */
public class ToolbarComponent extends BaseComponent { public class ToolbarComponent extends BaseComponent {
private static final String URL_HTTP_PREFIX = "http://";
public ToolbarComponent(final UITestContext testContext) { public ToolbarComponent(final UITestContext testContext) {
super(testContext); super(testContext);
} }
@ -40,7 +46,26 @@ public class ToolbarComponent extends BaseComponent {
return this; 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()); fAssertEquals("The Toolbar title is " + expected, expected, getTitle());
return this; return this;
} }
@ -91,7 +116,7 @@ public class ToolbarComponent extends BaseComponent {
return (ImageButton) getToolbarView().findViewById(R.id.edit_cancel); return (ImageButton) getToolbarView().findViewById(R.id.edit_cancel);
} }
private CharSequence getTitle() { private String getTitle() {
return getTitleHelper(true); 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 * may return a value that may never be visible to the user. Callers likely want to use
* {@link assertTitle} instead. * {@link assertTitle} instead.
*/ */
public CharSequence getPotentiallyInconsistentTitle() { public String getPotentiallyInconsistentTitle() {
return getTitleHelper(false); return getTitleHelper(false);
} }
private CharSequence getTitleHelper(final boolean shouldAssertNotEditing) { private String getTitleHelper(final boolean shouldAssertNotEditing) {
if (shouldAssertNotEditing) { if (shouldAssertNotEditing) {
assertIsNotEditing(); assertIsNotEditing();
} }
return getUrlTitleText().getText(); return getUrlTitleText().getText().toString();
} }
private boolean isEditing() { private boolean isEditing() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,7 +32,8 @@ public class testBookmark extends AboutHomeTest {
isBookmarkDisplayed(BOOKMARK_URL); isBookmarkDisplayed(BOOKMARK_URL);
loadBookmark(BOOKMARK_URL); loadBookmark(BOOKMARK_URL);
waitForText(StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE); 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); mDatabaseHelper.deleteBookmark(BOOKMARK_URL);
waitForBookmarked(false); waitForBookmarked(false);

View File

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

View File

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

View File

@ -18,7 +18,9 @@ public class testBookmarklets extends AboutHomeTest {
// load a standard page so bookmarklets work // load a standard page so bookmarklets work
inputAndLoadUrl(url); 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 // verify that user-entered bookmarklets do *not* work
enterUrl(js); enterUrl(js);

View File

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

View File

@ -17,11 +17,11 @@ public class testHistory extends AboutHomeTest {
String url3 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_03_URL); String url3 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_03_URL);
inputAndLoadUrl(url); inputAndLoadUrl(url);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_URL); verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_01_URL, url);
inputAndLoadUrl(url2); inputAndLoadUrl(url2);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_URL); verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_02_URL, url2);
inputAndLoadUrl(url3); inputAndLoadUrl(url3);
verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_03_URL); verifyPageTitle(StringHelper.ROBOCOP_BLANK_PAGE_03_URL, url3);
openAboutHomeTab(AboutHomeTabs.HISTORY); 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 // The first item here (since it was just visited) should be a "Switch to tab" item
// i.e. don't expect a DOMCOntentLoaded event // 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); verifyUrl(url3);
} }
} }

View File

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

View File

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

View File

@ -73,7 +73,7 @@ public class testReaderMode extends AboutHomeTest {
contentPageShowExpecter.unregisterListener(); contentPageShowExpecter.unregisterListener();
paintExpecter.blockUntilClear(EVENT_CLEAR_DELAY_MS); paintExpecter.blockUntilClear(EVENT_CLEAR_DELAY_MS);
paintExpecter.unregisterListener(); 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 // Open the share menu for the reader toolbar
height = mDriver.getGeckoTop() + mDriver.getGeckoHeight() - 10; height = mDriver.getGeckoTop() + mDriver.getGeckoHeight() - 10;
@ -134,7 +134,7 @@ public class testReaderMode extends AboutHomeTest {
mSolo.clickOnView(child); mSolo.clickOnView(child);
contentEventExpecter.blockForEvent(); contentEventExpecter.blockForEvent();
contentEventExpecter.unregisterListener(); 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 // Verify that we are in reader mode and remove the page from Reading List
height = mDriver.getGeckoTop() + mDriver.getGeckoHeight() - 10; 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)); mAsserter.dumpLog("Long Clicking at width = " + String.valueOf(width) + " and height = " + String.valueOf(height));
mSolo.clickOnScreen(width,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"); 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 //Check if the Reading List is empty
openAboutHomeTab(AboutHomeTabs.READING_LIST); openAboutHomeTab(AboutHomeTabs.READING_LIST);

View File

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

View File

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

View File

@ -37,7 +37,7 @@ public class testShareLink extends AboutHomeTest {
openAboutHomeTab(AboutHomeTabs.READING_LIST); openAboutHomeTab(AboutHomeTabs.READING_LIST);
inputAndLoadUrl(url); 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); selectMenuItem(StringHelper.SHARE_LABEL);
if (Build.VERSION.SDK_INT >= 14) { if (Build.VERSION.SDK_INT >= 14) {
@ -248,7 +248,7 @@ public class testShareLink extends AboutHomeTest {
public boolean test() { public boolean test() {
ArrayList<View> views = mSolo.getCurrentViews(); ArrayList<View> views = mSolo.getCurrentViews();
for (View view : views) { 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. // On JB, GridView is common; on ICS-, ListView is common.
if (view instanceof ListView || if (view instanceof ListView ||
view instanceof GridView) { view instanceof GridView) {

View File

@ -1,5 +1,6 @@
package org.mozilla.gecko.tests; package org.mozilla.gecko.tests;
import org.mozilla.gecko.Actions; 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 * 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 class testTitleBar extends PixelTest {
public void testTitleBar() { 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(); blockForGeckoReady();
checkOption(); checkOption();
} }
public void checkOption() { public void checkOption() {
String blank1 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL); String blank1 = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String title = StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE; String title = StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE;
// Loading a page // Loading a page
inputAndLoadUrl(blank1); inputAndLoadUrl(blank1);
verifyPageTitle(title); verifyPageTitle(title, blank1);
// Verifing the full URL is displayed in the URL Bar // Verifing the full URL is displayed in the URL Bar
selectOption(StringHelper.SHOW_PAGE_ADDRESS_LABEL); selectOption(StringHelper.SHOW_PAGE_ADDRESS_LABEL);
@ -28,7 +33,7 @@ public class testTitleBar extends PixelTest {
// Verifing the title is displayed in the URL Bar // Verifing the title is displayed in the URL Bar
selectOption(StringHelper.SHOW_PAGE_TITLE_LABEL); selectOption(StringHelper.SHOW_PAGE_TITLE_LABEL);
inputAndLoadUrl(blank1); 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 // 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