diff --git a/mobile/android/base/tests/testAddonManager.java.in b/mobile/android/base/tests/testAddonManager.java.in old mode 100755 new mode 100644 diff --git a/mobile/android/base/tests/testClearPrivateData.java.in b/mobile/android/base/tests/testClearPrivateData.java.in index c7eff1ec1a8..b309d935a2e 100644 --- a/mobile/android/base/tests/testClearPrivateData.java.in +++ b/mobile/android/base/tests/testClearPrivateData.java.in @@ -20,7 +20,7 @@ public class testClearPrivateData extends PixelTest { public void testClearPrivateData() { blockForGeckoReady(); - clearHistory(); + clearHistory(); } private void clearHistory() { diff --git a/mobile/android/base/tests/testFormHistory.java.in b/mobile/android/base/tests/testFormHistory.java.in index 2b687865d05..c468c7152b7 100644 --- a/mobile/android/base/tests/testFormHistory.java.in +++ b/mobile/android/base/tests/testFormHistory.java.in @@ -32,8 +32,8 @@ public class testFormHistory extends BaseTest { ContentResolver cr = context.getContentResolver(); ContentValues[] cvs = new ContentValues[1]; cvs[0] = new ContentValues(); - - blockForGeckoReady(); + + blockForGeckoReady(); Uri formHistoryUri; Uri insertUri; @@ -99,7 +99,7 @@ public class testFormHistory extends BaseTest { numUpdated = cr.update(formHistoryUri, cvs[0], null, null); mAsserter.is(1, numUpdated, "Correct number updated"); SqliteCompare(DB_NAME, "SELECT * FROM moz_formhistory", cvs); - + numDeleted = cr.delete(formHistoryUri, null, null); mAsserter.is(1, numDeleted, "Correct number deleted"); cvs = new ContentValues[0]; @@ -107,15 +107,15 @@ public class testFormHistory extends BaseTest { } public void tearDown() throws Exception { - // remove the entire signons.sqlite file - File profile = new File(mProfile); - File db = new File(profile, "formhistory.sqlite"); - if (db.delete()) { - mAsserter.dumpLog("tearDown deleted "+db.toString()); - } else { - mAsserter.dumpLog("tearDown did not delete "+db.toString()); - } + // remove the entire signons.sqlite file + File profile = new File(mProfile); + File db = new File(profile, "formhistory.sqlite"); + if (db.delete()) { + mAsserter.dumpLog("tearDown deleted "+db.toString()); + } else { + mAsserter.dumpLog("tearDown did not delete "+db.toString()); + } - super.tearDown(); + super.tearDown(); } } diff --git a/mobile/android/base/tests/testPan.java.in b/mobile/android/base/tests/testPan.java.in index 1fb87e30c91..74cefc8c231 100644 --- a/mobile/android/base/tests/testPan.java.in +++ b/mobile/android/base/tests/testPan.java.in @@ -47,5 +47,5 @@ public class testPan extends PixelTest { mAsserter.dumpLog("__start_report" + Integer.toString(frames) + "__end_report"); long msecs = System.currentTimeMillis(); mAsserter.dumpLog("__startTimestamp" + msecs + "__endTimestamp"); - } + } } diff --git a/mobile/android/base/tests/testSettingsMenuItems.java.in b/mobile/android/base/tests/testSettingsMenuItems.java.in index 8aa80a70433..49133533955 100644 --- a/mobile/android/base/tests/testSettingsMenuItems.java.in +++ b/mobile/android/base/tests/testSettingsMenuItems.java.in @@ -3,10 +3,12 @@ package @ANDROID_PACKAGE_NAME@.tests; import @ANDROID_PACKAGE_NAME@.*; -// This patch tests the Sections present in the Settings Menu and the default values for them +/** This patch tests the Sections present in the Settings Menu and the + * default values for them + */ public class testSettingsMenuItems extends PixelTest { - int midWidth; - int midHeight; + int midWidth; + int midHeight; @Override protected int getTestType() { @@ -15,73 +17,73 @@ public class testSettingsMenuItems extends PixelTest { public void testSettingsMenuItems() { blockForGeckoReady(); - midWidth = mDriver.getGeckoWidth()/2; - midHeight = mDriver.getGeckoHeight()/2; + midWidth = mDriver.getGeckoWidth()/2; + midHeight = mDriver.getGeckoHeight()/2; // In this First Section I've declared the strings that contain the Menu sections - // The first string contains menu sections that do not have multiple option - String menuItems [] = { "General", "About", "Sync", "Content", "Pinch to reflow text", "Privacy & Security", "Tell sites not to track me", "Remember passwords", "Use master password", "Show search suggestions", "Show product announcements", "Import & Export"}; - // This string contains every menu section that have multiple selection options followed by the option that is selected by default - String defaultSectionsValues [] = { "Automatic updates", "Only over Wi-Fi", "Character encoding", "Don't show menu","Plugins", "Tap to play", "Text size", "Tiny", "Cookies", "Enable"}; + // The first string contains menu sections that do not have multiple option + String menuItems [] = { "General", "About", "Sync", "Content", "Pinch to reflow text", "Privacy & Security", "Tell sites not to track me", "Remember passwords", "Use master password", "Show search suggestions", "Show product announcements", "Import & Export"}; + // This string contains every menu section that have multiple selection options followed by the option that is selected by default + String defaultSectionsValues [] = { "Automatic updates", "Only over Wi-Fi", "Character encoding", "Don't show menu","Plugins", "Tap to play", "Text size", "Tiny", "Cookies", "Enable"}; - // This string contains multiple selection options and every option available for each of them - String multipleSectionsOptions[][] = { - { "Automatic updates", "Enable", "Only over Wi-Fi", "Disable"}, - { "Character encoding", "Show menu", "Don't show menu"}, - { "Plugins", "Enable", "Tap to play", "Disable"}, - { "Cookies", "Enable", "Enabled, excluding 3rd party", "Disable"}, - { "Clear private data", "Browsing & download history", "Form & search history", "Cookies & active logins", "Saved passwords", "Cache", "Offline website data", "Site preferences"}, - { "Import from Android", "Bookmarks", "History"} + // This string contains multiple selection options and every option available for each of them + String multipleSectionsOptions[][] = { + { "Automatic updates", "Enable", "Only over Wi-Fi", "Disable"}, + { "Character encoding", "Show menu", "Don't show menu"}, + { "Plugins", "Enable", "Tap to play", "Disable"}, + { "Cookies", "Enable", "Enabled, excluding 3rd party", "Disable"}, + { "Clear private data", "Browsing & download history", "Form & search history", "Cookies & active logins", "Saved passwords", "Cache", "Offline website data", "Site preferences"}, + { "Import from Android", "Bookmarks", "History"} }; selectMenuItem("Settings"); - // Dismiss the Settings screen and verify that the view is returned to about:home page - mActions.sendSpecialKey(Actions.SpecialKey.BACK); - verifyUrl("about:home"); + // Dismiss the Settings screen and verify that the view is returned to about:home page mActions.sendSpecialKey(Actions.SpecialKey.BACK); - mSolo.waitForText("Enter Search"); // Waiting for page title to appear to be sure that is fully loaded before opening the menu + verifyUrl("about:home"); + mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.waitForText("Enter Search"); // Waiting for page title to appear to be sure that is fully loaded before opening the menu - selectMenuItem("Settings"); - checkMenuSections(menuItems); - mSolo.scrollUp(); // Scrolling up the page to have in view the top sections - mSolo.scrollUp(); // Repeat scroll up because the top sections were not reached + selectMenuItem("Settings"); + checkMenuSections(menuItems); + mSolo.scrollUp(); // Scrolling up the page to have in view the top sections + mSolo.scrollUp(); // Repeat scroll up because the top sections were not reached - checkMenuSections(defaultSectionsValues); - mSolo.scrollUp(); // Scrolling up the page to have in view the top sections again + checkMenuSections(defaultSectionsValues); + mSolo.scrollUp(); // Scrolling up the page to have in view the top sections again - checkMenuSubSections(multipleSectionsOptions); + checkMenuSubSections(multipleSectionsOptions); } + public void checkMenuSections(String menuItems []) { for (String item:menuItems) { - mAsserter.ok(mSolo.waitForText(item), "Waiting for " + item + " option", "The " + item + " option is present"); + mAsserter.ok(mSolo.waitForText(item), "Waiting for " + item + " option", "The " + item + " option is present"); } } // This verifies the multiple option sections sub menus public void checkMenuSubSections(String multipleSectionsOptions [][]) { - int i,j = 0; + int i,j = 0; for (i = 0; i <= multipleSectionsOptions [j].length; i++) { - String item = multipleSectionsOptions [i][j]; - mAsserter.ok(mSolo.waitForText(item), "Waiting for " + item + " option", "The " + item + " option is present"); - mSolo.clickOnText(item); - for (j = 1; j < multipleSectionsOptions [i].length; j++) { - String subMenu = multipleSectionsOptions [i][j]; - mAsserter.ok(mSolo.waitForText(subMenu), "Waiting for " + subMenu + " option", "The " + subMenu + " option is present"); + String item = multipleSectionsOptions [i][j]; + mAsserter.ok(mSolo.waitForText(item), "Waiting for " + item + " option", "The " + item + " option is present"); + mSolo.clickOnText(item); + for (j = 1; j < multipleSectionsOptions [i].length; j++) { + String subMenu = multipleSectionsOptions [i][j]; + mAsserter.ok(mSolo.waitForText(subMenu), "Waiting for " + subMenu + " option", "The " + subMenu + " option is present"); - // When reaching the specified sub menu section, for phone devices you have to scroll down the list in order to check all the options - if (subMenu.equals("Offline website data")) { - Device mDevice = new Device(); - if (mDevice.type.equals("phone")) { - MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop()); - meh.dragSync(midWidth, midHeight+100, midWidth, midHeight-100); - } - } - } - mSolo.waitForText("^Cancel$"); - mSolo.clickOnText("^Cancel$"); - j = 0; - } + // When reaching the specified sub menu section, for phone devices you have to scroll down the list in order to check all the options + if (subMenu.equals("Offline website data")) { + Device mDevice = new Device(); + if (mDevice.type.equals("phone")) { + MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop()); + meh.dragSync(midWidth, midHeight+100, midWidth, midHeight-100); + } + } + } + mSolo.waitForText("^Cancel$"); + mSolo.clickOnText("^Cancel$"); + j = 0; + } } } - diff --git a/mobile/android/base/tests/testSystemPages.java.in b/mobile/android/base/tests/testSystemPages.java.in index c812d470069..5505d6a5b8e 100644 --- a/mobile/android/base/tests/testSystemPages.java.in +++ b/mobile/android/base/tests/testSystemPages.java.in @@ -6,9 +6,10 @@ import android.app.Activity; import android.util.Log; import java.util.Arrays; -/* This patch tests the System Pages first by loading system pages from - the awesome bar and then from Firefox menu */ - public class testSystemPages extends PixelTest { +/** This patch tests the System Pages first by loading system pages from + * the awesome bar and then from Firefox menu + */ +public class testSystemPages extends PixelTest { Actions.EventExpecter tabEventExpecter; Actions.EventExpecter contentEventExpecter; Actions.RepeatedEventExpecter paintExpecter; @@ -28,74 +29,73 @@ import java.util.Arrays; String menuItems [] = { "Apps", "Downloads", "Add-ons", "Settings"}; /* This first section loads system pages from the awesome bar - and checks that the pages are loaded in the same tab */ + and checks that the pages are loaded in the same tab */ checkUrl(urls); - /* Verify that the search field is not in the focus by pressing back. That will load the previous - about: page if there is no the keyboard to dismiss, meaning that the search field was not in focus */ - loadUrl("about:config"); + /* Verify that the search field is not in the focus by pressing back. That will load the previous + about: page if there is no the keyboard to dismiss, meaning that the search field was not in focus */ + loadUrl("about:config"); - paintExpecter = mActions.expectPaint();// Set up listener to catch the page load + paintExpecter = mActions.expectPaint();// Set up listener to catch the page load - // Press back to verify if the keyboard is dismissed or the previous about: page loads + // Press back to verify if the keyboard is dismissed or the previous about: page loads mActions.sendSpecialKey(Actions.SpecialKey.BACK); - PaintedSurface painted = waitForPaint(paintExpecter); + PaintedSurface painted = waitForPaint(paintExpecter); - verifyUrl("about:");// Verify that the previous about: page is loaded, meaning no keyboard was present + verifyUrl("about:"); // Verify that the previous about: page is loaded, meaning no keyboard was present // The second section loads system pages from Firefox menu in different tabs loadFromMenu(menuItems, expectedUrls); } - // Load from Url the about: pages,verify the Url and the tabs number - public void checkUrl(String urls []) { - for (String url:urls) { - loadAndPaint(url); - verifyTabCount(mExpectedTabCount); - verifyUrl(url); - } - } - - public void loadFromMenu(String menuItems [], String expectedUrls []) { - int expectedTabCount = mExpectedTabCount; - for (String item:menuItems) { - paintExpecter = mActions.expectPaint();// Set up listener to catch the page load - - expectedTabCount++; - mActions.sendSpecialKey(Actions.SpecialKey.BACK);// Press back to dismiss the awesomebar - - int i = Arrays.asList(menuItems).indexOf(item); - - if (!item.equals("Settings")) { - - // Set up listeners to catch the page load we're about to do - tabEventExpecter = mActions.expectGeckoEvent("Tab:Added"); - contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded"); - - waitForPaint(paintExpecter);// waiting for the page to load - selectMenuItem(item); - - // Wait for the new tab and page to load - tabEventExpecter.blockForEvent(); - contentEventExpecter.blockForEvent(); - - verifyTabCount(expectedTabCount); - verifyUrl(expectedUrls[i]); - } - // Make sure the about: page was loaded without opening a new tab and verify the page Url - else { - waitForPaint(paintExpecter);// waiting for the page to load - selectMenuItem(item); - mSolo.waitForText("About"); - - paintExpecter = mActions.expectPaint();// Set up listener to catch the page load - mSolo.clickOnText("About"); - waitForPaint(paintExpecter);// Waiting for the page to load - - expectedTabCount--;// Decreasing since we don't expect this in a new tab - verifyTabCount(expectedTabCount); - verifyUrl(expectedUrls[i]);// Since the page is already loaded this should be instantly - } + // Load from Url the about: pages,verify the Url and the tabs number + public void checkUrl(String urls []) { + for (String url:urls) { + loadAndPaint(url); + verifyTabCount(mExpectedTabCount); + verifyUrl(url); } - } + } + + public void loadFromMenu(String menuItems [], String expectedUrls []) { + int expectedTabCount = mExpectedTabCount; + for (String item:menuItems) { + paintExpecter = mActions.expectPaint(); // Set up listener to catch the page load + + expectedTabCount++; + mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Press back to dismiss the awesomebar + + int i = Arrays.asList(menuItems).indexOf(item); + + if (!item.equals("Settings")) { + + // Set up listeners to catch the page load we're about to do + tabEventExpecter = mActions.expectGeckoEvent("Tab:Added"); + contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded"); + + waitForPaint(paintExpecter);// waiting for the page to load + selectMenuItem(item); + + // Wait for the new tab and page to load + tabEventExpecter.blockForEvent(); + contentEventExpecter.blockForEvent(); + + verifyTabCount(expectedTabCount); + verifyUrl(expectedUrls[i]); + } else { + // Make sure the about: page was loaded without opening a new tab and verify the page Url + waitForPaint(paintExpecter); // waiting for the page to load + selectMenuItem(item); + mSolo.waitForText("About"); + + paintExpecter = mActions.expectPaint(); // Set up listener to catch the page load + mSolo.clickOnText("About"); + waitForPaint(paintExpecter); // Waiting for the page to load + + expectedTabCount--; // Decreasing since we don't expect this in a new tab + verifyTabCount(expectedTabCount); + verifyUrl(expectedUrls[i]); // Since the page is already loaded this should be instantly + } + } + } } diff --git a/mobile/android/base/tests/testTabHistory.java.in b/mobile/android/base/tests/testTabHistory.java.in old mode 100755 new mode 100644