Bug 844239: Spacing/indentation consistency for Robocop source; r=jmaher DONTBUILD

This commit is contained in:
Geoff Brown 2013-02-22 20:42:46 -07:00
parent 8f4de0c6df
commit 2258d2b2b5
7 changed files with 127 additions and 125 deletions

0
mobile/android/base/tests/testAddonManager.java.in Executable file → Normal file
View File

View File

@ -20,7 +20,7 @@ public class testClearPrivateData extends PixelTest {
public void testClearPrivateData() {
blockForGeckoReady();
clearHistory();
clearHistory();
}
private void clearHistory() {

View File

@ -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();
}
}

View File

@ -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");
}
}
}

View File

@ -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;
}
}
}

View File

@ -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
}
}
}
}

0
mobile/android/base/tests/testTabHistory.java.in Executable file → Normal file
View File