Mobile/Fennec/Android/CommonTips: Difference between revisions

Line 110: Line 110:
=== Add a new table to browser.db ===
=== Add a new table to browser.db ===
To follow along with code, see [https://bugzilla.mozilla.org/show_bug.cgi?id=1250707 Bug 1250707].
To follow along with code, see [https://bugzilla.mozilla.org/show_bug.cgi?id=1250707 Bug 1250707].
==== Init migration tests ====
*Capture a current version of the database (before your changes!) with some browsing data from your device using the Copy Profile add-on. Put this in <tt>mobile/android/tests/browser/robocop/assets/browser_db_upgrade/v<#>.db</tt>. It is used to test your upgrade changes in <tt>testBrowserDatabaseHelperUpgrades</tt>
*Capture a current version of the database (before your changes!) with some browsing data from your device using the Copy Profile add-on. Put this in <tt>mobile/android/tests/browser/robocop/assets/browser_db_upgrade/v<#>.db</tt>. It is used to test your upgrade changes in <tt>testBrowserDatabaseHelperUpgrades</tt>
====Create the table and query & insert via BrowserProvider====
*Add your table name & schema as a new <tt>static</tt> class in <tt>BrowserContract</tt>
*Add your table name & schema as a new <tt>static</tt> class in <tt>BrowserContract</tt>
*Increment the <tt>DATABASE_VERSION</tt> in <tt>BrowserDatabaseHelper</tt> and update the related bug # comment
*Increment the <tt>DATABASE_VERSION</tt> in <tt>BrowserDatabaseHelper</tt> and update the related bug # comment
Line 119: Line 122:
*Add to the <tt>BrowserProvider.query</tt> method (pattern match!) by setting the projection map and table in the <tt>SQLiteQueryBuilder</tt> object.
*Add to the <tt>BrowserProvider.query</tt> method (pattern match!) by setting the projection map and table in the <tt>SQLiteQueryBuilder</tt> object.
*Add to the <tt>BrowserProvider.insertInTransaction</tt> method (pattern match!) by calling out to your own method to insert into the DB
*Add to the <tt>BrowserProvider.insertInTransaction</tt> method (pattern match!) by calling out to your own method to insert into the DB
*Test insert!
====Test insertions via BrowserProvider====
 
*Add a <tt>TestInsert* extends TestCase</tt> class with a <tt>test</tt> method. Insert a value, query, and make sure you receive what you think you should! Pattern match other tests here.
==== Explanation of classes ====
*Add your test to <tt>TestBrowserProvider.setUp</tt>
*<tt>BrowserContract</tt>
*<tt>BrowserDatabaseHelper</tt>


=== External how-to's ===
=== External how-to's ===
*[[Mobile/Fennec/Android/Updating search engine icons|Updating the search engine icons]]
*[[Mobile/Fennec/Android/Updating search engine icons|Updating the search engine icons]]
*[[Mobile/Fennec/Android/Updating_SDK_on_builders|Updating the Android SDK on the builders]]
*[[Mobile/Fennec/Android/Updating_SDK_on_builders|Updating the Android SDK on the builders]]
Confirmed users
975

edits