* #39226: restore Tests module

This commit reactivate unit testing in SFLphone android.
Tests are trivial for now, but will contribute in setting up the whole
testing process with jenkins.
diff --git a/Tests/AndroidManifest.xml b/Tests/AndroidManifest.xml
new file mode 100644
index 0000000..28379ff
--- /dev/null
+++ b/Tests/AndroidManifest.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          package="org.sflphone.tests"
+          android:versionCode="1"
+          android:versionName="1.0">
+    <!-- We add an application tag here just so that we can indicate that
+         this package needs to link against the android.test library,
+         which is needed when building test cases. -->
+    <application>
+        <uses-library android:name="android.test.runner"/>
+    </application>
+
+    <uses-sdk
+            android:minSdkVersion="14"
+            android:targetSdkVersion="19" />
+    <!--
+    This declares that this application uses the instrumentation test runner targeting
+    the package of org.sflphone.  To run the tests use the command:
+    "adb shell am instrument -w org.sflphone.tests/android.test.InstrumentationTestRunner"
+    -->
+    <instrumentation
+            android:name="android.test.InstrumentationTestRunner"
+            android:targetPackage="org.sflphone"
+            android:label="Tests for org.sflphone"/>
+</manifest>
diff --git a/Tests/Tests.iml b/Tests/Tests.iml
new file mode 100644
index 0000000..52f8906
--- /dev/null
+++ b/Tests/Tests.iml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="android" name="Android">
+      <configuration>
+        <option name="PACK_TEST_CODE" value="true" />
+        <option name="UPDATE_PROPERTY_FILES" value="true" />
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="SFLPhone" scope="PROVIDED" />
+  </component>
+</module>
+
diff --git a/Tests/build.xml b/Tests/build.xml
new file mode 100644
index 0000000..e6e4c09
--- /dev/null
+++ b/Tests/build.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="Tests" default="help">
+
+    <!-- The local.properties file is created and updated by the 'android' tool.
+         It contains the path to the SDK. It should *NOT* be checked into
+         Version Control Systems. -->
+    <property file="local.properties"/>
+
+    <!-- The ant.properties file can be created by you. It is only edited by the
+         'android' tool to add properties to it.
+         This is the place to change some Ant specific build properties.
+         Here are some properties you may want to change/update:
+
+         source.dir
+             The name of the source directory. Default is 'src'.
+         out.dir
+             The name of the output directory. Default is 'bin'.
+
+         For other overridable properties, look at the beginning of the rules
+         files in the SDK, at tools/ant/build.xml
+
+         Properties related to the SDK location or the project target should
+         be updated using the 'android' tool with the 'update' action.
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems.
+
+         -->
+    <property file="ant.properties"/>
+
+    <!-- if sdk.dir was not set from one of the property file, then
+         get it from the ANDROID_HOME env var.
+         This must be done before we load project.properties since
+         the proguard config can use sdk.dir -->
+    <property environment="env"/>
+    <condition property="sdk.dir" value="${env.ANDROID_HOME}">
+        <isset property="env.ANDROID_HOME"/>
+    </condition>
+
+    <!-- The project.properties file is created and updated by the 'android'
+         tool, as well as ADT.
+
+         This contains project specific properties such as project target, and library
+         dependencies. Lower level build properties are stored in ant.properties
+         (or in .classpath for Eclipse projects).
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems. -->
+    <loadproperties srcFile="project.properties"/>
+
+    <!-- quick check on sdk.dir -->
+    <fail
+            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
+            unless="sdk.dir"
+            />
+
+    <!--
+        Import per project custom build rules if present at the root of the project.
+        This is the place to put custom intermediary targets such as:
+            -pre-build
+            -pre-compile
+            -post-compile (This is typically used for code obfuscation.
+                           Compiled code location: ${out.classes.absolute.dir}
+                           If this is not done in place, override ${out.dex.input.absolute.dir})
+            -post-package
+            -post-build
+            -pre-clean
+    -->
+    <import file="custom_rules.xml" optional="true"/>
+
+    <!-- Import the actual build file.
+
+         To customize existing targets, there are two options:
+         - Customize only one target:
+             - copy/paste the target into this file, *before* the
+               <import> task.
+             - customize it to your needs.
+         - Customize the whole content of build.xml
+             - copy/paste the content of the rules files (minus the top node)
+               into this file, replacing the <import> task.
+             - customize to your needs.
+
+         ***********************
+         ****** IMPORTANT ******
+         ***********************
+         In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+         in order to avoid having your file be overridden by tools such as "android update project"
+    -->
+    <!-- version-tag: 1 -->
+    <import file="${sdk.dir}/tools/ant/build.xml"/>
+
+</project>
diff --git a/Tests/gen/org/sflphone/tests/BuildConfig.java b/Tests/gen/org/sflphone/tests/BuildConfig.java
new file mode 100644
index 0000000..880f80f
--- /dev/null
+++ b/Tests/gen/org/sflphone/tests/BuildConfig.java
@@ -0,0 +1,8 @@
+/*___Generated_by_IDEA___*/
+
+package org.sflphone.tests;
+
+/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
+public final class BuildConfig {
+  public final static boolean DEBUG = Boolean.parseBoolean(null);
+}
\ No newline at end of file
diff --git a/Tests/gen/org/sflphone/tests/Manifest.java b/Tests/gen/org/sflphone/tests/Manifest.java
new file mode 100644
index 0000000..297935d
--- /dev/null
+++ b/Tests/gen/org/sflphone/tests/Manifest.java
@@ -0,0 +1,7 @@
+/*___Generated_by_IDEA___*/
+
+package org.sflphone.tests;
+
+/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
+public final class Manifest {
+}
\ No newline at end of file
diff --git a/Tests/gen/org/sflphone/tests/R.java b/Tests/gen/org/sflphone/tests/R.java
new file mode 100644
index 0000000..8956400
--- /dev/null
+++ b/Tests/gen/org/sflphone/tests/R.java
@@ -0,0 +1,7 @@
+/*___Generated_by_IDEA___*/
+
+package org.sflphone.tests;
+
+/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
+public final class R {
+}
\ No newline at end of file
diff --git a/Tests/proguard-project.txt b/Tests/proguard-project.txt
new file mode 100644
index 0000000..f2fe155
--- /dev/null
+++ b/Tests/proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
diff --git a/Tests/project.properties b/Tests/project.properties
new file mode 100644
index 0000000..4ab1256
--- /dev/null
+++ b/Tests/project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-19
diff --git a/Tests/src/org/sflphone/client/HomeActivityTest.java b/Tests/src/org/sflphone/client/HomeActivityTest.java
new file mode 100644
index 0000000..ecde418
--- /dev/null
+++ b/Tests/src/org/sflphone/client/HomeActivityTest.java
@@ -0,0 +1,28 @@
+package org.sflphone.client;
+
+import android.test.ActivityInstrumentationTestCase2;
+import junit.framework.Assert;
+
+/**
+ * This is a simple framework for a test of an Application.  See
+ * {@link android.test.ApplicationTestCase ApplicationTestCase} for more information on
+ * how to write and extend Application tests.
+ * <p/>
+ * To run this test, you can type:
+ * adb shell am instrument -w \
+ * -e class org.sflphone.client.HomeActivityTest \
+ * org.sflphone.tests/android.test.InstrumentationTestRunner
+ */
+public class HomeActivityTest extends ActivityInstrumentationTestCase2<HomeActivity> {
+
+    public HomeActivityTest() {
+        super(HomeActivity.class);
+    }
+
+
+    public void testStringForDisplay() throws Exception {
+        HomeActivity act_ = getActivity();
+        Assert.assertTrue(act_.getService() != null);
+    }
+
+}
diff --git a/Tests/src/org/sflphone/client/ManagerImplTest.java b/Tests/src/org/sflphone/client/ManagerImplTest.java
new file mode 100644
index 0000000..6f4f5d4
--- /dev/null
+++ b/Tests/src/org/sflphone/client/ManagerImplTest.java
@@ -0,0 +1,109 @@
+package org.sflphone.client;
+/**
+ * Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+ *
+ * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Additional permission under GNU GPL version 3 section 7:
+ *
+ * If you modify this program, or any covered work, by linking or
+ * combining it with the OpenSSL project's OpenSSL library (or a
+ * modified version of that library), containing parts covered by the
+ * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
+ * grants you additional permission to convey the resulting work.
+ * Corresponding Source for a non-source form of such a combination
+ * shall include the source code for the parts of OpenSSL used as well
+ * as that of the covered work.
+ */
+
+
+        import java.lang.Thread;
+        import android.test.AndroidTestCase;
+        import org.sflphone.service.*;
+
+
+public class ManagerImplTest extends AndroidTestCase {
+    public static final String ACCOUNT_ID = "IP2IP";
+    public static final String CALLING_VALID_IP = "127.0.0.1";
+    public static final String CALLING_BAD_IP = "123.234.123.234";
+    public static final String CALL_ID = "1234567";
+    public static final int CALL_SLEEP_TIME = 1000; // in ms
+
+    static {
+        System.loadLibrary("gnustl_shared");
+        System.loadLibrary("crypto");
+        System.loadLibrary("ssl");
+        System.loadLibrary("sflphone");
+    }
+
+    ManagerImpl managerImpl;
+    private CallManager callManagerJNI;
+    private ConfigurationManager configurationManagerJNI;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        managerImpl = SFLPhoneservice.instance();
+        /* set static AppPath before calling manager.init */
+        // managerImpl.setPath(getApplication().getFilesDir().getAbsolutePath());
+        callManagerJNI = new CallManager();
+        configurationManagerJNI = new ConfigurationManager();
+        /*managerImpl.init("");*/
+
+        assertTrue(managerImpl != null);
+        assertTrue(callManagerJNI != null);
+        assertTrue(configurationManagerJNI != null);
+    }
+
+/*    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }*/
+
+
+/*    public void testPlaceCallSuccessful() {
+        try {
+            callManagerJNI.placeCall(ACCOUNT_ID, CALL_ID, CALLING_VALID_IP);
+            assertTrue(true);
+
+            // FIXME: We should have a method returning the call state
+            //        and wait for the call to be in state CURRENT.
+            Thread.sleep(CALL_SLEEP_TIME);
+
+            callManagerJNI.hangUp(CALL_ID);
+            assertTrue(true);
+
+        } catch (InterruptedException e) {
+            assertTrue(false);
+        }
+    }*/
+
+    /*public void testPlaceCallBad() {
+        try {
+            callManagerJNI.placeCall(ACCOUNT_ID, CALL_ID, CALLING_BAD_IP);
+            assertTrue(true);
+
+            Thread.sleep(CALL_SLEEP_TIME);
+
+            callManagerJNI.hangUp(CALL_ID);
+            assertTrue(true);
+
+        } catch (InterruptedException e) {
+            assertTrue(false);
+        }
+    }*/
+}