Confirmed users
355
edits
Nalexander (talk | contribs) |
Nalexander (talk | contribs) |
||
| Line 24: | Line 24: | ||
hw.ramSize=256 | hw.ramSize=256 | ||
{{note|Target (in the example above, | {{note|Target (in the example above, <tt>android-10</tt>) probably needs to match build specified in .mozconfig (see Building Fennec Native below).}} | ||
* to launch: | * to launch: | ||
| Line 40: | Line 40: | ||
== Running everything == | == Running everything == | ||
The main <tt>android-sync</tt> source repository is hosted on github: | |||
https://github.com/mozilla-services/android-sync | |||
Try | |||
git clone git@github.com:mozilla-services/android-sync.git | |||
=== android-sync dependencies === | === android-sync dependencies === | ||
| Line 60: | Line 60: | ||
* JUnit 4.1. | * JUnit 4.1. | ||
* org.simpleframework.simple, for HTTP testing. | * org.simpleframework.simple, for HTTP testing. | ||
* Tiny “un-stub” packages for android.util.Log | * Tiny “un-stub” packages for android.util.Log, android.util.Base64, and android.content.SharedPreferences. | ||
These live on github, and must be built and installed. | |||
** https://github.com/rnewman/base64-unstub | ** https://github.com/rnewman/base64-unstub | ||
** https://github.com/rnewman/log-unstub | ** https://github.com/rnewman/log-unstub | ||
** https://github.com/rnewman/sharedpreferences-stub | |||
=== sync-crypto dependencies === | === sync-crypto dependencies === | ||
sync-crypto relies on Apache commons-codec 1.5, which includes Base32. The Android system libraries include the 8-year-old version 1.2. As a result, sync-crypto is packaged as an assembly jar (aka über jar) | sync-crypto relies on Apache commons-codec 1.5, which includes Base32. The Android system libraries include the 8-year-old version 1.2. As a result, sync-crypto is packaged as an assembly jar (aka über jar). | ||
=== What you need to do === | === What you need to do === | ||
| Line 74: | Line 76: | ||
git clone https://github.com/rnewman/base64-unstub | git clone https://github.com/rnewman/base64-unstub | ||
git clone https://github.com/rnewman/log-unstub | git clone https://github.com/rnewman/log-unstub | ||
git clone https://github.com/rnewman/sharedpreferences-stub | |||
git clone https://github.com/mozilla-services/android-sync | git clone https://github.com/mozilla-services/android-sync | ||
pushd base64-unstub; mvn install; popd | |||
pushd base64-unstub; mvn install; popd | pushd log-unstub; mvn install; popd | ||
pushd log-unstub; | pushd sharedpreferences-stub; mvn install; popd | ||
pushd | |||
pushd android-sync | pushd android-sync | ||
./ | git checkout develop | ||
./preprocess.sh | |||
mvn test | mvn test | ||
Note that both android-sync and sync-crypto have JUnit 4 tests that run in both Eclipse and Maven. android-sync | {{note|<tt>mvn assembly:assembly</tt> may fail, however, it is still ok to proceed.}} | ||
To do real Android development and testing, you need to import android-sync as a project in Eclipse with the ADT installed. | |||
Note that both android-sync and sync-crypto have JUnit 4 tests that run in both Eclipse and Maven. The subdirectory android-sync/test includes Android JUnit 3 tests for activity and store testing. This is to avoid the mammoth annoyance of testing in a VM without introducing robolectric. | |||
=== Running Fennec === | === Running Fennec === | ||
| Line 116: | Line 121: | ||
* Install Eclipse and the SDK plugin, as described in the Android SDK page. | * Install Eclipse and the SDK plugin, as described in the Android SDK page. | ||
* Correct formatting: <tt>Preferences > Java > Code style > Formatter > Edit...</tt>, set profile name to <tt>Mozilla</tt>, set <tt>Tab policy</tt> to <tt>Spaces only</tt> change both <tt>Indentation size</tt> and <tt>Tab size</tt> to 2, and check <tt>Align fields in columns</tt>. | * Correct formatting: <tt>Preferences > Java > Code style > Formatter > Edit...</tt>, set profile name to <tt>Mozilla</tt>, set <tt>Tab policy</tt> to <tt>Spaces only</tt> change both <tt>Indentation size</tt> and <tt>Tab size</tt> to 2, and check <tt>Align fields in columns</tt>. | ||
* Run these commands in | * Run these commands in your <tt>android-sync</tt> git repository directory (don't forget to checkout the <tt>develop</tt> branch): | ||
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo | mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo | ||
mvn -DdownloadJavadocs=true -DdownloadSources=true eclipse:eclipse | mvn -DdownloadJavadocs=true -DdownloadSources=true eclipse:eclipse | ||
* Install the project and classpath files (again in | * Install the project and classpath files (again in your git repository directory), making sure to update the paths where necessary in both files: | ||
cp example.project .project | cp example.project .project | ||
cp example.classpath .classpath | cp example.classpath .classpath | ||
* Open Eclipse, choose <tt>File > Import... > General > Existing Projects into Workspace</tt>, and specify | * Open Eclipse, choose <tt>File > Import... > General > Existing Projects into Workspace</tt>, and specify your git repository directory. | ||
{{note|You may need to set <tt>M2_REPO</tt> (for example, as described at [http://www.mkyong.com/maven/how-to-configure-m2_repo-variable-in-eclipse-ide/]) to something like <tt>$HOME/.m2/repository</tt>.}} | {{note|You may need to set <tt>M2_REPO</tt> (for example, as described at [http://www.mkyong.com/maven/how-to-configure-m2_repo-variable-in-eclipse-ide/]) to something like <tt>$HOME/.m2/repository</tt>.}} | ||
==== To run the | ==== To run the unit test suite under Eclipse ==== | ||
* First configure the test suite launcher, under <tt>Preferences > Run/Debug > Launching > Default Launchers</tt>. Set the Debug and Run launchers to <tt>Android JUnit Test Launcher</tt>. | * First configure the test suite launcher, under <tt>Preferences > Run/Debug > Launching > Default Launchers</tt>. Set the Debug and Run launchers to <tt>Android JUnit Test Launcher</tt>. | ||
* Select the <tt>android-sync</tt> project and execute <tt>Run > Run As ... > JUnit Test</tt>. | * Select the <tt>android-sync</tt> project and execute <tt>Run > Run As ... > JUnit Test</tt>. | ||
==== To run the | ==== To run the integration test suite under Eclipse ==== | ||
* Add the <tt>test</tt> subdirectory as a sub-project using <tt>File > Import > Existing project</tt>. | |||
* Refresh and clean everything. | |||
* Select the <tt> | * Select the <tt>test</tt> project and execute <tt>Run > Run As ... > Android JUnit Test</tt>. | ||
== Development == | == Development == | ||
| Line 147: | Line 156: | ||
We don't quite follow the [[Fennec/NativeUI/CodingStyle]]. See also [http://source.android.com/source/code-style.html the Android coding style]. | We don't quite follow the [[Fennec/NativeUI/CodingStyle]]. See also [http://source.android.com/source/code-style.html the Android coding style]. | ||
=== Running test code coverage === | === Running unit test code coverage === | ||
To see the current test code coverage (using the Maven plugin integrating Cobertura), from the <tt>android-sync</tt> directory run | To see the current unit test code coverage (using the Maven plugin integrating Cobertura), from the <tt>android-sync</tt> directory run | ||
mvn cobertura:cobertura | mvn cobertura:cobertura | ||
| Line 158: | Line 167: | ||
and click on <tt>org.mozilla.gecko</tt>. | and click on <tt>org.mozilla.gecko</tt>. | ||
{{note|At this time, you can't see the current integration test code coverage.}} | |||
== Security == | == Security == | ||
| Line 179: | Line 190: | ||
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> | <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> | ||
<uses-permission android:name="android.permission.WRITE_SETTINGS" /> | <uses-permission android:name="android.permission.WRITE_SETTINGS" /> | ||
<uses-permission android:name="android.permission.READ_SYNC_STATS" /> | <uses-permission android:name="android.permission.READ_SYNC_STATS" /> | ||
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" /> | <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" /> | ||