author | Brian Nicholson <bnicholson@mozilla.com> |
Tue, 26 Feb 2013 21:48:00 -0800 | |
changeset 123119 | ed22faa72a821ccac550b6e821eec34b24611022 |
parent 123118 | 63a6466d8c466a5562c7ec478fc8d557d4723f7e |
child 123120 | 7164bd42720f6f1f7ba9164df0de5386920abed6 |
push id | 24372 |
push user | emorley@mozilla.com |
push date | Wed, 27 Feb 2013 13:22:59 +0000 |
treeherder | mozilla-central@0a91da5f5eab [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | kats |
bugs | 845612 |
milestone | 22.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/mobile/android/base/AboutHomeContent.java +++ b/mobile/android/base/AboutHomeContent.java @@ -141,16 +141,17 @@ public class AboutHomeContent extends Sc inflate(); // Reload the mobile homepage on inbound tab syncs // Because the tabs URI is coarse grained, this updates the // remote tabs component on *every* tab change // The observer will run on the background thread (see constructor argument) mTabsContentObserver = new ContentObserver(GeckoAppShell.getHandler()) { + @Override public void onChange(boolean selfChange) { update(EnumSet.of(AboutHomeContent.UpdateFlags.REMOTE_TABS)); } }; mActivity.getContentResolver().registerContentObserver(BrowserContract.Tabs.CONTENT_URI, false, mTabsContentObserver); mRemoteTabClickListener = new View.OnClickListener() {
--- a/mobile/android/base/App.java.in +++ b/mobile/android/base/App.java.in @@ -10,38 +10,44 @@ import android.view.MenuItem; import org.mozilla.gecko.BrowserApp; import org.mozilla.gecko.GeckoAppShell; import org.mozilla.gecko.GeckoEvent; import org.mozilla.gecko.GeckoProfile; import org.mozilla.gecko.R; public class App extends BrowserApp { + @Override public int getLayout() { return R.layout.gecko_app; } + @Override public String getPackageName() { return "@ANDROID_PACKAGE_NAME@"; } + @Override public String getContentProcessName() { return "@MOZ_CHILD_PROCESS_NAME@"; } + @Override protected String getDefaultProfileName() { String profile = GeckoProfile.findDefaultProfile(this); return (profile != null ? profile : "default"); } + @Override public String getDefaultUAString() { String deviceType = "Mobile"; if (GeckoAppShell.isTablet()) deviceType = "Tablet"; return "Mozilla/5.0 (Android; " + deviceType + "; rv:@MOZ_APP_VERSION@) Gecko/@MOZ_APP_VERSION@ Firefox/@MOZ_APP_VERSION@"; } + @Override public String getUAStringForHost(String host) { // With our standard UA String, we get a 200 response code and // client-side redirect from t.co. This bot-like UA gives us a // 301 response code if ("t.co".equals(host)) return "Redirector/@MOZ_APP_VERSION@ (Android; rv:@MOZ_APP_VERSION@)"; return getDefaultUAString(); }
--- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -523,55 +523,63 @@ abstract public class BrowserApp extends } else { super.handleMessage(event, message); } } catch (Exception e) { Log.e(LOGTAG, "Exception handling message \"" + event + "\":", e); } } + @Override public void addTab() { showAwesomebar(AwesomeBar.Target.NEW_TAB); } + @Override public void addPrivateTab() { Tabs.getInstance().loadUrl("about:privatebrowsing", Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_PRIVATE); } + @Override public void showNormalTabs() { showTabs(TabsPanel.Panel.NORMAL_TABS); } + @Override public void showPrivateTabs() { showTabs(TabsPanel.Panel.PRIVATE_TABS); } + @Override public void showRemoteTabs() { showTabs(TabsPanel.Panel.REMOTE_TABS); } private void showTabs(TabsPanel.Panel panel) { if (Tabs.getInstance().getCount() == 0) return; mTabsPanel.show(panel); } + @Override public void hideTabs() { mTabsPanel.hide(); } + @Override public boolean autoHideTabs() { if (!hasTabsSideBar() && areTabsShown()) { hideTabs(); return true; } return false; } + @Override public boolean areTabsShown() { return mTabsPanel.isShown(); } @Override public void onTabsLayoutChange(int width, int height) { if (mMainLayoutAnimator != null) mMainLayoutAnimator.stop();
--- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -603,16 +603,17 @@ abstract public class GeckoApp if (ReaderModeUtils.isAboutReader(url)) url = ReaderModeUtils.getUrlFromAboutReader(url); GeckoAppShell.openUriExternal(url, "text/plain", "", "", Intent.ACTION_SEND, tab.getDisplayTitle()); } + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (outState == null) outState = new Bundle(); boolean inBackground = ((GeckoApplication)getApplication()).isApplicationInBackground(); @@ -2111,16 +2112,17 @@ abstract public class GeckoApp @Override public Object onRetainNonConfigurationInstance() { // Send a non-null value so that we can restart the application, // when activity restarts due to configuration change. return Boolean.TRUE; } + @Override abstract public String getPackageName(); abstract public String getContentProcessName(); public void addEnvToIntent(Intent intent) { Map<String,String> envMap = System.getenv(); Set<Map.Entry<String,String>> envSet = envMap.entrySet(); Iterator<Map.Entry<String,String>> envIter = envSet.iterator(); int c = 0;
--- a/mobile/android/base/GeckoAppWidgetProvider.java.in +++ b/mobile/android/base/GeckoAppWidgetProvider.java.in @@ -14,16 +14,17 @@ import android.content.Context; import android.content.Intent; import android.app.PendingIntent; import android.widget.RemoteViews; import org.mozilla.gecko.R; public class GeckoAppWidgetProvider extends AppWidgetProvider { + @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int i=0; i < appWidgetIds.length; i++) { int appWidgetId = appWidgetIds[i]; // Launch the AwesomeScreen on tapping the URL bar. Intent awesomeBarIntent = new Intent(); awesomeBarIntent.setComponent(new ComponentName("@ANDROID_PACKAGE_NAME@", "@ANDROID_PACKAGE_NAME@.App")); awesomeBarIntent.setAction(GeckoApp.ACTION_WIDGET);
--- a/mobile/android/base/GeckoBackgroundThread.java +++ b/mobile/android/base/GeckoBackgroundThread.java @@ -16,16 +16,17 @@ public final class GeckoBackgroundThread private static Handler sHandler = null; private SynchronousQueue<Handler> mHandlerQueue = new SynchronousQueue<Handler>(); // Singleton, so private constructor. private GeckoBackgroundThread() { super(); } + @Override public void run() { setName(LOOPER_NAME); Looper.prepare(); try { mHandlerQueue.put(new Handler()); } catch (InterruptedException ie) {} Looper.loop();
--- a/mobile/android/base/GeckoMenuInflater.java +++ b/mobile/android/base/GeckoMenuInflater.java @@ -47,16 +47,17 @@ public class GeckoMenuInflater extends M public GeckoMenuInflater(Context context) { super(context); mContext = context; isSubMenu = false; } + @Override public void inflate(int menuRes, Menu menu) { // This does not check for a well-formed XML. XmlResourceParser parser = null; try { parser = mContext.getResources().getXml(menuRes); AttributeSet attrs = Xml.asAttributeSet(parser);
--- a/mobile/android/base/GeckoPreferences.java +++ b/mobile/android/base/GeckoPreferences.java @@ -306,16 +306,17 @@ public class GeckoPreferences boolean disabled = TextUtils.isEmpty(text); dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(!disabled); } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { } } + @Override protected Dialog onCreateDialog(int id) { AlertDialog.Builder builder = new AlertDialog.Builder(this); LinearLayout linearLayout = new LinearLayout(this); linearLayout.setOrientation(LinearLayout.VERTICAL); AlertDialog dialog = null; switch(id) { case DIALOG_CREATE_MASTER_PASSWORD: final EditText input1 = getTextBox(R.string.masterpassword_password);
--- a/mobile/android/base/GeckoSmsManager.java +++ b/mobile/android/base/GeckoSmsManager.java @@ -202,16 +202,17 @@ class SmsIOThread extends Thread { public static SmsIOThread getInstance() { return sInstance; } public boolean execute(Runnable r) { return mHandler.post(r); } + @Override public void run() { Looper.prepare(); mHandler = new Handler(); Looper.loop(); } }
--- a/mobile/android/base/GeckoThread.java +++ b/mobile/android/base/GeckoThread.java @@ -85,16 +85,17 @@ public class GeckoThread extends Thread return null; } private String addCustomProfileArg(String args) { String profile = GeckoApp.sIsUsingCustomProfile ? "" : (" -P " + GeckoApp.mAppContext.getProfile().getName()); return (args != null ? args : "") + profile; } + @Override public void run() { // Here we start the GfxInfo thread, which will query OpenGL // system information for Gecko. This must be done early enough that the data will be // ready by the time it's needed to initialize the LayerManager (it takes about 100 ms // to obtain). Doing it here seems to have no negative effect on startup time. See bug 766251. // Starting the GfxInfoThread here from the GeckoThread, ensures that // the Gecko thread is started first, adding some determinism there. GeckoAppShell.sGfxInfoThread = new GfxInfoThread();
--- a/mobile/android/base/INIParser.java +++ b/mobile/android/base/INIParser.java @@ -75,16 +75,17 @@ public final class INIParser extends INI } catch (IOException e) { debug("Error parsing: " + e); } } return mSections; } // parse the default file + @Override protected void parse() throws IOException { super.parse(); parse(mFile); } // parse a passed in file private void parse(File f) throws IOException { // Set up internal data members
--- a/mobile/android/base/Tabs.java +++ b/mobile/android/base/Tabs.java @@ -108,16 +108,17 @@ public class Tabs implements GeckoEventL public int getCount() { return mTabs.size(); } private void lazyRegisterBookmarkObserver() { if (mContentObserver == null) { mContentObserver = new ContentObserver(null) { + @Override public void onChange(boolean selfChange) { for (Tab tab : mTabs.values()) { tab.updateBookmark(); } } }; BrowserDB.registerBookmarkObserver(getContentResolver(), mContentObserver); }
--- a/mobile/android/base/WebApp.java.in +++ b/mobile/android/base/WebApp.java.in @@ -145,31 +145,35 @@ public class WebApp extends GeckoApp { Animation fadein = AnimationUtils.loadAnimation(this, R.anim.grow_fade_in_center); fadein.setStartOffset(500); fadein.setDuration(1000); image.startAnimation(fadein); } } + @Override public String getPackageName() { return "@ANDROID_PACKAGE_NAME@"; } + @Override public String getContentProcessName() { return "@MOZ_CHILD_PROCESS_NAME@"; } + @Override public String getDefaultUAString() { String deviceType = "Mobile"; if (GeckoAppShell.isTablet()) deviceType = "Tablet"; return "Mozilla/5.0 (Android; " + deviceType + "; rv:@MOZ_APP_VERSION@) Gecko/@MOZ_APP_VERSION@ Firefox/@MOZ_APP_VERSION@"; } + @Override public String getUAStringForHost(String host) { // With our standard UA String, we get a 200 response code and // client-side redirect from t.co. This bot-like UA gives us a // 301 response code if ("t.co".equals(host)) return "Redirector/@MOZ_APP_VERSION@ (Android; rv:@MOZ_APP_VERSION@)"; return getDefaultUAString(); } @@ -249,13 +253,14 @@ public class WebApp extends GeckoApp { fadein.setDuration(1000); area.startAnimation(fadein); } break; } super.onTabChanged(tab, msg, data); } + @Override protected void connectGeckoLayerClient() { super.connectGeckoLayerClient(); getLayerView().setOverScrollMode(View.OVER_SCROLL_NEVER); } };
--- a/mobile/android/base/awesomebar/AllPagesTab.java +++ b/mobile/android/base/awesomebar/AllPagesTab.java @@ -91,35 +91,39 @@ public class AllPagesTab extends Awesome mSearchEngines = new ArrayList<SearchEngine>(); registerEventListener("SearchEngines:Data"); GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:Get", null)); mHandler = new AllPagesHandler(); } + @Override public boolean onBackPressed() { return false; } + @Override public int getTitleStringId() { return R.string.awesomebar_all_pages_title; } + @Override public String getTag() { return TAG; } private ListView getListView() { if (mListView == null && mView != null) { mListView = (ListView) mView.findViewById(R.id.awesomebar_list); } return mListView; } + @Override public View getView() { if (mView == null) { mView = (LinearLayout) (LayoutInflater.from(mContext).inflate(R.layout.awesomebar_allpages_list, null)); mView.setTag(TAG); ListView list = getListView(); list.setTag(TAG); ((Activity)mContext).registerForContextMenu(list); @@ -132,16 +136,17 @@ public class AllPagesTab extends Awesome AwesomeBarCursorAdapter adapter = getCursorAdapter(); list.setAdapter(adapter); list.setOnTouchListener(mListListener); } return mView; } + @Override public void destroy() { AwesomeBarCursorAdapter adapter = getCursorAdapter(); unregisterEventListener("SearchEngines:Data"); if (adapter == null) { return; } Cursor cursor = adapter.getCursor(); @@ -180,20 +185,22 @@ public class AllPagesTab extends Awesome private void filterSuggestions(String searchTerm) { // cancel previous query if (mSuggestTask != null) { mSuggestTask.cancel(true); } if (mSuggestClient != null && mSuggestionsEnabled) { mSuggestTask = new AsyncTask<String, Void, ArrayList<String>>() { + @Override protected ArrayList<String> doInBackground(String... query) { return mSuggestClient.query(query[0]); } + @Override protected void onPostExecute(ArrayList<String> suggestions) { setSuggestions(suggestions); } }; mSuggestTask.execute(searchTerm); } } @@ -729,16 +736,17 @@ public class AllPagesTab extends Awesome if (display == Combined.DISPLAY_READER) { bookmarkIconView.setImageResource(R.drawable.ic_awesomebar_reader); } else { bookmarkIconView.setImageResource(R.drawable.ic_awesomebar_star); } } + @Override public ContextMenuSubject getSubject(ContextMenu menu, View view, ContextMenuInfo menuInfo) { ContextMenuSubject subject = null; if (!(menuInfo instanceof AdapterView.AdapterContextMenuInfo)) { Log.e(LOGTAG, "menuInfo is not AdapterContextMenuInfo"); return subject; }
--- a/mobile/android/base/awesomebar/BookmarksTab.java +++ b/mobile/android/base/awesomebar/BookmarksTab.java @@ -35,28 +35,31 @@ public class BookmarksTab extends Awesom public static final String LOGTAG = "BOOKMARKS_TAB"; public static final String TAG = "bookmarks"; private int mFolderId; private String mFolderTitle; private BookmarksListAdapter mCursorAdapter = null; private BookmarksQueryTask mQueryTask = null; private boolean mShowReadingList = false; + @Override public int getTitleStringId() { return R.string.awesomebar_bookmarks_title; } + @Override public String getTag() { return TAG; } public BookmarksTab(Context context) { super(context); } + @Override public View getView() { if (mView == null) { mView = (LayoutInflater.from(mContext).inflate(R.layout.awesomebar_list, null)); ((Activity)mContext).registerForContextMenu(mView); mView.setTag(TAG); mView.setOnTouchListener(mListListener); // We need to add the header before we set the adapter, hence make it null @@ -79,27 +82,29 @@ public class BookmarksTab extends Awesom } return (ListView)mView; } public void setShowReadingList(boolean showReadingList) { mShowReadingList = showReadingList; } + @Override public void destroy() { BookmarksListAdapter adapter = getCursorAdapter(); if (adapter == null) { return; } Cursor cursor = adapter.getCursor(); if (cursor != null) cursor.close(); } + @Override public boolean onBackPressed() { // If the soft keyboard is visible in the bookmarks or history tab, the user // must have explictly brought it up, so we should try hiding it instead of // exiting the activity or going up a bookmarks folder level. if (hideSoftInput(getView())) return true; return moveToParentFolder(); @@ -246,16 +251,17 @@ public class BookmarksTab extends Awesom refreshCurrentFolder(); } public boolean isInReadingList() { Pair<Integer, String> folderPair = mParentStack.getFirst(); return (folderPair.first == Bookmarks.FIXED_READING_LIST_ID); } + @Override public int getItemViewType(int position) { Cursor c = getCursor(); if (c.moveToPosition(position) && c.getInt(c.getColumnIndexOrThrow(Bookmarks.TYPE)) == Bookmarks.TYPE_FOLDER) return VIEW_TYPE_FOLDER; // Default to retuning normal item type @@ -390,16 +396,17 @@ public class BookmarksTab extends Awesom */ public boolean isInReadingList() { if (mCursorAdapter == null) return false; return mCursorAdapter.isInReadingList(); } + @Override public ContextMenuSubject getSubject(ContextMenu menu, View view, ContextMenuInfo menuInfo) { ContextMenuSubject subject = null; if (!(menuInfo instanceof AdapterView.AdapterContextMenuInfo)) { Log.e(LOGTAG, "menuInfo is not AdapterContextMenuInfo"); return subject; }
--- a/mobile/android/base/awesomebar/HistoryTab.java +++ b/mobile/android/base/awesomebar/HistoryTab.java @@ -49,24 +49,27 @@ public class HistoryTab extends AwesomeB private HistoryQueryTask mQueryTask = null; private HistoryListAdapter mCursorAdapter = null; public HistoryTab(Context context) { super(context); mContentObserver = null; } + @Override public int getTitleStringId() { return R.string.awesomebar_history_title; } + @Override public String getTag() { return TAG; } + @Override public ListView getView() { if (mView == null) { mView = LayoutInflater.from(mContext).inflate(R.layout.awesomebar_expandable_list, null); ((Activity)mContext).registerForContextMenu(mView); mView.setTag(TAG); ExpandableListView list = (ExpandableListView)mView; list.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @@ -90,21 +93,23 @@ public class HistoryTab extends AwesomeB // We need to add the header before we set the adapter, hence make it null list.setAdapter(getCursorAdapter()); HistoryQueryTask task = new HistoryQueryTask(); task.execute(); } return (ListView)mView; } + @Override public void destroy() { if (mContentObserver != null) BrowserDB.unregisterContentObserver(getContentResolver(), mContentObserver); } + @Override public boolean onBackPressed() { // If the soft keyboard is visible in the bookmarks or history tab, the user // must have explictly brought it up, so we should try hiding it instead of // exiting the activity or going up a bookmarks folder level. View view = getView(); if (hideSoftInput(view)) return true; @@ -194,16 +199,17 @@ public class HistoryTab extends AwesomeB private static class ChildrenList extends LinkedList<Map<String,Object>> { private static final long serialVersionUID = 0L; } private class HistoryQueryTask extends AsyncTask<Void, Void, Pair<GroupList,List<ChildrenList>>> { private static final long MS_PER_DAY = 86400000; private static final long MS_PER_WEEK = MS_PER_DAY * 7; + @Override protected Pair<GroupList,List<ChildrenList>> doInBackground(Void... arg0) { Cursor cursor = BrowserDB.getRecentHistory(getContentResolver(), MAX_RESULTS); Date now = new Date(); now.setHours(0); now.setMinutes(0); now.setSeconds(0); @@ -329,29 +335,31 @@ public class HistoryTab extends AwesomeB if (delta < MS_PER_WEEK) { return HistorySection.WEEK; } return HistorySection.OLDER; } + @Override protected void onPostExecute(Pair<GroupList,List<ChildrenList>> result) { mCursorAdapter = new HistoryListAdapter( mContext, result.first, R.layout.awesomebar_header_row, new String[] { URLColumns.TITLE }, new int[] { R.id.title }, result.second ); if (mContentObserver == null) { // Register an observer to update the history tab contents if they change. mContentObserver = new ContentObserver(GeckoAppShell.getHandler()) { + @Override public void onChange(boolean selfChange) { mQueryTask = new HistoryQueryTask(); mQueryTask.execute(); } }; BrowserDB.registerHistoryObserver(getContentResolver(), mContentObserver); } @@ -381,16 +389,17 @@ public class HistoryTab extends AwesomeB String title = (String) historyItem.get(URLColumns.TITLE); AwesomeBarTabs.OnUrlOpenListener listener = getUrlListener(); if (!TextUtils.isEmpty(url) && listener != null) listener.onUrlOpen(url, title); return true; } + @Override public ContextMenuSubject getSubject(ContextMenu menu, View view, ContextMenuInfo menuInfo) { ContextMenuSubject subject = null; if (!(menuInfo instanceof ExpandableListView.ExpandableListContextMenuInfo)) { Log.e(LOGTAG, "menuInfo is not ExpandableListContextMenuInfo"); return subject; }
--- a/mobile/android/base/db/BrowserDB.java +++ b/mobile/android/base/db/BrowserDB.java @@ -358,51 +358,61 @@ public class BrowserDB { if (mPinnedSites.get(i) != null) { numFound++; } } return numFound; } + @Override public int getPosition() { return mIndex; } + @Override public int getCount() { return mSize; } + @Override public boolean isAfterLast() { return mIndex >= mSize; } + @Override public boolean isBeforeFirst() { return mIndex < 0; } + @Override public boolean isLast() { return mIndex == mSize - 1; } + @Override public boolean moveToNext() { return moveToPosition(mIndex + 1); } + @Override public boolean moveToPrevious() { return moveToPosition(mIndex - 1); } + @Override public boolean moveToPosition(int position) { mIndex = position; // move the real cursor as if we were stepping through it to this position // be careful not to move it to far, and to account for any pinned sites int before = getPinnedBefore(position); int p2 = position - before; if (p2 >= -1 && p2 <= mCursor.getCount()) { super.moveToPosition(p2); } return !(isBeforeFirst() || isAfterLast()); } + @Override public long getLong(int columnIndex) { if (hasPinnedSites()) { PinnedSite site = getPinnedSite(mIndex); if (site != null) { return 0; } } if (!super.isBeforeFirst() && !super.isAfterLast()) return super.getLong(columnIndex); return 0; } + @Override public String getString(int columnIndex) { if (hasPinnedSites()) { PinnedSite site = getPinnedSite(mIndex); if (site != null) { if (columnIndex == mCursor.getColumnIndex(URLColumns.URL)) { return site.url; } else if (columnIndex == mCursor.getColumnIndex(URLColumns.TITLE)) { return site.title; @@ -411,21 +421,24 @@ public class BrowserDB { } } if (!super.isBeforeFirst() && !super.isAfterLast()) return super.getString(columnIndex); return ""; } + @Override public boolean move(int offset) { return moveToPosition(mIndex + offset); } + @Override public boolean moveToFirst() { return moveToPosition(0); } + @Override public boolean moveToLast() { return moveToPosition(mSize-1); } } }
--- a/mobile/android/base/db/FormHistoryProvider.java.in +++ b/mobile/android/base/db/FormHistoryProvider.java.in @@ -85,16 +85,17 @@ public class FormHistoryProvider extends case DELETED_FORM_HISTORY: return DeletedFormHistory.CONTENT_TYPE; default: throw new UnsupportedOperationException("Unknown type " + uri); } } + @Override public String getTable(Uri uri) { String table = null; final int match = URI_MATCHER.match(uri); switch (match) { case DELETED_FORM_HISTORY: table = TABLE_DELETED_FORM_HISTORY; break; @@ -111,16 +112,17 @@ public class FormHistoryProvider extends @Override public String getSortOrder(Uri uri, String aRequested) { if (!TextUtils.isEmpty(aRequested)) return aRequested; return null; } + @Override public void setupDefaults(Uri uri, ContentValues values) { int match = URI_MATCHER.match(uri); long now = System.currentTimeMillis(); switch (match) { case DELETED_FORM_HISTORY: values.put(DeletedFormHistory.TIME_DELETED, now); @@ -138,16 +140,17 @@ public class FormHistoryProvider extends } break; default: throw new UnsupportedOperationException("Unknown insert URI " + uri); } } + @Override public void initGecko() { GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("FormHistory:Init", null)); } @Override public void onPreInsert(ContentValues values, Uri uri, SQLiteBridge db) { if (!values.containsKey(FormHistory.GUID)) { return;
--- a/mobile/android/base/db/GeckoProvider.java.in +++ b/mobile/android/base/db/GeckoProvider.java.in @@ -76,16 +76,17 @@ public abstract class GeckoProvider exte bridge.close(); } catch (Exception ex) { } } } mDatabasePerProfile = null; } + @Override public void finalize() { shutdown(); } protected void setLogTag(String aLogTag) { mLogTag = aLogTag; }
--- a/mobile/android/base/db/PasswordsProvider.java.in +++ b/mobile/android/base/db/PasswordsProvider.java.in @@ -112,30 +112,32 @@ public class PasswordsProvider extends G case DELETED_PASSWORDS: return DeletedPasswords.CONTENT_TYPE; default: throw new UnsupportedOperationException("Unknown type " + uri); } } + @Override public String getTable(Uri uri) { final int match = URI_MATCHER.match(uri); switch (match) { case DELETED_PASSWORDS: return TABLE_DELETED_PASSWORDS; case PASSWORDS: return TABLE_PASSWORDS; default: throw new UnsupportedOperationException("Unknown table " + uri); } } + @Override public String getSortOrder(Uri uri, String aRequested) { if (!TextUtils.isEmpty(aRequested)) return aRequested; final int match = URI_MATCHER.match(uri); switch (match) { case DELETED_PASSWORDS: return DEFAULT_DELETED_PASSWORDS_SORT_ORDER; @@ -143,16 +145,17 @@ public class PasswordsProvider extends G case PASSWORDS: return DEFAULT_PASSWORDS_SORT_ORDER; default: throw new UnsupportedOperationException("Unknown URI " + uri); } } + @Override public void setupDefaults(Uri uri, ContentValues values) throws IllegalArgumentException { int match = URI_MATCHER.match(uri); long now = System.currentTimeMillis(); switch (match) { case DELETED_PASSWORDS: values.put(DeletedPasswords.TIME_DELETED, now);
--- a/mobile/android/base/gfx/DisplayPortCalculator.java +++ b/mobile/android/base/gfx/DisplayPortCalculator.java @@ -239,24 +239,26 @@ final class DisplayPortCalculator { /** * This class implements the variation where we basically don't bother with a a display port. */ private static class NoMarginStrategy extends DisplayPortStrategy { NoMarginStrategy(Map<String, Integer> prefs) { // no prefs in this strategy } + @Override public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) { return new DisplayPortMetrics(metrics.viewportRectLeft, metrics.viewportRectTop, metrics.viewportRectRight, metrics.viewportRectBottom, metrics.zoomFactor); } + @Override public boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort) { return true; } @Override public String toString() { return "NoMarginStrategy"; } @@ -281,16 +283,17 @@ final class DisplayPortCalculator { private final float DANGER_ZONE_Y_MULTIPLIER; FixedMarginStrategy(Map<String, Integer> prefs) { SIZE_MULTIPLIER = getFloatPref(prefs, PREF_DISPLAYPORT_FM_MULTIPLIER, 2000); DANGER_ZONE_X_MULTIPLIER = getFloatPref(prefs, PREF_DISPLAYPORT_FM_DANGER_X, 100); DANGER_ZONE_Y_MULTIPLIER = getFloatPref(prefs, PREF_DISPLAYPORT_FM_DANGER_Y, 200); } + @Override public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) { float displayPortWidth = metrics.getWidth() * SIZE_MULTIPLIER; float displayPortHeight = metrics.getHeight() * SIZE_MULTIPLIER; // we need to avoid having a display port that is larger than the page, or we will end up // painting things outside the page bounds (bug 729169). we simultaneously need to make // the display port as large as possible so that we redraw less. reshape the display // port dimensions to accomplish this. @@ -308,16 +311,17 @@ final class DisplayPortCalculator { margins.right = horizontalBuffer - margins.left; margins.top = verticalBuffer / 2.0f; margins.bottom = verticalBuffer - margins.top; margins = shiftMarginsForPageBounds(margins, metrics); return getTileAlignedDisplayPortMetrics(margins, metrics.zoomFactor, metrics); } + @Override public boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort) { // Increase the size of the viewport based on the danger zone multiplier (and clamp to page // boundaries), and intersect it with the current displayport to determine whether we're // close to checkerboarding. RectF adjustedViewport = expandByDangerZone(metrics.getViewport(), DANGER_ZONE_X_MULTIPLIER, DANGER_ZONE_Y_MULTIPLIER, metrics); return !displayPort.contains(adjustedViewport); } @@ -390,16 +394,17 @@ final class DisplayPortCalculator { } else { margins.top = yAmount / 2.0f; } margins.bottom = yAmount - margins.top; return margins; } + @Override public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) { float displayPortWidth = metrics.getWidth() * SIZE_MULTIPLIER; float displayPortHeight = metrics.getHeight() * SIZE_MULTIPLIER; // but if we're panning on one axis, set the margins for the other axis to zero since we are likely // axis locked and won't be displaying that extra area. if (Math.abs(velocity.x) > VELOCITY_THRESHOLD && FloatUtils.fuzzyEquals(velocity.y, 0)) { displayPortHeight = metrics.getHeight(); @@ -417,16 +422,17 @@ final class DisplayPortCalculator { // split the buffer amounts into margins based on velocity, and shift it to // take into account the page bounds RectF margins = velocityBiasedMargins(horizontalBuffer, verticalBuffer, velocity); margins = shiftMarginsForPageBounds(margins, metrics); return getTileAlignedDisplayPortMetrics(margins, metrics.zoomFactor, metrics); } + @Override public boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort) { // calculate the danger zone amounts based on the prefs float dangerZoneX = metrics.getWidth() * (DANGER_ZONE_BASE_X_MULTIPLIER + (velocity.x * DANGER_ZONE_INCR_X_MULTIPLIER)); float dangerZoneY = metrics.getHeight() * (DANGER_ZONE_BASE_Y_MULTIPLIER + (velocity.y * DANGER_ZONE_INCR_Y_MULTIPLIER)); // clamp it such that when added to the viewport, they don't exceed page size. // this is a prerequisite to calling shiftMarginsForPageBounds as we do below. dangerZoneX = Math.min(dangerZoneX, metrics.getPageWidth() - metrics.getWidth()); dangerZoneY = Math.min(dangerZoneY, metrics.getPageHeight() - metrics.getHeight()); @@ -513,16 +519,17 @@ final class DisplayPortCalculator { // danger zone, and thus will be constantly drawing. private static final float PREDICTION_VELOCITY_MULTIPLIER = 30.0f; private static final float DANGER_ZONE_MULTIPLIER = 0.20f; // must be less than (SIZE_MULTIPLIER - 1.0f) DynamicResolutionStrategy(Map<String, Integer> prefs) { // ignore prefs for now } + @Override public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) { float displayPortWidth = metrics.getWidth() * SIZE_MULTIPLIER; float displayPortHeight = metrics.getHeight() * SIZE_MULTIPLIER; // for resolution calculation purposes, we need to know what the adjusted display port dimensions // would be if we had zero velocity, so calculate that here before we increase the display port // based on velocity. FloatSize reshapedSize = reshapeForPage(displayPortWidth, displayPortHeight, metrics); @@ -612,16 +619,17 @@ final class DisplayPortCalculator { // if we're moving slowly, then assign less of the amount in that direction if (velocity < 0) { return amount * SLOW_SPLIT_FACTOR; } else { return amount * (1.0f - SLOW_SPLIT_FACTOR); } } + @Override public boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort) { // Expand the viewport based on our velocity (and clamp it to page boundaries). // Then intersect it with the last-requested displayport to determine whether we're // close to checkerboarding. RectF predictedViewport = metrics.getViewport(); // first we expand the viewport in the direction we're moving based on some @@ -669,16 +677,17 @@ final class DisplayPortCalculator { private int mMinFramesToDraw; // minimum number of frames we take to draw private int mMaxFramesToDraw; // maximum number of frames we take to draw PredictionBiasStrategy(Map<String, Integer> prefs) { VELOCITY_THRESHOLD = GeckoAppShell.getDpi() * getFloatPref(prefs, PREF_DISPLAYPORT_PB_VELOCITY_THRESHOLD, 16); resetPageState(); } + @Override public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) { float width = metrics.getWidth(); float height = metrics.getHeight(); mPixelArea = (int)(width * height); if (velocity.length() < VELOCITY_THRESHOLD) { // if we're going slow, expand the displayport to 9x viewport size RectF margins = new RectF(width, height, width, height); @@ -705,16 +714,17 @@ final class DisplayPortCalculator { RectF margins = new RectF( -Math.min(minDx, maxDx), -Math.min(minDy, maxDy), Math.max(minDx, maxDx), Math.max(minDy, maxDy)); return getTileAlignedDisplayPortMetrics(margins, metrics.zoomFactor, metrics); } + @Override public boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort) { // the code below is the same as in calculate() but is awkward to refactor since it has multiple outputs. // refer to the comments in calculate() to understand what this is doing. float minDx = velocity.x * mMinFramesToDraw; float minDy = velocity.y * mMinFramesToDraw; float maxDx = velocity.x * mMaxFramesToDraw; float maxDy = velocity.y * mMaxFramesToDraw; float pixelsToDraw = (metrics.getWidth() + Math.abs(maxDx - minDx)) * (metrics.getHeight() + Math.abs(maxDy - minDy));
--- a/mobile/android/base/gfx/GfxInfoThread.java +++ b/mobile/android/base/gfx/GfxInfoThread.java @@ -51,16 +51,17 @@ public class GfxInfoThread extends Threa data = mDataQueue.take(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } Log.i(LOGTAG, "GfxInfo data is finally available."); return data; } + @Override public void run() { // initialize EGL EGL10 egl = (EGL10) EGLContext.getEGL(); EGLDisplay eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); if (eglDisplay == EGL10.EGL_NO_DISPLAY) { eglError(egl, "eglGetDisplay failed"); return;
--- a/mobile/android/base/gfx/JavaPanZoomController.java +++ b/mobile/android/base/gfx/JavaPanZoomController.java @@ -679,16 +679,17 @@ class JavaPanZoomController private ImmutableViewportMetrics mBounceStartMetrics; private ImmutableViewportMetrics mBounceEndMetrics; BounceRunnable(ImmutableViewportMetrics startMetrics, ImmutableViewportMetrics endMetrics) { mBounceStartMetrics = startMetrics; mBounceEndMetrics = endMetrics; } + @Override protected void animateFrame() { /* * The pan/zoom controller might have signaled to us that it wants to abort the * animation by setting the state to PanZoomState.NOTHING. Handle this case and bail * out. */ if (!(mState == PanZoomState.BOUNCE || mState == PanZoomState.ANIMATED_ZOOM)) { finishAnimation(); @@ -723,16 +724,17 @@ class JavaPanZoomController mTarget.setViewportMetrics(mBounceEndMetrics); mBounceFrame = -1; } } } // The callback that performs the fling animation. private class FlingRunnable extends AnimationRunnable { + @Override protected void animateFrame() { /* * The pan/zoom controller might have signaled to us that it wants to abort the * animation by setting the state to PanZoomState.NOTHING. Handle this case and bail * out. */ if (mState != PanZoomState.FLING) { finishAnimation();
--- a/mobile/android/base/gfx/LayerView.java +++ b/mobile/android/base/gfx/LayerView.java @@ -212,16 +212,17 @@ public class LayerView extends FrameLayo public PointF convertViewPointToLayerPoint(PointF viewPoint) { return mLayerClient.convertViewPointToLayerPoint(viewPoint); } int getBackgroundColor() { return mBackgroundColor; } + @Override public void setBackgroundColor(int newColor) { mBackgroundColor = newColor; requestRender(); } public void setZoomConstraints(ZoomConstraints constraints) { mLayerClient.setZoomConstraints(constraints); } @@ -446,16 +447,17 @@ public class LayerView extends FrameLayo private class LayerSurfaceView extends SurfaceView { LayerView mParent; public LayerSurfaceView(Context aContext, LayerView aParent) { super(aContext); mParent = aParent; } + @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { if (changed) { mParent.surfaceChanged(right - left, bottom - top); } } } private class SurfaceTextureListener implements TextureView.SurfaceTextureListener {
--- a/mobile/android/base/gfx/PluginLayer.java +++ b/mobile/android/base/gfx/PluginLayer.java @@ -78,16 +78,17 @@ public class PluginLayer extends TileLay mContainer.updateViewLayout(mView, mLayoutParams); mView.setVisibility(View.VISIBLE); } mViewVisible = true; } }); } + @Override public void destroy() { mDestroyed = true; mContainer.removeView(mView); } public void reset(Rect rect) { mLayoutParams.reset(rect);
--- a/mobile/android/base/sqlite/SQLiteBridge.java +++ b/mobile/android/base/sqlite/SQLiteBridge.java @@ -304,15 +304,16 @@ public class SQLiteBridge { } mTransactionSuccess = true; } public boolean inTransaction() { return mInTransaction; } + @Override public void finalize() { if (isOpen()) { Log.e(LOGTAG, "Bridge finalized without closing the database"); close(); } } }
--- a/mobile/android/base/tests/ContentProviderTest.java.in +++ b/mobile/android/base/tests/ContentProviderTest.java.in @@ -230,30 +230,32 @@ abstract class ContentProviderTest exten String param = (String) mProviderContract.getField(paramName).get(null); return uri.buildUpon().appendQueryParameter(param, value).build(); } public void setTestName(String testName) { mAsserter.setTestName(this.getClass().getName() + " - " + testName); } + @Override public void setUp() throws Exception { throw new Exception("You should call setUp(providerClassName, authorityUriField) instead"); } public void setUp(String providerClassName, String authorityUriField) throws Exception { super.setUp(); mClassLoader = getInstrumentation().getContext().getClassLoader(); mTests = new ArrayList<Runnable>(); setUpProviderClassAndAuthority(providerClassName, authorityUriField); setUpContentProvider(); } + @Override public void tearDown() throws Exception { if (Build.VERSION.SDK_INT >= 11) { mProvider.shutdown(); } String databaseName = null; Method getDatabasePath = mProviderClass.getDeclaredMethod("getDatabasePath", String.class, boolean.class);
--- a/mobile/android/base/tests/MotionEventHelper.java.in +++ b/mobile/android/base/tests/MotionEventHelper.java.in @@ -52,16 +52,17 @@ class MotionEventHelper { Log.d(LOGTAG, "Triggering up at (" + x + "," + y + ")"); MotionEvent event = MotionEvent.obtain(downTime, upTime, MotionEvent.ACTION_UP, mSurfaceOffsetX + x, mSurfaceOffsetY + y, 0); mInstrumentation.sendPointerSync(event); return -1L; } public Thread dragAsync(final float startX, final float startY, final float endX, final float endY, final long durationMillis) { Thread t = new Thread() { + @Override public void run() { int numEvents = (int)(durationMillis * DRAG_EVENTS_PER_SECOND / 1000); float eventDx = (endX - startX) / numEvents; float eventDy = (endY - startY) / numEvents; long downTime = down(startX, startY); for (int i = 0; i < numEvents - 1; i++) { downTime = move(downTime, startX + (eventDx * i), startY + (eventDy * i)); try { @@ -101,16 +102,17 @@ class MotionEventHelper { final float dx = (endX - startX) / 2; final float dy = (endY - startY) / 2; float distance = FloatMath.sqrt((dx * dx) + (dy * dy)); final long time = (long)(distance / velocity); if (time <= 0) { throw new IllegalArgumentException( "Fling parameters require too small a time period" ); } Thread t = new Thread() { + @Override public void run() { long downTime = down(startX, startY); downTime = move(downTime, downTime + time, startX + dx, startY + dy); downTime = move(downTime, downTime + time + time, endX, endY); downTime = up(downTime, downTime + time, endX, endY); } }; t.start();
--- a/mobile/android/base/tests/testAllPagesTab.java.in +++ b/mobile/android/base/tests/testAllPagesTab.java.in @@ -133,16 +133,17 @@ public class testAllPagesTab extends Bas Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded"); View child = list.getChildAt(0); mSolo.clickOnView(child); contentEventExpecter.blockForEvent(); verifyUrl(url); } + @Override public void tearDown() throws Exception { ContentResolver resolver = getActivity().getContentResolver(); Uri uri = Uri.parse("content://@ANDROID_PACKAGE_NAME@.db.browser/history"); uri = uri.buildUpon().appendQueryParameter("profile", "default") .appendQueryParameter("sync", "true").build(); resolver.delete(uri, "url = ?", new String[] { "http://mochi.test:8888/tests/robocop/robocop_big_link.html" });
--- a/mobile/android/base/tests/testBookmarksTab.java.in +++ b/mobile/android/base/tests/testBookmarksTab.java.in @@ -266,13 +266,14 @@ public class testBookmarksTab extends Ba visible = 0; for (int j = 0; j < textViews.size(); j++) { TextView text = textViews.get(j); visible += (text.getVisibility() == View.VISIBLE) ? 1 : 0; } mAsserter.is(textViews.size(), numTextViews, "Correct number of TextViews visible"); } + @Override public void tearDown() throws Exception { deleteBookmark("BOOKMARK_TITLE"); super.tearDown(); } }
--- a/mobile/android/base/tests/testBrowserProvider.java.in +++ b/mobile/android/base/tests/testBrowserProvider.java.in @@ -322,16 +322,17 @@ public class testBrowserProvider extends private Cursor getThumbnailByUrl(String url) throws Exception { return mProvider.query(mThumbnailsUri, null, mThumbnailsUrlCol + " = ?", new String[] { url }, null); } + @Override public void setUp() throws Exception { super.setUp("@ANDROID_PACKAGE_NAME@.db.BrowserProvider", "AUTHORITY"); loadContractInfo(); mTests.add(new TestSpecialFolders()); mTests.add(new TestInsertBookmarks()); mTests.add(new TestInsertBookmarksFavicons()); @@ -541,29 +542,31 @@ public class testBrowserProvider extends if (!cursor.moveToFirst()) allFound = false; cursor.close(); } mAsserter.is(allFound, true, "Found all bulkInsert entries"); } + @Override public void test() throws Exception { testApplyBatch(); // Clean up ensureEmptyDatabase(); testBulkInsert(); ensureEmptyDatabase(); testApplyBatchErrors(); } } class TestSpecialFolders extends Test { + @Override public void test() throws Exception { Cursor c = mProvider.query(mBookmarksUri, new String[] { mBookmarksIdCol, mBookmarksGuidCol, mBookmarksParentCol }, mBookmarksGuidCol + " = ? OR " + mBookmarksGuidCol + " = ? OR " + mBookmarksGuidCol + " = ? OR " + @@ -610,16 +613,17 @@ public class testBrowserProvider extends try { id = ContentUris.parseId(mProvider.insert(mBookmarksUri, b)); } catch (Exception e) {} return id; } + @Override public void test() throws Exception { ContentValues b = createOneBookmark(); long id = ContentUris.parseId(mProvider.insert(mBookmarksUri, b)); Cursor c = getBookmarkById(id); mAsserter.is(c.moveToFirst(), true, "Inserted bookmark found"); mAsserter.is(c.getString(c.getColumnIndex(mBookmarksTitleCol)), b.getAsString(mBookmarksTitleCol), @@ -670,16 +674,17 @@ public class testBrowserProvider extends mAsserter.is(c.moveToFirst(), true, "Inserted bookmark found"); mAsserter.is(c.getString(c.getColumnIndex(mBookmarksTypeCol)), String.valueOf(mBookmarksTypeBookmark), "Inserted bookmark has correct default type"); } } class TestInsertBookmarksFavicons extends Test { + @Override public void test() throws Exception { ContentValues b = createOneBookmark(); final String favicon = "FAVICON"; final String pageUrl = b.getAsString(mBookmarksUrlCol); long id = ContentUris.parseId(mProvider.insert(mBookmarksUri, b)); @@ -707,16 +712,17 @@ public class testBrowserProvider extends long id = ContentUris.parseId(mProvider.insert(mBookmarksUri, b)); Cursor c = getBookmarkById(id); mAsserter.is(c.moveToFirst(), true, "Inserted bookmark found"); return id; } + @Override public void test() throws Exception { long id = insertOneBookmark(); int deleted = mProvider.delete(mBookmarksUri, mBookmarksIdCol + " = ?", new String[] { String.valueOf(id) }); mAsserter.is((deleted == 1), true, "Inserted bookmark was deleted"); @@ -766,16 +772,17 @@ public class testBrowserProvider extends mAsserter.is((deleted == 0), true, "Should not be able to delete folder that causes orphan bookmarks"); } } } class TestDeleteBookmarksFavicons extends Test { + @Override public void test() throws Exception { ContentValues b = createOneBookmark(); final String pageUrl = b.getAsString(mBookmarksUrlCol); long id = ContentUris.parseId(mProvider.insert(mBookmarksUri, b)); // Insert the favicon into the favicons table mProvider.insert(mFaviconsUri, createFaviconEntry(pageUrl, "FAVICON")); @@ -801,16 +808,17 @@ public class testBrowserProvider extends updated = mProvider.update(mBookmarksUri, u, mBookmarksIdCol + " = ?", new String[] { String.valueOf(id) }); } catch (Exception e) {} return updated; } + @Override public void test() throws Exception { ContentValues b = createOneBookmark(); long id = ContentUris.parseId(mProvider.insert(mBookmarksUri, b)); Cursor c = getBookmarkById(id); mAsserter.is(c.moveToFirst(), true, "Inserted bookmark found"); long dateCreated = c.getLong(c.getColumnIndex(mBookmarksDateCreatedCol)); @@ -874,16 +882,17 @@ public class testBrowserProvider extends mAsserter.is(c.moveToFirst(), true, "Updated bookmark found"); mAsserter.is(c.getString(c.getColumnIndex(mBookmarksUrlCol)), u.getAsString(mBookmarksUrlCol), "Updated bookmark has correct URL using URI with id"); } } class TestUpdateBookmarksFavicons extends Test { + @Override public void test() throws Exception { ContentValues b = createOneBookmark(); final String favicon = "FAVICON"; final String newFavicon = "NEW_FAVICON"; final String pageUrl = b.getAsString(mBookmarksUrlCol); mProvider.insert(mBookmarksUri, b); @@ -937,16 +946,17 @@ public class testBrowserProvider extends ++i; c.moveToNext(); } mAsserter.is(i, count, "Folder has the right number of children."); } public static final int NUMBER_OF_CHILDREN = 1001; + @Override public void test() throws Exception { // Create the containing folder. ContentValues folder = createBookmark("FolderFolder", "", mMobileFolderId, mBookmarksTypeFolder, 0, "", "description", "keyword"); folder.put(mBookmarksGuidCol, "folderfolder"); long folderId = ContentUris.parseId(mProvider.insert(mBookmarksUri, folder)); @@ -1003,16 +1013,17 @@ public class testBrowserProvider extends try { id = ContentUris.parseId(mProvider.insert(mHistoryUri, h)); } catch (Exception e) {} return id; } + @Override public void test() throws Exception { ContentValues h = createOneHistoryEntry(); long id = ContentUris.parseId(mProvider.insert(mHistoryUri, h)); Cursor c = getHistoryEntryById(id); mAsserter.is(c.moveToFirst(), true, "Inserted history entry found"); mAsserter.is(c.getString(c.getColumnIndex(mHistoryTitleCol)), h.getAsString(mHistoryTitleCol), @@ -1032,16 +1043,17 @@ public class testBrowserProvider extends id = insertWithNullCol(mHistoryVisitsCol); mAsserter.is(new Long(id), new Long(-1), "Should not be able to insert history with null number of visits"); } } class TestInsertHistoryFavicons extends Test { + @Override public void test() throws Exception { ContentValues h = createOneHistoryEntry(); final String favicon = "FAVICON"; final String pageUrl = h.getAsString(mHistoryUrlCol); long id = ContentUris.parseId(mProvider.insert(mHistoryUri, h)); @@ -1069,16 +1081,17 @@ public class testBrowserProvider extends long id = ContentUris.parseId(mProvider.insert(mHistoryUri, h)); Cursor c = getHistoryEntryById(id); mAsserter.is(c.moveToFirst(), true, "Inserted history entry found"); return id; } + @Override public void test() throws Exception { long id = insertOneHistoryEntry(); int deleted = mProvider.delete(mHistoryUri, mHistoryIdCol + " = ?", new String[] { String.valueOf(id) }); mAsserter.is((deleted == 1), true, "Inserted history entry was deleted"); @@ -1103,16 +1116,17 @@ public class testBrowserProvider extends c = getHistoryEntryById(id); mAsserter.is(c.moveToFirst(), false, "Inserted history entry can't be found after deletion using URI with ID"); } } class TestDeleteHistoryFavicons extends Test { + @Override public void test() throws Exception { ContentValues h = createOneHistoryEntry(); long id = ContentUris.parseId(mProvider.insert(mHistoryUri, h)); final String pageUrl = h.getAsString(mHistoryUrlCol); // Insert the favicon into the favicons table mProvider.insert(mFaviconsUri, createFaviconEntry(pageUrl, "FAVICON")); @@ -1138,16 +1152,17 @@ public class testBrowserProvider extends updated = mProvider.update(mHistoryUri, u, mHistoryIdCol + " = ?", new String[] { String.valueOf(id) }); } catch (Exception e) {} return updated; } + @Override public void test() throws Exception { ContentValues h = createOneHistoryEntry(); long id = ContentUris.parseId(mProvider.insert(mHistoryUri, h)); Cursor c = getHistoryEntryById(id); mAsserter.is(c.moveToFirst(), true, "Inserted history entry found"); long dateCreated = c.getLong(c.getColumnIndex(mHistoryDateCreatedCol)); @@ -1202,16 +1217,17 @@ public class testBrowserProvider extends mAsserter.is(c.moveToFirst(), true, "Updated history entry found"); mAsserter.is(c.getString(c.getColumnIndex(mHistoryUrlCol)), u.getAsString(mHistoryUrlCol), "Updated history entry has correct URL using URI with id"); } } class TestUpdateHistoryFavicons extends Test { + @Override public void test() throws Exception { ContentValues h = createOneHistoryEntry(); final String favicon = "FAVICON"; final String newFavicon = "NEW_FAVICON"; final String pageUrl = h.getAsString(mHistoryUrlCol); mProvider.insert(mHistoryUri, h); @@ -1250,16 +1266,17 @@ public class testBrowserProvider extends null); c.moveToFirst(); long id = c.getLong(0); c.close(); return id; } + @Override public void test() throws Exception { Uri updateHistoryUriWithProfile = mHistoryUri.buildUpon(). appendQueryParameter("insert_if_needed", "true"). appendQueryParameter("increment_visits", "true").build(); // Update a non-existent history entry, without specifying visits or title ContentValues values = new ContentValues(); values.put(mHistoryUrlCol, TEST_URL_1); @@ -1348,16 +1365,17 @@ public class testBrowserProvider extends "Updated history entry has same creation date"); mAsserter.isnot(new Long(c.getLong(c.getColumnIndex(mHistoryDateModifiedCol))), new Long(dateModified), "Updated history entry has new modification date"); } } class TestInsertHistoryThumbnails extends Test { + @Override public void test() throws Exception { ContentValues h = createOneHistoryEntry(); final String thumbnail = "THUMBNAIL"; final String pageUrl = h.getAsString(mHistoryUrlCol); long id = ContentUris.parseId(mProvider.insert(mHistoryUri, h)); @@ -1368,16 +1386,17 @@ public class testBrowserProvider extends mAsserter.is(c.moveToFirst(), true, "Inserted thumbnail found"); mAsserter.is(new String(c.getBlob(c.getColumnIndex(mThumbnailsDataCol)), "UTF8"), thumbnail, "Inserted thumbnail has corresponding thumbnail image"); } } class TestUpdateHistoryThumbnails extends Test { + @Override public void test() throws Exception { ContentValues h = createOneHistoryEntry(); final String thumbnail = "THUMBNAIL"; final String newThumbnail = "NEW_THUMBNAIL"; final String pageUrl = h.getAsString(mHistoryUrlCol); mProvider.insert(mHistoryUri, h); @@ -1399,16 +1418,17 @@ public class testBrowserProvider extends mAsserter.is(c.moveToFirst(), true, "Updated thumbnail found"); mAsserter.is(new String(c.getBlob(c.getColumnIndex(mThumbnailsDataCol)), "UTF8"), newThumbnail, "Updated thumbnail has corresponding thumbnail image"); } } class TestDeleteHistoryThumbnails extends Test { + @Override public void test() throws Exception { ContentValues h = createOneHistoryEntry(); long id = ContentUris.parseId(mProvider.insert(mHistoryUri, h)); final String pageUrl = h.getAsString(mHistoryUrlCol); // Insert the thumbnail into the thumbnails table mProvider.insert(mThumbnailsUri, createThumbnailEntry(pageUrl, "THUMBNAIL")); @@ -1419,16 +1439,17 @@ public class testBrowserProvider extends mProvider.delete(ContentUris.withAppendedId(mHistoryUri, id), null, null); c = getThumbnailByUrl(pageUrl); mAsserter.is(c.moveToFirst(), false, "Thumbnail is deleted with last reference to it"); } } class TestCombinedView extends Test { + @Override public void test() throws Exception { final String TITLE_1 = "Test Page 1"; final String TITLE_2 = "Test Page 2"; final String TITLE_3_HISTORY = "Test Page 3 (History Entry)"; final String TITLE_3_BOOKMARK = "Test Page 3 (Bookmark Entry)"; final String TITLE_3_BOOKMARK2 = "Test Page 3 (Bookmark Entry 2)"; final String URL_1 = "http://example1.com"; @@ -1525,16 +1546,17 @@ public class testBrowserProvider extends mAsserter.is(c.getInt(c.getColumnIndex(mCombinedVisitsCol)), VISITS, "Combined entry has correct number of visits"); mAsserter.is(new Long(c.getLong(c.getColumnIndex(mCombinedLastVisitedCol))), new Long(LAST_VISITED), "Combined entry has correct last visit time"); } } class TestCombinedViewDisplay extends Test { + @Override public void test() throws Exception { final String TITLE_1 = "Test Page 1"; final String TITLE_2 = "Test Page 2"; final String TITLE_3_HISTORY = "Test Page 3 (History Entry)"; final String TITLE_3_BOOKMARK = "Test Page 3 (Bookmark Entry)"; final String TITLE_4 = "Test Page 4"; final String URL_1 = "http://example.com"; @@ -1584,16 +1606,17 @@ public class testBrowserProvider extends mAsserter.is(new Integer(display), new Integer(expectedDisplay), "Combined display column should always be DISPLAY_READER for the reading list item"); } } } class TestCombinedViewWithDeletedBookmark extends Test { + @Override public void test() throws Exception { final String TITLE = "Test Page 1"; final String URL = "http://example.com"; final int VISITS = 10; final long LAST_VISITED = System.currentTimeMillis(); // Create a combined history entry ContentValues combinedHistory = createHistoryEntry(TITLE, URL, VISITS, LAST_VISITED); @@ -1622,16 +1645,17 @@ public class testBrowserProvider extends mAsserter.is(c.moveToFirst(), true, "Found combined entry without bookmark id"); mAsserter.is(new Long(c.getLong(c.getColumnIndex(mCombinedBookmarkIdCol))), new Long(0), "Bookmark id should not be set to removed bookmark id"); } } class TestCombinedViewWithDeletedReadingListItem extends Test { + @Override public void test() throws Exception { final String TITLE = "Test Page 1"; final String URL = "http://example.com"; final int VISITS = 10; final long LAST_VISITED = System.currentTimeMillis(); // Create a combined history entry ContentValues combinedHistory = createHistoryEntry(TITLE, URL, VISITS, LAST_VISITED); @@ -1708,16 +1732,17 @@ public class testBrowserProvider extends inserts = mProvider.bulkInsert(mThumbnailsUri, allVals); mAsserter.is(inserts, count, "Expected number of inserts matches"); c = mProvider.query(mThumbnailsUri, null, null, null, null); mAsserter.is(c.getCount(), count, count + " thumbnails entries found"); } + @Override public void test() throws Exception { final int count = 3000; final int thumbCount = 15; // insert a bunch of new entries createFakeHistory(0, count); // expiring with a normal priority should not delete new entries @@ -1807,16 +1832,17 @@ public class testBrowserProvider extends null, "Notification from " + operation + " was valid"); mAsserter.ok(uri.toString().startsWith(expectedUri.toString()), "Content observer was notified exactly once by " + operation, uri.toString() + " starts with expected prefix " + expectedUri); } + @Override public void test() throws Exception { // Insert final ContentValues h = createOneHistoryEntry(); mResolver.notifyChangeList.clear(); long id = ContentUris.parseId(mProvider.insert(mHistoryUri, h)); mAsserter.isnot(Long.valueOf(id),
--- a/mobile/android/base/tests/testBrowserProviderPerf.java.in +++ b/mobile/android/base/tests/testBrowserProviderPerf.java.in @@ -247,16 +247,17 @@ public class testBrowserProviderPerf ext historyEntries[i] = createRandomHistoryEntry(KNOWN_PREFIX); faviconEntries[i] = createFaviconEntryWithUrl(historyEntries[i].getAsString(mHistoryUrlCol)); } mProvider.bulkInsert(mHistoryUri, historyEntries); mProvider.bulkInsert(mFaviconsUri, faviconEntries); } + @Override public void setUp() throws Exception { super.setUp("@ANDROID_PACKAGE_NAME@.db.BrowserProvider", "AUTHORITY"); mGenerator = new Random(19580427); loadContractInfo(); loadFilterMethod(); }
--- a/mobile/android/base/tests/testDistribution.java.in +++ b/mobile/android/base/tests/testDistribution.java.in @@ -136,21 +136,23 @@ public class testDistribution extends Co // Clears the distribution pref to return distribution state to STATE_UNKNOWN private void clearDistributionPref() { SharedPreferences settings = mActivity.getSharedPreferences("GeckoApp", Activity.MODE_PRIVATE); String keyName = mActivity.getPackageName() + ".distribution_state"; settings.edit().remove(keyName).commit(); } + @Override public void setUp() throws Exception { // TODO: Set up the content provider after setting the distribution. super.setUp("@ANDROID_PACKAGE_NAME@.db.BrowserProvider", "AUTHORITY"); } + @Override public void tearDown() throws Exception { File dataDir = new File(mActivity.getApplicationInfo().dataDir); // Delete mock package from data directory. File mockPackage = new File(dataDir, MOCK_PACKAGE); mAsserter.ok(mockPackage.delete(), "clean up mock package", "deleted " + mockPackage.getPath()); // Delete distribution files that Distribution.init copied to data directory.
--- a/mobile/android/base/tests/testFormHistory.java.in +++ b/mobile/android/base/tests/testFormHistory.java.in @@ -101,16 +101,17 @@ public class testFormHistory extends Bas 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]; SqliteCompare(DB_NAME, "SELECT * FROM moz_formhistory", cvs); } + @Override 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());
--- a/mobile/android/base/tests/testHistoryTab.java.in +++ b/mobile/android/base/tests/testHistoryTab.java.in @@ -235,16 +235,17 @@ public class testHistoryTab extends Pixe mSolo.clickOnView(mFirstChild); contentEventExpecter.blockForEvent(); verifyUrl(url); } else { mAsserter.ok(false, "waiting for history item", "history item available"); } } + @Override public void tearDown() throws Exception { ContentResolver resolver = getActivity().getContentResolver(); Uri uri = Uri.parse("content://@ANDROID_PACKAGE_NAME@.db.browser/history"); uri = uri.buildUpon().appendQueryParameter("profile", "default") .appendQueryParameter("sync", "true").build(); resolver.delete(uri, "url = ?", new String[] { "http://mochi.test:8888/tests/robocop/robocop_blank_01.html" });
--- a/mobile/android/base/tests/testMigration.java.in +++ b/mobile/android/base/tests/testMigration.java.in @@ -337,16 +337,17 @@ public class testMigration extends Conte mAsserter.is(visits, 4, "Visit count of " + visits + " equals expected 4"); } @Override public void setUp() throws Exception { super.setUp("@ANDROID_PACKAGE_NAME@.db.BrowserProvider", "AUTHORITY"); } + @Override public void tearDown() throws Exception { // remove the database file File profile = new File(mProfile); File db = new File(profile, DB_NAME); if (db.delete()) { mAsserter.dumpLog("tearDown deleted "+db.toString()); } else { mAsserter.dumpLog("tearDown did not delete "+db.toString());
--- a/mobile/android/base/tests/testPasswordEncrypt.java.in +++ b/mobile/android/base/tests/testPasswordEncrypt.java.in @@ -144,16 +144,17 @@ public class testPasswordEncrypt extends data = new JSONObject(eventExpecter.blockForEventData()); requestId = data.getString("requestId"); } } catch (Exception ex) { mAsserter.ok(false, "exception in toggleMasterPassword", ex.toString()); } } + @Override public void tearDown() throws Exception { // remove the entire signons.sqlite file File profile = new File(mProfile); File db = new File(profile, "signons.sqlite"); if (db.delete()) { mAsserter.dumpLog("tearDown deleted "+db.toString()); } else { mAsserter.dumpLog("tearDown did not delete "+db.toString());
--- a/mobile/android/base/tests/testPasswordProvider.java.in +++ b/mobile/android/base/tests/testPasswordProvider.java.in @@ -78,16 +78,17 @@ public class testPasswordProvider extend int numDeleted = cr.delete(passwordUri, null, null); mAsserter.is(1, numDeleted, "Correct number deleted"); cvs = new ContentValues[0]; c = cr.query(passwordUri, null, null, null, null); SqliteCompare(c, cvs); } + @Override public void tearDown() throws Exception { // remove the entire signons.sqlite file File profile = new File(mProfile); File db = new File(profile, "signons.sqlite"); if (db.delete()) { mAsserter.dumpLog("tearDown deleted "+db.toString()); } else { mAsserter.dumpLog("tearDown did not delete "+db.toString());