diff --git a/.classpath b/.classpath
index b6af78b2d..2c1efbc34 100644
--- a/.classpath
+++ b/.classpath
@@ -1,17 +1,17 @@
-
-
+
+
diff --git a/.gitignore b/.gitignore
index b04540b57..10d46ec48 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,17 @@
-libs
-obj
-gen
-bin
-doc
-default.properties
-local.properties
-project.properties
-tests/*$py.class
-tests/build.xml
-res/.DS_Store
-bc-android.keystore
-res/raw/lpconfig.xsd
\ No newline at end of file
+libs
+obj
+gen
+bin
+doc
+*.orig
+*.rej
+.settings
+.DS_Store
+default.properties
+local.properties
+project.properties
+tests/*$py.class
+tests/build.xml
+res/.DS_Store
+bc-android.keystore
+res/raw/lpconfig.xsd
diff --git a/.gitmodules b/.gitmodules
index dc550ebff..6f95e3bd2 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,12 +1,6 @@
[submodule "linphone"]
path = submodules/linphone
- url = git://git.linphone.org/linphone.git
-[submodule "submodules/externals/osip"]
- path = submodules/externals/osip
- url = git://git.linphone.org/osip.git
-[submodule "submodules/externals/exosip"]
- path = submodules/externals/exosip
- url = git://git.linphone.org/exosip.git
+ url = gitosis@git.linphone.org:linphone-private
[submodule "submodules/externals/gsm"]
path = submodules/externals/gsm
url = git://git.linphone.org/gsm.git
@@ -58,12 +52,24 @@
[submodule "submodules/externals/webrtc"]
path = submodules/externals/webrtc
url = git://git.linphone.org/webrtc.git
+[submodule "submodules/belle-sip"]
+ path = submodules/belle-sip
+ url = gitosis@git.linphone.org:belle-sip
+[submodule "submodules/externals/antlr3"]
+ path = submodules/externals/antlr3
+ url = git://git.linphone.org/antlr3.git
[submodule "submodules/externals/libxml2"]
path = submodules/externals/libxml2
url = git://git.gnome.org/libxml2
[submodule "submodules/externals/libupnp"]
path = submodules/externals/libupnp
url = git://git.code.sf.net/p/pupnp/code
+[submodule "submodules/externals/cunit"]
+ path = submodules/externals/cunit
+ url = git://git.linphone.org/cunit.git
[submodule "submodules/externals/axmlrpc"]
path = submodules/externals/axmlrpc
url = git://git.linphone.org/axmlrpc.git
+[submodule "submodules/externals/polarssl"]
+ path = submodules/externals/polarssl
+ url = git://git.linphone.org/polarssl.git
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6990d4d42..91b98e779 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -126,7 +126,8 @@
-
+
+
diff --git a/Makefile b/Makefile
index 2dbde39b7..1ab775c71 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ ANDROID_MOST_RECENT_TARGET=$(shell android list target -c | grep android | tail
NDK_DEBUG=0
BUILD_UPNP=1
BUILD_REMOTE_PROVISIONING=1
-BUILD_X264=1
+BUILD_X264=0
BUILD_AMRNB=full # 0, light or full
BUILD_AMRWB=0
BUILD_GPLV3_ZRTP=0
@@ -21,8 +21,23 @@ BUILD_TUNNEL=0
BUILD_WEBRTC_AECM=1
BUILD_FOR_X86=1
USE_JAVAH=1
+LINPHONE_VIDEO=1
+BUILD_TLS=1
+
+# Checks
+CHECK_MSG=$(shell ./check_tools.sh)
+ifneq ($(CHECK_MSG),)
+ $(error $(CHECK_MSG))
+endif
+include check_tools.mk
+
+OPENSSL_DIR=$(shell openssl version -d | sed "s/OPENSSLDIR: \"\(.*\)\"/\1/")
+ifneq ($(shell ls $(OPENSSL_DIR)/certs),)
+ HTTPS_CA_DIR=$(OPENSSL_DIR)/certs
+else
+ HTTPS_CA_DIR=$(OPENSSL_DIR)
+endif
-NDK_BUILD_OPTIONS=NDK_DEBUG=$(NDK_DEBUG) LINPHONE_VERSION=$(LINPHONE_VERSION) BUILD_UPNP=$(BUILD_UPNP) BUILD_REMOTE_PROVISIONING=$(BUILD_REMOTE_PROVISIONING) BUILD_X264=$(BUILD_X264) BUILD_AMRNB=$(BUILD_AMRNB) BUILD_AMRWB=$(BUILD_AMRWB) BUILD_GPLV3_ZRTP=$(BUILD_GPLV3_ZRTP) BUILD_SILK=$(BUILD_SILK) BUILD_G729=$(BUILD_G729) BUILD_TUNNEL=$(BUILD_TUNNEL) BUILD_WEBRTC_AECM=$(BUILD_WEBRTC_AECM) BUILD_FOR_X86=$(BUILD_FOR_X86) USE_JAVAH=$(USE_JAVAH) -j$(NUMCPUS)
all: update-project prepare-sources generate-apk
@@ -98,15 +113,49 @@ prepare-mediastreamer2:
if ! [ -e yuv2rgb.vs.h ]; then echo "yuv2rgb.vs.h creation error (do you have 'xxd' application installed ?)"; exit 1; fi && \
if ! [ -e yuv2rgb.fs.h ]; then echo "yuv2rgb.fs.h creation error (do you have 'xxd' application installed ?)"; exit 1; fi
-prepare-sources: prepare-ffmpeg prepare-ilbc prepare-vpx prepare-silk prepare-srtp prepare-zrtp prepare-mediastreamer2
+ANLTR3_SRC_DIR=$(TOPDIR)/submodules/externals/antlr3/runtime/C/include/
+ANTLR3_BUILD_DIR=$(ANTLR3_SRC_DIR)
+$(ANLTR3_SRC_DIR)/antlr3config.h: $(TOPDIR)/submodules/externals/build/antlr3/antlr3config.h
+ cp $(TOPDIR)/submodules/externals/build/antlr3/antlr3config.h $(ANLTR3_SRC_DIR)
+prepare-antlr3: $(ANLTR3_SRC_DIR)/antlr3config.h
-generate-libs:
- $(NDK_PATH)/ndk-build $(NDK_BUILD_OPTIONS)
+%.tokens: %.g
+ $(ANTLR) -make -fo $(dir $^) $^
+
+BELLESIP_SRC_DIR=$(TOPDIR)/submodules/belle-sip
+BELLESIP_BUILD_DIR=$(BELLESIP_SRC_DIR)
+prepare-belle-sip: $(BELLESIP_SRC_DIR)/src/belle_sip_message.tokens $(BELLESIP_SRC_DIR)/src/belle_sdp.tokens
+
+prepare-cunit: $(TOPDIR)/submodules/externals/cunit/CUnit/Headers/*.h
+ [ -d $(TOPDIR)/submodules/externals/build/cunit/CUnit ] || mkdir $(TOPDIR)/submodules/externals/build/cunit/CUnit
+ cp $^ $(TOPDIR)/submodules/externals/build/cunit/CUnit
+
+$(TOPDIR)/res/raw/rootca.pem:
+ HTTPS_CA_DIR=$(HTTPS_CA_DIR) $(TOPDIR)/submodules/linphone/scripts/mk-ca-bundle.pl $@
+
+prepare-liblinphone_tester: $(TOPDIR)/submodules/linphone/tester/*_lrc $(TOPDIR)/submodules/linphone/tester/*_rc $(TOPDIR)/submodules/linphone/tester/tester_hosts $(TOPDIR)/submodules/linphone/tester/certificates/* $(TOPDIR)/res/raw/rootca.pem
+ for file in $^; do \
+ cp -f $$file $(TOPDIR)/liblinphone_tester/res/raw/. \
+ ;done
+
+prepare-sources: prepare-ffmpeg prepare-ilbc prepare-vpx prepare-silk prepare-srtp prepare-mediastreamer2 prepare-antlr3 prepare-belle-sip $(TOPDIR)/res/raw/rootca.pem
+
+LIBLINPHONE_OPTIONS = NDK_DEBUG=$(NDK_DEBUG) LINPHONE_VERSION=$(LINPHONE_VERSION) BUILD_UPNP=$(BUILD_UPNP) BUILD_REMOTE_PROVISIONING=$(BUILD_REMOTE_PROVISIONING) BUILD_X264=$(BUILD_X264) BUILD_AMRNB=$(BUILD_AMRNB) BUILD_AMRWB=$(BUILD_AMRWB) BUILD_GPLV3_ZRTP=$(BUILD_GPLV3_ZRTP) BUILD_SILK=$(BUILD_SILK) BUILD_G729=$(BUILD_G729) BUILD_TUNNEL=$(BUILD_TUNNEL) BUILD_WEBRTC_AECM=$(BUILD_WEBRTC_AECM) BUILD_FOR_X86=$(BUILD_FOR_X86) USE_JAVAH=$(USE_JAVAH) BUILD_TLS=$(BUILD_TLS)
+
+generate-libs: prepare-sources javah
+ $(NDK_PATH)/ndk-build $(LIBLINPHONE_OPTIONS) -j$(NUMCPUS)
update-project:
$(SDK_PATH)/android update project --path . --target $(ANDROID_MOST_RECENT_TARGET)
+ $(SDK_PATH)/android update project --path liblinphone_tester --target $(ANDROID_MOST_RECENT_TARGET)
-generate-apk:
+liblinphone_tester: prepare-sources prepare-cunit prepare-liblinphone_tester javah
+ $(NDK_PATH)/ndk-build -C liblinphone_tester $(LIBLINPHONE_OPTIONS) -j$(NUMCPUS)
+
+javah:
+ ant javah
+
+generate-apk: generate-libs
ant partial-clean
echo "version.name=$(LINPHONE_ANDROID_DEBUG_VERSION)" > default.properties
ant debug
@@ -117,7 +166,7 @@ install-apk:
release: update-project
ant clean
echo "What is the version name for the release ?"; \
- read version; \
+ read version; \
echo "version.name=$$version" > default.properties
ant release
@@ -135,8 +184,11 @@ run-tests:
adb shell am instrument -w -e size small org.linphone.test/android.test.InstrumentationTestRunner
clean:
- $(NDK_PATH)/ndk-build $(NDK_BUILD_OPTIONS) clean
+ $(NDK_PATH)/ndk-build clean $(LIBLINPHONE_OPTIONS)
ant clean
.PHONY: clean
+generate-sdk: generate-apk
+ ant liblinphone-sdk
+
diff --git a/README b/README
index a655c6113..19a458a83 100644
--- a/README
+++ b/README
@@ -5,11 +5,15 @@ To build liblinphone for Android, you must:
0) download the Android sdk with platform-tools and tools updated to latest revision (at least API 16 is needed), then add both 'tools' and 'platform-tools' folders in your path.
1) download the Android ndk (>=r8b) from google and add it to your path.
2) install the autotools: autoconf, automake, aclocal, libtoolize, pkgconfig
-2bis) on some 64 bits systems you'll need the ia32-libs package
+ On 64 bits linux systems you'll need the ia32-libs package
3) run the Makefile script in the top level directory. This will download iLBC source files and convert some assembly files in VP8 project.
$ make
4) To install the generated apk into a plugged device, run
$ make install
+5) (Optional) To generate a liblinphone SDK zip containing a full jar and native libraries, run
+ $ make generate-sdk
+
+
To run the tutorials:
1) open the res/values/non_localizable_custom.xml file and change the value of the show_tutorials_instead_of_app to true.
diff --git a/build.xml b/build.xml
index cc1aeac67..2bab7486c 100644
--- a/build.xml
+++ b/build.xml
@@ -90,4 +90,21 @@
+
+ Creating library output jar file...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/check_tools.sh b/check_tools.sh
new file mode 100755
index 000000000..c0a553400
--- /dev/null
+++ b/check_tools.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+rm -f check_tools.mk
+touch check_tools.mk
+
+# Check java
+JAVA=\"$(which java)\"
+if [ -z ${JAVA} ]; then
+ echo "Could not find java. Please install java";
+ exit -1;
+fi
+
+# Check antlr
+ANTLR="${JAVA} -jar \"submodules/externals/antlr3/antlr-3.4-complete.jar\"";
+
+# Check NDK
+NDK=$(which ndk-build)
+if [ -z ${NDK} ]; then
+ echo "Could not find ndk-build. Please install android ndk";
+ exit -1;
+fi
+
+# Check SDK
+SDK=$(which android)
+if [ -z ${SDK} ]; then
+ echo "Could not find android. Please install android sdk";
+ exit -1;
+fi
+
+SDK_PLATFORM_TOOLS=$(which adb)
+if [ -z ${SDK_PLATFORM_TOOLS} ]; then
+ echo "Could not find adb. Please install android sdk platform tools";
+ exit -1;
+fi
+
+echo JAVA=${JAVA} >> check_tools.mk
+echo ANTLR=${ANTLR} >> check_tools.mk
diff --git a/custom_rules.xml b/custom_rules.xml
index 2e6e2dde5..4a1301776 100644
--- a/custom_rules.xml
+++ b/custom_rules.xml
@@ -17,7 +17,7 @@
failonerror="false" />
-
+
Generate JNI header
@@ -37,6 +37,11 @@
+
+
+
+
+
@@ -56,15 +61,6 @@
-
-
-
-
-
-
-
-
-
Generate Javadoc
+
+
+ Creating library output jar file...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jni/Android.mk b/jni/Android.mk
index 6390ab9c2..0902fb002 100755
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -41,12 +41,8 @@ ifeq ($(BUILD_UPNP),1)
include $(linphone-root-dir)/submodules/externals/build/libupnp/Android.mk
endif
-#libxml2 + xml2lpc + lpc2xml
-ifeq ($(BUILD_REMOTE_PROVISIONING),1)
+#libxml2
include $(linphone-root-dir)/submodules/externals/build/libxml2/Android.mk
-include $(linphone-root-dir)/submodules/linphone/build/android/xml2lpc.mk
-include $(linphone-root-dir)/submodules/linphone/build/android/lpc2xml.mk
-endif
# Speex
include $(linphone-root-dir)/submodules/externals/build/speex/Android.mk
@@ -54,12 +50,11 @@ include $(linphone-root-dir)/submodules/externals/build/speex/Android.mk
# Gsm
include $(linphone-root-dir)/submodules/externals/build/gsm/Android.mk
-include $(linphone-root-dir)/submodules/externals/build/exosip/Android.mk
+include $(linphone-root-dir)/submodules/externals/build/polarssl/Android.mk
+include $(linphone-root-dir)/submodules/externals/build/antlr3/Android.mk
+include $(linphone-root-dir)/submodules/belle-sip/build/android/Android.mk
-include $(linphone-root-dir)/submodules/externals/build/osip/Android.mk
-# Openssl
-include $(linphone-root-dir)/submodules/externals/openssl/Android.mk
include $(linphone-root-dir)/submodules/linphone/oRTP/build/android/Android.mk
@@ -68,6 +63,14 @@ include $(linphone-root-dir)/submodules/linphone/mediastreamer2/tools/Android.mk
ifeq ($(BUILD_TUNNEL), 1)
+# Openssl
+ifeq ($(wildcard $(linphone-root-dir)/submodules/externals/prebuilts/ssl.mk),)
+include $(linphone-root-dir)/submodules/externals/openssl/Android.mk
+else
+include $(linphone-root-dir)/submodules/externals/prebuilts/ssl.mk
+include $(linphone-root-dir)/submodules/externals/prebuilts/crypto.mk
+endif
+#tunnel
include $(linphone-root-dir)/submodules/tunnel/Android.mk
endif
diff --git a/jni/Application.mk b/jni/Application.mk
index a2c7ff6fb..82ee19380 100644
--- a/jni/Application.mk
+++ b/jni/Application.mk
@@ -1,5 +1,5 @@
APP_PROJECT_PATH := $(call my-dir)/../
-APP_MODULES :=libspeex libgsm libortp libosip2 libeXosip2 libmediastreamer2 liblinphone liblinphonenoneon libneon
+APP_MODULES :=libspeex libgsm libortp antlr3 libbellesip libmediastreamer2 liblinphone liblinphonenoneon libneon liblpxml2
APP_STL := stlport_static
#uPnp
@@ -7,9 +7,8 @@ ifeq ($(BUILD_UPNP),1)
APP_MODULES += libupnp
endif
-#remote provisioning
-ifeq ($(BUILD_REMOTE_PROVISIONING),1)
-APP_MODULES += liblpxml2 libxml2lpc liblpc2xml
+ifeq ($(BUILD_TLS),1)
+APP_MODULES +=polarssl
endif
#default values
@@ -72,7 +71,10 @@ APP_MODULES += libtunnelclient
endif
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
+ifeq ($(BUILD_TUNNEL), 1)
APP_MODULES += liblincrypto liblinssl
+endif
+
APP_MODULES +=libmsilbc
ifeq ($(BUILD_GPLV3_ZRTP), 1)
@@ -93,4 +95,3 @@ APP_ABI := armeabi-v7a armeabi
ifeq ($(BUILD_FOR_X86), 1)
APP_ABI += x86
endif
-APP_CFLAGS:=-DDISABLE_NEON
diff --git a/liblinphone_tester/.classpath b/liblinphone_tester/.classpath
new file mode 100644
index 000000000..d48ac0e1b
--- /dev/null
+++ b/liblinphone_tester/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/liblinphone_tester/.gitignore b/liblinphone_tester/.gitignore
new file mode 100644
index 000000000..00dfbd2c3
--- /dev/null
+++ b/liblinphone_tester/.gitignore
@@ -0,0 +1,18 @@
+# built application files
+*.apk
+*.ap_
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
+
+# generated files
+bin/
+gen/
+libs/
+obj/
+
+# Local configuration file (sdk path, etc)
+local.properties
diff --git a/liblinphone_tester/.project b/liblinphone_tester/.project
new file mode 100644
index 000000000..3b3e60d9e
--- /dev/null
+++ b/liblinphone_tester/.project
@@ -0,0 +1,40 @@
+
+
+ liblinphoneTester
+
+
+
+
+
+ com.android.ide.eclipse.adt.ResourceManagerBuilder
+
+
+
+
+ com.android.ide.eclipse.adt.PreCompilerBuilder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ com.android.ide.eclipse.adt.ApkBuilder
+
+
+
+
+
+ com.android.ide.eclipse.adt.AndroidNature
+ org.eclipse.jdt.core.javanature
+
+
+
+ mediastreamer2
+ 2
+ PARENT-1-PROJECT_LOCATION/submodules/linphone/mediastreamer2/java/src
+
+
+
diff --git a/liblinphone_tester/AndroidManifest.xml b/liblinphone_tester/AndroidManifest.xml
new file mode 100644
index 000000000..298566cbe
--- /dev/null
+++ b/liblinphone_tester/AndroidManifest.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/liblinphone_tester/ant.properties b/liblinphone_tester/ant.properties
new file mode 100644
index 000000000..c3a2c6428
--- /dev/null
+++ b/liblinphone_tester/ant.properties
@@ -0,0 +1 @@
+source.dir=src:../submodules/linphone/mediastreamer2/java/src:../submodules/linphone/java/j2se:../submodules/linphone/java/common:../submodules/linphone/java/impl
diff --git a/liblinphone_tester/build.xml b/liblinphone_tester/build.xml
new file mode 100644
index 000000000..4eb05f07c
--- /dev/null
+++ b/liblinphone_tester/build.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/liblinphone_tester/custom_rules.xml b/liblinphone_tester/custom_rules.xml
new file mode 100644
index 000000000..60e8727a9
--- /dev/null
+++ b/liblinphone_tester/custom_rules.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/liblinphone_tester/jni/Android.mk b/liblinphone_tester/jni/Android.mk
new file mode 100644
index 000000000..bacf8a993
--- /dev/null
+++ b/liblinphone_tester/jni/Android.mk
@@ -0,0 +1,3 @@
+include ../jni/Android.mk
+include $(linphone-root-dir)/submodules/externals/build/cunit/Android.mk
+include $(linphone-root-dir)/submodules/linphone/build/android/liblinphone_tester.mk
diff --git a/liblinphone_tester/jni/Application.mk b/liblinphone_tester/jni/Application.mk
new file mode 100644
index 000000000..1e824c4cd
--- /dev/null
+++ b/liblinphone_tester/jni/Application.mk
@@ -0,0 +1,7 @@
+LOCAL_PATH:= $(call my-dir)
+include ../jni/Application.mk
+APP_PROJECT_PATH := $(LOCAL_PATH)/../
+APP_BUILD_SCRIPT := $(LOCAL_PATH)/Android.mk
+APP_OPTIM := debug
+
+APP_MODULES += cunit liblinphone_tester liblinphone_testernoneon
diff --git a/tests/res/drawable-hdpi/ic_launcher.png b/liblinphone_tester/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from tests/res/drawable-hdpi/ic_launcher.png
rename to liblinphone_tester/res/drawable-hdpi/ic_launcher.png
diff --git a/tests/res/drawable-mdpi/ic_launcher.png b/liblinphone_tester/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from tests/res/drawable-mdpi/ic_launcher.png
rename to liblinphone_tester/res/drawable-mdpi/ic_launcher.png
diff --git a/tests/res/drawable-xhdpi/ic_launcher.png b/liblinphone_tester/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from tests/res/drawable-xhdpi/ic_launcher.png
rename to liblinphone_tester/res/drawable-xhdpi/ic_launcher.png
diff --git a/liblinphone_tester/res/layout/activity_logs.xml b/liblinphone_tester/res/layout/activity_logs.xml
new file mode 100644
index 000000000..353062eb8
--- /dev/null
+++ b/liblinphone_tester/res/layout/activity_logs.xml
@@ -0,0 +1,12 @@
+
+
+
\ No newline at end of file
diff --git a/liblinphone_tester/res/layout/activity_main.xml b/liblinphone_tester/res/layout/activity_main.xml
new file mode 100644
index 000000000..751318d94
--- /dev/null
+++ b/liblinphone_tester/res/layout/activity_main.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/liblinphone_tester/res/layout/activity_suites.xml b/liblinphone_tester/res/layout/activity_suites.xml
new file mode 100644
index 000000000..2c8294d5e
--- /dev/null
+++ b/liblinphone_tester/res/layout/activity_suites.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/liblinphone_tester/res/menu/activity_logs.xml b/liblinphone_tester/res/menu/activity_logs.xml
new file mode 100644
index 000000000..77f358b68
--- /dev/null
+++ b/liblinphone_tester/res/menu/activity_logs.xml
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/liblinphone_tester/res/menu/activity_main.xml b/liblinphone_tester/res/menu/activity_main.xml
new file mode 100644
index 000000000..77f358b68
--- /dev/null
+++ b/liblinphone_tester/res/menu/activity_main.xml
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/liblinphone_tester/res/menu/activity_suites.xml b/liblinphone_tester/res/menu/activity_suites.xml
new file mode 100644
index 000000000..77f358b68
--- /dev/null
+++ b/liblinphone_tester/res/menu/activity_suites.xml
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/liblinphone_tester/res/raw/.gitignore b/liblinphone_tester/res/raw/.gitignore
new file mode 100644
index 000000000..40abfa847
--- /dev/null
+++ b/liblinphone_tester/res/raw/.gitignore
@@ -0,0 +1,12 @@
+agent.pem
+cacert.pem
+empty_rc
+laure_rc
+marie_early_rc
+marie_no_sdp_rc
+marie_rc
+multi_account_lrc
+pauline_rc
+rootca.pem
+tester_hosts
+upnp_rc
diff --git a/liblinphone_tester/res/values-v11/styles.xml b/liblinphone_tester/res/values-v11/styles.xml
new file mode 100644
index 000000000..541752f6e
--- /dev/null
+++ b/liblinphone_tester/res/values-v11/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/liblinphone_tester/res/values-v14/styles.xml b/liblinphone_tester/res/values-v14/styles.xml
new file mode 100644
index 000000000..f20e01501
--- /dev/null
+++ b/liblinphone_tester/res/values-v14/styles.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/liblinphone_tester/res/values/strings.xml b/liblinphone_tester/res/values/strings.xml
new file mode 100644
index 000000000..941a872da
--- /dev/null
+++ b/liblinphone_tester/res/values/strings.xml
@@ -0,0 +1,10 @@
+
+
+
+ liblinphone tester
+ All
+ Settings
+ LogsActivity
+ SuitesActivity
+
+
\ No newline at end of file
diff --git a/liblinphone_tester/res/values/styles.xml b/liblinphone_tester/res/values/styles.xml
new file mode 100644
index 000000000..4a10ca492
--- /dev/null
+++ b/liblinphone_tester/res/values/styles.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/liblinphone_tester/src/org/linphone/tester/LogsActivity.java b/liblinphone_tester/src/org/linphone/tester/LogsActivity.java
new file mode 100644
index 000000000..af5c75427
--- /dev/null
+++ b/liblinphone_tester/src/org/linphone/tester/LogsActivity.java
@@ -0,0 +1,91 @@
+package org.linphone.tester;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import android.os.Bundle;
+import android.app.Activity;
+import android.view.Menu;
+import android.widget.TextView;
+
+public class LogsActivity extends Activity {
+ private String mLogs = "";
+ private LogsThread mLogsThread;
+ private class LogsThread extends Thread {
+ LogsActivity mLogsActivity;
+ String mArgs[];
+ TesterLogger tester;
+ public LogsThread(LogsActivity logsActivity, String[] args) {
+ mLogsActivity = logsActivity;
+ mArgs = args;
+ }
+
+ @Override
+ public void run() {
+ String path = mLogsActivity.getFilesDir().getAbsolutePath();
+ tester = new TesterLogger(mLogsActivity);
+ List list = new LinkedList(Arrays.asList(new String[]{"tester", "--verbose", "--config", path}));
+ list.addAll(Arrays.asList(mArgs));
+ String[] array = list.toArray(new String[list.size()]);
+ tester.run(array);
+ mLogsActivity.runOnUiThread(new Runnable() {
+ public void run() {
+ mLogsActivity.done();
+ }
+ });
+ }
+ }
+
+ private static String join(String [] array, String separator) {
+ String ret = "";
+ for(int i = 0; i < array.length; ++i) {
+ if(i != 0) {
+ ret += separator;
+ }
+ ret += array[i];
+ }
+ return ret;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_logs);
+ ((TextView)findViewById(R.id.textView1)).setText(mLogs);
+ Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+ String[] values = extras.getStringArray("args");
+ if(values != null) {
+ if(mLogsThread == null || !mLogsThread.isAlive()) {
+ this.setTitle("Test Logs (" + join(values, " ") + ")");
+ mLogs = "";
+ ((TextView)findViewById(R.id.textView1)).setText(mLogs);
+ mLogsThread = new LogsThread(this, values);
+ mLogsThread.start();
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.activity_logs, menu);
+ return true;
+ }
+
+ public void addLog(int level, String message) {
+ mLogs += message;
+ ((TextView)findViewById(R.id.textView1)).append(message);
+ }
+ @Override
+ public void onBackPressed() {
+ if(mLogsThread == null || !mLogsThread.isAlive()) {
+ finish();
+ }
+ }
+
+ public void done() {
+ }
+}
diff --git a/liblinphone_tester/src/org/linphone/tester/MainActivity.java b/liblinphone_tester/src/org/linphone/tester/MainActivity.java
new file mode 100644
index 000000000..9d15fecd9
--- /dev/null
+++ b/liblinphone_tester/src/org/linphone/tester/MainActivity.java
@@ -0,0 +1,89 @@
+package org.linphone.tester;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import android.os.Bundle;
+import android.app.Activity;
+import android.content.Intent;
+import android.view.Gravity;
+import android.view.Menu;
+import android.view.View;
+import android.widget.Button;
+import android.widget.LinearLayout;
+
+public class MainActivity extends Activity {
+
+ private void copyFromPackage(int ressourceId,String target) throws IOException{
+ FileOutputStream lOutputStream = openFileOutput (target, 0);
+ InputStream lInputStream = getResources().openRawResource(ressourceId);
+ int readByte;
+ byte[] buff = new byte[8048];
+ while (( readByte = lInputStream.read(buff)) != -1) {
+ lOutputStream.write(buff,0, readByte);
+ }
+ lOutputStream.flush();
+ lOutputStream.close();
+ lInputStream.close();
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ try {
+ copyFromPackage(R.raw.laure_rc, new File("laure_rc").getName());
+ copyFromPackage(R.raw.marie_rc, new File("marie_rc").getName());
+ copyFromPackage(R.raw.marie_early_rc, new File("marie_early_rc").getName());
+ copyFromPackage(R.raw.multi_account_lrc, new File("multi_account_lrc").getName());
+ copyFromPackage(R.raw.pauline_rc, new File("pauline_rc").getName());
+ copyFromPackage(R.raw.rootca, new File("rootca.pem").getName());
+ copyFromPackage(R.raw.cacert, new File("cacert.pem").getName());
+ copyFromPackage(R.raw.tester_hosts, new File("tester_hosts").getName());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ setContentView(R.layout.activity_main);
+
+ TesterList suitesTest = new TesterList();
+ suitesTest.run(new String[]{"tester", "--list-suites"});
+ LinearLayout layout = ((LinearLayout)findViewById(R.id.suites_list));
+ layout.removeAllViews();
+ addButton(layout, "All", null);
+ for(String str: suitesTest.getList()) {
+ str = str.trim();
+ addButton(layout, str, str);
+ }
+ }
+ private void addButton(LinearLayout layout, String text, String data) {
+ Button button = new Button(this);
+ button.setText(text);
+ button.setTag(data);
+ button.setGravity(Gravity.CENTER);
+ button.setOnClickListener(new Button.OnClickListener() {
+ public void onClick(View v) {
+ Button button = (Button) v;
+ String data = (String)button.getTag();
+ if(data == null) {
+ Intent intent = new Intent(getBaseContext(), LogsActivity.class);
+ intent.putExtra("args", new String[]{});
+ startActivity(intent);
+ } else {
+ Intent intent = new Intent(getBaseContext(), SuitesActivity.class);
+ intent.putExtra("suite", data);
+ startActivity(intent);
+ }
+ }
+ });
+ layout.addView(button);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.activity_main, menu);
+ return true;
+ }
+}
diff --git a/liblinphone_tester/src/org/linphone/tester/SuitesActivity.java b/liblinphone_tester/src/org/linphone/tester/SuitesActivity.java
new file mode 100644
index 000000000..ffaa91bd7
--- /dev/null
+++ b/liblinphone_tester/src/org/linphone/tester/SuitesActivity.java
@@ -0,0 +1,70 @@
+package org.linphone.tester;
+
+import android.os.Bundle;
+import android.app.Activity;
+import android.content.Intent;
+import android.view.Gravity;
+import android.view.Menu;
+import android.view.View;
+import android.widget.Button;
+import android.widget.LinearLayout;
+
+public class SuitesActivity extends Activity {
+ String mSuite;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_suites);
+ Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+ mSuite = extras.getString("suite");
+ if(mSuite != null) {
+ this.setTitle(this.getResources().getString(R.string.app_name) + " | " + mSuite);
+ TesterList suitesTest = new TesterList();
+ suitesTest.run(new String[]{"tester", "--list-tests", mSuite});
+ LinearLayout layout = ((LinearLayout)findViewById(R.id.tests_list));
+ layout.removeAllViews();
+ addButton(layout, "All", null);
+ for(String str: suitesTest.getList()) {
+ str = str.trim();
+ addButton(layout, str, str);
+ }
+ }
+ }
+
+ }
+ private void addButton(LinearLayout layout, String text, String data) {
+ Button button = new Button(this);
+ button.setText(text);
+ button.setTag(data);
+ button.setGravity(Gravity.CENTER);
+ button.setOnClickListener(new Button.OnClickListener() {
+ public void onClick(View v) {
+ Button button = (Button) v;
+ String data = (String)button.getTag();
+ if(mSuite != null) {
+ if(data == null) {
+ Intent intent = new Intent(getBaseContext(), LogsActivity.class);
+ intent.putExtra("args", new String[]{"--suite", mSuite});
+ startActivity(intent);
+ } else {
+ Intent intent = new Intent(getBaseContext(), LogsActivity.class);
+ intent.putExtra("args", new String[]{"--suite", mSuite, "--test", data});
+ startActivity(intent);
+ }
+ }
+ }
+ });
+ layout.addView(button);
+ }
+
+
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.activity_suites, menu);
+ return true;
+ }
+
+}
diff --git a/liblinphone_tester/src/org/linphone/tester/TestRunner.java b/liblinphone_tester/src/org/linphone/tester/TestRunner.java
new file mode 100644
index 000000000..cfa36f636
--- /dev/null
+++ b/liblinphone_tester/src/org/linphone/tester/TestRunner.java
@@ -0,0 +1,47 @@
+package org.linphone.tester;
+
+import junit.framework.TestSuite;
+import android.os.Bundle;
+import android.test.InstrumentationTestRunner;
+
+
+public class TestRunner extends InstrumentationTestRunner {
+ String mSuite = null;
+ String mTest = null;
+
+ @Override
+ public void onCreate(Bundle arguments) {
+ mSuite = arguments.getString("suite");
+ mTest = arguments.getString("test");
+ super.onCreate(arguments);
+ }
+
+ @Override
+ public TestSuite getAllTests () {
+ TestSuite suite = new TestSuite("Tests");
+ addSuites(suite, mSuite, mTest);
+ return suite;
+ }
+
+ public static void addSuites(TestSuite suite, String suiteCheck, String testCheck) {
+ TesterList testerList = new TesterList();
+ testerList.run(new String[]{"tester", "--list-suites"});
+ for(String str: testerList.getList()) {
+ str = str.trim();
+ if(suiteCheck == null || suiteCheck.equals(str)) {
+ addSuite(suite, str, testCheck);
+ }
+ }
+ }
+
+ public static void addSuite(TestSuite suite, String suiteStr, String testCheck) {
+ TesterList testerList = new TesterList();
+ testerList.run(new String[]{"tester", "--list-tests", suiteStr});
+ for(String str: testerList.getList()) {
+ str = str.trim();
+ if(testCheck == null || testCheck.equals(str)) {
+ suite.addTest(new TestUnit(suiteStr, str));
+ }
+ }
+ }
+}
diff --git a/liblinphone_tester/src/org/linphone/tester/TestUnit.java b/liblinphone_tester/src/org/linphone/tester/TestUnit.java
new file mode 100644
index 000000000..46e959c89
--- /dev/null
+++ b/liblinphone_tester/src/org/linphone/tester/TestUnit.java
@@ -0,0 +1,38 @@
+package org.linphone.tester;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import junit.framework.Assert;
+import android.test.AndroidTestCase;
+
+public class TestUnit extends AndroidTestCase {
+ private String mSuite;
+ private String mTest;
+
+ public TestUnit(String suite, String test) {
+ mSuite = suite;
+ mTest = test;
+ setName(suite + "/" + test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Override
+ protected void runTest() {
+ String path = getContext().getFilesDir().getAbsolutePath();
+ Tester tester = new Tester();
+ List list = new LinkedList(Arrays.asList(new String[]{"tester", "--verbose", "--config", path, "--suite", mSuite, "--test", mTest}));
+ String[] array = list.toArray(new String[list.size()]);
+ Assert.assertTrue(tester.run(array) == 0);
+ }
+}
\ No newline at end of file
diff --git a/liblinphone_tester/src/org/linphone/tester/Tester.java b/liblinphone_tester/src/org/linphone/tester/Tester.java
new file mode 100644
index 000000000..7f2a925c2
--- /dev/null
+++ b/liblinphone_tester/src/org/linphone/tester/Tester.java
@@ -0,0 +1,69 @@
+package org.linphone.tester;
+
+import org.linphone.core.LinphoneCoreFactory;
+
+import org.linphone.mediastream.Version;
+import org.linphone.mediastream.CpuUtils;
+
+import android.util.Log;
+
+public class Tester {
+ public static String TAG = "liblinphone-tester";
+ private static boolean loadOptionalLibrary(String s) {
+ try {
+ System.loadLibrary(s);
+ return true;
+ } catch (Throwable e) {
+ Log.w("Unable to load optional library lib", s);
+ }
+ return false;
+ }
+
+ public static boolean hasNeonInCpuFeatures()
+ {
+ CpuUtils cpu = new CpuUtils();
+ return cpu.isCpuNeon();
+ }
+
+ public static boolean isArmv7()
+ {
+ return System.getProperty("os.arch").contains("armv7");
+ }
+
+ static {
+ LinphoneCoreFactory.instance();
+
+ System.loadLibrary("cunit");
+
+ //Main library
+ if (!hasNeonInCpuFeatures()) {
+ try {
+ if (!isArmv7() && !Version.isX86()) {
+ System.loadLibrary("linphone_testerarmv5");
+ } else {
+ System.loadLibrary("linphone_testernoneon");
+ }
+ } catch (UnsatisfiedLinkError ule) {
+ Log.w("linphone", "Failed to load no-neon liblinphone_tester, loading neon liblinphone_tester");
+ System.loadLibrary("linphone_tester");
+ }
+ } else {
+ System.loadLibrary("linphone_tester");
+ }
+
+ Version.dumpCapabilities();
+ }
+
+ public native int run(String args[]);
+
+ public void printLog(final int level, final String message) {
+ switch(level) {
+ case 0:
+ android.util.Log.i(TAG, message);
+ break;
+ case 1:
+ android.util.Log.e(TAG, message);
+ break;
+ }
+ }
+}
diff --git a/liblinphone_tester/src/org/linphone/tester/TesterList.java b/liblinphone_tester/src/org/linphone/tester/TesterList.java
new file mode 100644
index 000000000..4dceb606b
--- /dev/null
+++ b/liblinphone_tester/src/org/linphone/tester/TesterList.java
@@ -0,0 +1,16 @@
+package org.linphone.tester;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class TesterList extends Tester {
+ private List list = new LinkedList();
+ public void printLog(final int level, final String message) {
+ super.printLog(level, message);
+ list.add(message);
+ }
+
+ public List getList() {
+ return list;
+ }
+}
diff --git a/liblinphone_tester/src/org/linphone/tester/TesterLogger.java b/liblinphone_tester/src/org/linphone/tester/TesterLogger.java
new file mode 100644
index 000000000..516763589
--- /dev/null
+++ b/liblinphone_tester/src/org/linphone/tester/TesterLogger.java
@@ -0,0 +1,16 @@
+package org.linphone.tester;
+
+public class TesterLogger extends Tester {
+ private LogsActivity mLogsActivity;
+ TesterLogger(LogsActivity logsActivity) {
+ mLogsActivity = logsActivity;
+ }
+ public void printLog(final int level, final String message) {
+ super.printLog(level, message);
+ mLogsActivity.runOnUiThread(new Runnable() {
+ public void run() {
+ mLogsActivity.addLog(level, message);
+ }
+ });
+ }
+}
diff --git a/res/layout/contact_control_row.xml b/res/layout/contact_control_row.xml
index 129777574..9dde0eef3 100644
--- a/res/layout/contact_control_row.xml
+++ b/res/layout/contact_control_row.xml
@@ -34,7 +34,7 @@
android:src="@drawable/call_answer" />
false
false
- false
+ true
false
true
diff --git a/res/values/non_localizable_defaults.xml b/res/values/non_localizable_defaults.xml
index 271048727..0e606d8ec 100644
--- a/res/values/non_localizable_defaults.xml
+++ b/res/values/non_localizable_defaults.xml
@@ -37,6 +37,7 @@
false
stun.linphone.org
false
+ false
true
5060
@string/pref_transport_udp_key
diff --git a/res/values/non_localizable_strings.xml b/res/values/non_localizable_strings.xml
index cf20690e0..9391b5e81 100644
--- a/res/values/non_localizable_strings.xml
+++ b/res/values/non_localizable_strings.xml
@@ -49,6 +49,7 @@
pref_domain_key
pref_passwd_key
pref_username_key
+ pref_auth_userid_key
pref_wizard_key
pref_activated_key
pref_debug_key
@@ -112,4 +113,5 @@
pref_rfc2833_dtmf_key
pref_sipinfo_dtmf_key
+ pref_upnp_enable_key
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 74c9b9f7a..bd11295fe 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -418,5 +418,11 @@
Background mode
Download
- Download failed. Check your internet connection or try again later.
+ Download failed. Please check your internet access or try again later.
+
+ Auth userid*
+
+ Enter authentication userid (optionnal)
+
+ Enable UPNP
diff --git a/res/xml/account_preferences.xml b/res/xml/account_preferences.xml
index 2c23bfeb1..7fff9fedd 100644
--- a/res/xml/account_preferences.xml
+++ b/res/xml/account_preferences.xml
@@ -7,6 +7,9 @@
+
+
messages = LinphoneActivity.instance().getChatMessages(contact);
diff --git a/src/org/linphone/ContactFragment.java b/src/org/linphone/ContactFragment.java
index a8d341709..7d86cd1af 100644
--- a/src/org/linphone/ContactFragment.java
+++ b/src/org/linphone/ContactFragment.java
@@ -115,7 +115,7 @@ public class ContactFragment extends Fragment implements OnClickListener {
v.findViewById(R.id.dial).setVisibility(View.GONE);
}
- v.findViewById(R.id.chat).setOnClickListener(chatListener);
+ v.findViewById(R.id.start_chat).setOnClickListener(chatListener);
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
if (lpc != null) {
if (!displayednumberOrAddress.startsWith("sip:")) {
@@ -126,9 +126,9 @@ public class ContactFragment extends Fragment implements OnClickListener {
if (!numberOrAddress.contains("@")) {
tag = numberOrAddress + "@" + lpc.getDomain();
}
- v.findViewById(R.id.chat).setTag(tag);
+ v.findViewById(R.id.start_chat).setTag(tag);
} else {
- v.findViewById(R.id.chat).setTag(numberOrAddress);
+ v.findViewById(R.id.start_chat).setTag(numberOrAddress);
}
final String finalNumberOrAddress = numberOrAddress;
@@ -161,7 +161,7 @@ public class ContactFragment extends Fragment implements OnClickListener {
}
if (getResources().getBoolean(R.bool.disable_chat)) {
- v.findViewById(R.id.chat).setVisibility(View.GONE);
+ v.findViewById(R.id.start_chat).setVisibility(View.GONE);
}
controls.addView(v);
diff --git a/src/org/linphone/HistoryDetailFragment.java b/src/org/linphone/HistoryDetailFragment.java
index 8c0d42fbc..ebbfbe432 100644
--- a/src/org/linphone/HistoryDetailFragment.java
+++ b/src/org/linphone/HistoryDetailFragment.java
@@ -21,6 +21,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import org.linphone.core.LinphoneAddress;
+import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import android.annotation.SuppressLint;
@@ -104,11 +105,16 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
time.setText(callTime == null ? "" : callTime);
date.setText(timestampToHumanDate(callDate));
- LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
- LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, view.getContext().getContentResolver());
- String displayName = lAddress.getDisplayName();
- if (displayName != null) {
- view.findViewById(R.id.addContactRow).setVisibility(View.GONE);
+ LinphoneAddress lAddress;
+ try {
+ lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
+ LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, view.getContext().getContentResolver());
+ String displayName = lAddress.getDisplayName();
+ if (displayName != null) {
+ view.findViewById(R.id.addContactRow).setVisibility(View.GONE);
+ }
+ } catch (LinphoneCoreException e) {
+ e.printStackTrace();
}
}
diff --git a/src/org/linphone/InCallActivity.java b/src/org/linphone/InCallActivity.java
index af06903fe..d419f3288 100644
--- a/src/org/linphone/InCallActivity.java
+++ b/src/org/linphone/InCallActivity.java
@@ -1274,10 +1274,17 @@ public class InCallActivity extends FragmentActivity implements
private void displayCall(Resources resources, LinphoneCall call, int index) {
String sipUri = call.getRemoteAddress().asStringUriOnly();
- LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
+ LinphoneAddress lAddress;
+ try {
+ lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
+ } catch (LinphoneCoreException e) {
+ Log.e("Incall activity cannot parse remote address",e);
+ lAddress= LinphoneCoreFactory.instance().createLinphoneAddress("uknown","unknown","unkonown");
+ }
// Control Row
LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.active_call_control_row, container, false);
+ callView.setId(index+1);
setContactName(callView, lAddress, sipUri, resources);
displayCallStatusIconAndReturnCallPaused(callView, call);
setRowBackground(callView, index);
diff --git a/src/org/linphone/KeepAliveHandler.java b/src/org/linphone/KeepAliveHandler.java
new file mode 100644
index 000000000..bc34b284d
--- /dev/null
+++ b/src/org/linphone/KeepAliveHandler.java
@@ -0,0 +1,46 @@
+package org.linphone;
+/*
+KeepAliveHandler.java
+Copyright (C) 2013 Belledonne Communications, Grenoble, France
+
+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 2
+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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+import org.linphone.mediastream.Log;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+public class KeepAliveHandler extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.i("Keep alive handler invoked");
+ if (LinphoneManager.getLcIfManagerNotDestroyedOrNull()!=null) {
+ //first refresh registers
+ LinphoneManager.getLc().refreshRegisters();
+ //make sure iterate will have enough time, device will not sleep until exit from this method
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ Log.e("Cannot sleep for 10s", e);
+ }
+
+ }
+
+ }
+
+}
diff --git a/src/org/linphone/KeepAliveReceiver.java b/src/org/linphone/KeepAliveReceiver.java
index ed5c9b980..321953df1 100644
--- a/src/org/linphone/KeepAliveReceiver.java
+++ b/src/org/linphone/KeepAliveReceiver.java
@@ -25,7 +25,9 @@ import android.content.Context;
import android.content.Intent;
-
+/*
+ * Purpose of this receiver is to disable keep alives when screen is off
+ * */
public class KeepAliveReceiver extends BroadcastReceiver {
@Override
diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java
index 27943b98d..9d94401b5 100644
--- a/src/org/linphone/LinphoneActivity.java
+++ b/src/org/linphone/LinphoneActivity.java
@@ -430,7 +430,13 @@ public class LinphoneActivity extends FragmentActivity implements
}
public void displayHistoryDetail(String sipUri, LinphoneCallLog log) {
- LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
+ LinphoneAddress lAddress;
+ try {
+ lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
+ } catch (LinphoneCoreException e) {
+ Log.e("Cannot display history details",e);
+ return;
+ }
Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, getContentResolver());
String displayName = lAddress.getDisplayName();
@@ -517,7 +523,13 @@ public class LinphoneActivity extends FragmentActivity implements
return;
}
- LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
+ LinphoneAddress lAddress;
+ try {
+ lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
+ } catch (LinphoneCoreException e) {
+ Log.e("Cannot display chat",e);
+ return;
+ }
Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, getContentResolver());
String displayName = lAddress.getDisplayName();
String pictureUri = uri == null ? null : uri.toString();
@@ -1428,9 +1440,10 @@ public class LinphoneActivity extends FragmentActivity implements
return view;
}
}
+
}
interface ContactPicked {
void setAddresGoToDialerAndCall(String number, String name, Uri photo);
void goToDialer();
-}
\ No newline at end of file
+}
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index 393b659db..54b397d23 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -59,6 +59,7 @@ import org.linphone.core.LinphoneCallParams;
import org.linphone.core.LinphoneCallStats;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom;
+import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.FirewallPolicy;
@@ -69,9 +70,12 @@ import org.linphone.core.LinphoneCore.Transports;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
+import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend;
+import org.linphone.core.LinphoneInfoMessage;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.PayloadType;
+import org.linphone.core.SubscriptionState;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
import org.linphone.mediastream.video.capture.AndroidVideoApi5JniWrapper;
@@ -696,10 +700,15 @@ public class LinphoneManager implements LinphoneCoreListener {
private void initAccount(String key, boolean defaultAccount) throws LinphoneCoreException {
String username = getPrefString(getString(R.string.pref_username_key) + key, null);
+ String userid = getPrefString(getString(R.string.pref_auth_userid_key) + key, null);
String password = getPrefString(getString(R.string.pref_passwd_key) + key, null);
String domain = getPrefString(getString(R.string.pref_domain_key) + key, null);
if (username != null && username.length() > 0 && password != null) {
- LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(username, password, null);
+ LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(username
+ , userid
+ , password
+ , null
+ ,null);
mLc.addAuthInfo(lAuthInfo);
if (domain != null && domain.length() > 0) {
@@ -866,11 +875,16 @@ public class LinphoneManager implements LinphoneCoreListener {
//stun server
String lStun = getPrefString(R.string.pref_stun_server_key, getString(R.string.default_stun));
boolean useICE = getPrefBoolean(R.string.pref_ice_enable_key, mR.getBoolean(R.bool.pref_ice_enabled_default));
- //boolean useUpnp = getPrefBoolean(R.string.pref_upnp_enable_key, mR.getBoolean(R.bool.pref_upnp_enabled_default));
+ boolean useUpnp = getPrefBoolean(R.string.pref_upnp_enable_key, mR.getBoolean(R.bool.pref_upnp_enabled_default));
mLc.setStunServer(lStun);
- if (lStun!=null && lStun.length()>0) {
- mLc.setFirewallPolicy(useICE ? FirewallPolicy.UseIce : FirewallPolicy.UseStun);
+ if (lStun!=null && lStun.length()>0 && useICE) {
+ mLc.setFirewallPolicy(FirewallPolicy.UseIce);
+ if (useUpnp) Log.e("Cannot have both ice and upnp enabled, disabling upnp");
+ } else if (useUpnp) {
+ mLc.setFirewallPolicy(FirewallPolicy.UseUpnp);
+ } else if (lStun!=null && lStun.length()>0){
+ mLc.setFirewallPolicy(FirewallPolicy.UseStun);
} else {
mLc.setFirewallPolicy(FirewallPolicy.NoFirewall);
}
@@ -1736,4 +1750,28 @@ public class LinphoneManager implements LinphoneCoreListener {
public void notifyReceived(LinphoneCore lc, LinphoneCall call,
LinphoneAddress from, byte[] event) {
}
+ @Override
+ public void transferState(LinphoneCore lc, LinphoneCall call,
+ State new_call_state) {
+
+ }
+ @Override
+ public void infoReceived(LinphoneCore lc, LinphoneCall call, LinphoneInfoMessage info) {
+ Log.d("Info message received from "+call.getRemoteAddress().asString());
+ LinphoneContent ct=info.getContent();
+ if (ct!=null){
+ Log.d("Info received with body with mime type "+ct.getType()+"/"+ct.getSubtype()+" and data ["+ct.getDataAsString()+"]");
+ }
+ }
+ @Override
+ public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
+ SubscriptionState state) {
+ Log.d("Subscription state changed to "+state+" event name is "+ev.getEventName());
+ }
+ @Override
+ public void notifyReceived(LinphoneCore lc, LinphoneEvent ev,
+ String eventName, LinphoneContent content) {
+ Log.d("Notify received for event "+eventName);
+ if (content!=null) Log.d("with content "+content.getType()+"/"+content.getSubtype()+" data:"+content.getDataAsString());
+ }
}
diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java
index e1a151f44..cee623128 100644
--- a/src/org/linphone/LinphoneService.java
+++ b/src/org/linphone/LinphoneService.java
@@ -40,6 +40,7 @@ import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
import android.app.Activity;
+import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -58,6 +59,7 @@ import android.net.wifi.WifiManager.WifiLock;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
+import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
@@ -112,6 +114,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
private Notification mCustomNotif;
private int mMsgNotifCount;
private PendingIntent mNotifContentIntent;
+ private PendingIntent mkeepAlivePendingIntent;
private String mNotificationTitle;
@@ -198,6 +201,13 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
}
LinphoneManager.getLc().setPresenceInfo(0, "", OnlineStatus.Online);
+ //make sure the application will at least wakes up every 10 mn
+ Intent intent = new Intent(this, KeepAliveHandler.class);
+ mkeepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
+ ((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP
+ , SystemClock.elapsedRealtime()+600000
+ , 600000
+ , mkeepAlivePendingIntent);
}
private enum IncallIconState {INCALL, PAUSE, VIDEO, IDLE}
@@ -237,7 +247,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
String userName = call.getRemoteAddress().getUserName();
String domain = call.getRemoteAddress().getDomain();
String displayName = call.getRemoteAddress().getDisplayName();
- LinphoneAddress address = LinphoneCoreFactoryImpl.instance().createLinphoneAddress("sip:" + userName + "@" + domain);
+ LinphoneAddress address = LinphoneCoreFactoryImpl.instance().createLinphoneAddress(userName,domain,null);
address.setDisplayName(displayName);
Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(address, getContentResolver());
@@ -313,7 +323,13 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
mMsgNotifCount++;
}
- Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(LinphoneCoreFactoryImpl.instance().createLinphoneAddress(fromSipUri), getContentResolver());
+ Uri pictureUri;
+ try {
+ pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(LinphoneCoreFactoryImpl.instance().createLinphoneAddress(fromSipUri), getContentResolver());
+ } catch (LinphoneCoreException e1) {
+ Log.e("Cannot parse from address",e1);
+ pictureUri=null;
+ }
Bitmap bm = null;
try {
bm = MediaStore.Images.Media.getBitmap(getContentResolver(), pictureUri);
@@ -474,6 +490,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
mNM.cancel(INCALL_NOTIF_ID);
mNM.cancel(MESSAGE_NOTIF_ID);
mWifiLock.release();
+ ((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).cancel(mkeepAlivePendingIntent);
super.onDestroy();
}
diff --git a/src/org/linphone/LinphoneUtils.java b/src/org/linphone/LinphoneUtils.java
index 321285430..ad848b22e 100644
--- a/src/org/linphone/LinphoneUtils.java
+++ b/src/org/linphone/LinphoneUtils.java
@@ -36,6 +36,7 @@ import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCore;
+import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
@@ -73,7 +74,12 @@ public final class LinphoneUtils {
//private static final String strictSipAddressRegExp = "^sip:(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$";
public static boolean isSipAddress(String numberOrAddress) {
- return LinphoneCoreFactory.instance().createLinphoneAddress(numberOrAddress) != null;
+ try {
+ LinphoneCoreFactory.instance().createLinphoneAddress(numberOrAddress);
+ return true;
+ } catch (LinphoneCoreException e) {
+ return false;
+ }
}
public static boolean isStrictSipAddress(String numberOrAddress) {
diff --git a/src/org/linphone/PreferencesFragment.java b/src/org/linphone/PreferencesFragment.java
index d2ad9f4f9..c10e3e902 100644
--- a/src/org/linphone/PreferencesFragment.java
+++ b/src/org/linphone/PreferencesFragment.java
@@ -236,6 +236,30 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
}
});
+ final CheckBoxPreference useIce = (CheckBoxPreference) findPreference(R.string.pref_ice_enable_key);
+ final CheckBoxPreference useUpnp = (CheckBoxPreference) findPreference(R.string.pref_upnp_enable_key);
+
+ useIce.setEnabled(!useUpnp.isChecked());
+ LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
+ useUpnp.setEnabled(lc.upnpAvailable() && !useIce.isChecked());
+
+ useIce.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ boolean isChecked = (Boolean) newValue;
+ useUpnp.setEnabled(!isChecked);
+ return true;
+ }
+ });
+ useUpnp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ boolean isChecked = (Boolean) newValue;
+ useIce.setEnabled(!isChecked);
+ return true;
+ }
+ });
+
if (getResources().getBoolean(R.bool.disable_every_log)) {
uncheckDisableAndHideCheckbox(R.string.pref_debug_key);
}
diff --git a/src/org/linphone/setup/WizardFragment.java b/src/org/linphone/setup/WizardFragment.java
index 15c8ee055..9f30ebb52 100644
--- a/src/org/linphone/setup/WizardFragment.java
+++ b/src/org/linphone/setup/WizardFragment.java
@@ -59,8 +59,7 @@ public class WizardFragment extends Fragment {
private TextView errorMessage;
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.setup_wizard, container, false);
username = (EditText) view.findViewById(R.id.setup_username);
diff --git a/src/org/linphone/ui/AddressText.java b/src/org/linphone/ui/AddressText.java
index f0fef5bd6..3b6677578 100644
--- a/src/org/linphone/ui/AddressText.java
+++ b/src/org/linphone/ui/AddressText.java
@@ -56,7 +56,7 @@ public class AddressText extends EditText implements AddressType {
}
public void clearDisplayedName() {
- displayedName = "";
+ displayedName = null;
}
public String getDisplayedName() {
diff --git a/submodules/belle-sip b/submodules/belle-sip
new file mode 160000
index 000000000..86e813107
--- /dev/null
+++ b/submodules/belle-sip
@@ -0,0 +1 @@
+Subproject commit 86e813107462b5df4e1eefc09b161bd31c0cd928
diff --git a/submodules/externals/antlr3 b/submodules/externals/antlr3
new file mode 160000
index 000000000..9ea1af70b
--- /dev/null
+++ b/submodules/externals/antlr3
@@ -0,0 +1 @@
+Subproject commit 9ea1af70be642604d53e0e1f6096b9ca1ddae8a5
diff --git a/submodules/externals/build/antlr3/Android.mk b/submodules/externals/build/antlr3/Android.mk
new file mode 100644
index 000000000..73f0e2594
--- /dev/null
+++ b/submodules/externals/build/antlr3/Android.mk
@@ -0,0 +1,36 @@
+
+LOCAL_PATH:= $(call my-dir)/../../antlr3/runtime/C/src
+include $(CLEAR_VARS)
+
+LOCAL_MODULE:= antlr3
+
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/../../../../externals/antlr3 \
+ $(LOCAL_PATH)/../include
+LOCAL_SRC_FILES := \
+ antlr3baserecognizer.c \
+ antlr3basetree.c \
+ antlr3basetreeadaptor.c \
+ antlr3bitset.c \
+ antlr3collections.c \
+ antlr3commontoken.c \
+ antlr3commontree.c \
+ antlr3commontreeadaptor.c \
+ antlr3commontreenodestream.c \
+ antlr3convertutf.c \
+ antlr3cyclicdfa.c \
+ antlr3debughandlers.c \
+ antlr3encodings.c \
+ antlr3exception.c \
+ antlr3filestream.c \
+ antlr3inputstream.c \
+ antlr3intstream.c \
+ antlr3lexer.c \
+ antlr3parser.c \
+ antlr3rewritestreams.c \
+ antlr3string.c \
+ antlr3tokenstream.c \
+ antlr3treeparser.c \
+
+include $(BUILD_STATIC_LIBRARY)
+
diff --git a/submodules/externals/build/antlr3/antlr3config.h b/submodules/externals/build/antlr3/antlr3config.h
new file mode 100644
index 000000000..4b39e1ca5
--- /dev/null
+++ b/submodules/externals/build/antlr3/antlr3config.h
@@ -0,0 +1,180 @@
+/* antlr3config.h. Generated from antlr3config.h.in by configure. */
+/* antlr3config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define if ANTLR debugger not required */
+/* #undef ANTLR3_NODEBUGGER */
+
+/* Define if 64 bit mode required */
+/* #undef ANTLR3_USE_64BIT */
+
+/* Define to 1 if you have the `accept' function. */
+/* #undef HAVE_ACCEPT */
+
+/* Define to 1 if you have the header file. */
+/* #undef HAVE_ARPA_NAMESER_H */
+
+/* Define to 1 if you have the header file. */
+/* #undef HAVE_CTYPE_H */
+
+/* Define to 1 if you have the header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if the system has the type `intptr_t'. */
+/* #undef HAVE_INTPTR_T */
+
+/* Define to 1 if you have the header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the header file. */
+/* #undef HAVE_MALLOC_H */
+
+/* Define to 1 if you have the `memmove' function. */
+/* #undef HAVE_MEMMOVE */
+
+/* Define to 1 if you have the header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+/* #undef HAVE_MEMSET */
+
+/* Define to 1 if you have the header file. */
+/* #undef HAVE_NETDB_H */
+
+/* Define to 1 if you have the header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_NETINET_TCP_H 1
+
+/* Define to 1 if you have the header file. */
+/* #undef HAVE_RESOLV_H */
+
+/* Define to 1 if you have the header file. */
+/* #undef HAVE_SOCKET_H */
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strdup' function. */
+/* #undef HAVE_STRDUP */
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the header file. */
+/* #undef HAVE_SYS_MALLOC_H */
+
+/* Define to 1 if you have the header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+/* #undef HAVE_UINTPTR_T */
+
+/* Define to 1 if you have the header file. */
+#define HAVE_UNISTD_H 1
+
+/* Name of package */
+#define PACKAGE "libantlr3c"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "jimi@temporal-wave.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libantlr3c"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "libantlr3c 3.4-beta3"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libantlr3c"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "3.4-beta3"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "3.4-beta3"
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from ,
+ , or is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+/* #undef _UINT32_T */
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from ,
+ , or is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+/* #undef _UINT64_T */
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from ,
+ , or is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+/* #undef _UINT8_T */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to the type of a signed integer type of width exactly 16 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef int16_t */
+
+/* Define to the type of a signed integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef int32_t */
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef int64_t */
+
+/* Define to the type of a signed integer type of width exactly 8 bits if such
+ a type exists and the standard includes do not define it. */
+/* #undef int8_t */
+
+/* Define to the type of a signed integer type wide enough to hold a pointer,
+ if such a type exists, and if the system does not define it. */
+/* #undef intptr_t */
+
+/* Define to `unsigned int' if does not define. */
+/* #undef size_t */
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef uint16_t */
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef uint32_t */
+
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef uint64_t */
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef uint8_t */
+
+/* Define to the type of an unsigned integer type wide enough to hold a
+ pointer, if such a type exists, and if the system does not define it. */
+/* #undef uintptr_t */
diff --git a/submodules/externals/build/cunit/Android.mk b/submodules/externals/build/cunit/Android.mk
new file mode 100644
index 000000000..1aeebfaf0
--- /dev/null
+++ b/submodules/externals/build/cunit/Android.mk
@@ -0,0 +1,29 @@
+BUILD_PATH := $(call my-dir)
+LOCAL_PATH := $(call my-dir)/../../cunit
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ CUnit/Sources/Framework/CUError.c \
+ CUnit/Sources/Framework/MyMem.c \
+ CUnit/Sources/Framework/TestDB.c \
+ CUnit/Sources/Framework/TestRun.c \
+ CUnit/Sources/Framework/Util.c \
+ CUnit/Sources/Basic/Basic.c \
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/CUnit/Headers/ \
+
+LOCAL_CFLAGS := \
+ -DHAVE_CU_GET_SUITE \
+
+LOCAL_EXPORT_C_INCLUDES := \
+ $(BUILD_PATH) \
+
+LOCAL_EXPORT_CFLAGS := $(LOCAL_CFLAGS)
+
+LOCAL_MODULE := cunit
+LOCAL_LDLIBS := -llog
+
+include $(BUILD_SHARED_LIBRARY)
+
diff --git a/submodules/externals/build/exosip/Android.mk b/submodules/externals/build/exosip/Android.mk
deleted file mode 100755
index f218b562d..000000000
--- a/submodules/externals/build/exosip/Android.mk
+++ /dev/null
@@ -1,68 +0,0 @@
-
-LOCAL_PATH:= $(call my-dir)/../../exosip
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libeXosip2
-
-# Don't prelink this library.
-LOCAL_PRELINK_MODULE := false
-
-LOCAL_SRC_FILES = \
- src/eXosip.c \
- src/eXconf.c \
- src/eXregister_api.c \
- src/eXcall_api.c \
- src/eXmessage_api.c \
- src/eXtransport.c \
- src/jrequest.c \
- src/jresponse.c \
- src/jcallback.c \
- src/jdialog.c \
- src/udp.c \
- src/jcall.c \
- src/jreg.c \
- src/eXutils.c \
- src/jevents.c \
- src/misc.c \
- src/jauth.c \
- src/eXosip_transport_hook.c
-
-LOCAL_SRC_FILES += \
- src/eXtl.c \
- src/eXtl_udp.c \
- src/eXtl_tcp.c \
- src/eXtl_dtls.c \
- src/eXtl_tls.c
-
-LOCAL_SRC_FILES += \
- src/milenage.c \
- src/rijndael.c
-
-# BUILD_MAXSIZE: -UMINISIZE
-LOCAL_SRC_FILES += \
- src/eXsubscription_api.c \
- src/eXoptions_api.c \
- src/eXinsubscription_api.c \
- src/eXpublish_api.c \
- src/jnotify.c \
- src/jsubscribe.c \
- src/inet_ntop.c \
- src/jpipe.c \
- src/eXrefer_api.c \
- src/jpublish.c \
- src/sdp_offans.c
-LOCAL_CFLAGS += \
- -UHAVE_CONFIG_H \
- -include $(LOCAL_PATH)/../build/exosip/libeXosip2_AndroidConfig.h \
- -DOSIP_MT \
- -DENABLE_TRACE \
- -DSOCKET_TIMEOUT=50 \
- -include $(LOCAL_PATH)/include/eXosip2/eXosip_transport_hook.h
-
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/include \
- $(LOCAL_PATH)/../osip/include \
- $(LOCAL_PATH)/../openssl/include \
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/submodules/externals/build/exosip/libeXosip2_AndroidConfig.h b/submodules/externals/build/exosip/libeXosip2_AndroidConfig.h
deleted file mode 100755
index 8beb75474..000000000
--- a/submodules/externals/build/exosip/libeXosip2_AndroidConfig.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* config.h. Generated from config.h.in by configure. */
-/* config.h.in. Generated from configure.in by autoheader. */
-
-/* Define to 1 if you have the header file. */
-#define HAVE_ARPA_INET_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_ARPA_NAMESER_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_ASSERT_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_CTYPE_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define to 1 if you have the `getifaddrs' function. */
-/* #undef HAVE_GETIFADDRS */
-
-/* Define to 1 if you have the header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_NETDB_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_OPENSSL_SSL_H 1
-
-/* Define if you have POSIX threads libraries and header files. */
-#define HAVE_PTHREAD 1
-
-/* Define to 1 if you have the header file. */
-/* #undef HAVE_RESOLV8_COMPAT_H */
-
-/* Define to 1 if you have the header file. */
-#define HAVE_RESOLV_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SEMAPHORE_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SIGNAL_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STDARG_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STDIO_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SYS_SELECT_H 1
-
-/* Define to 1 if you have the header file. */
-/* #undef HAVE_SYS_SEM_H */
-
-/* Define to 1 if you have the header file. */
-/* #undef HAVE_SYS_SIGNAL_H */
-
-/* Define to 1 if you have the header file. */
-/* #undef HAVE_SYS_SOUNDCARD_H */
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SYS_TIME_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if you have the header file. */
-/* #undef HAVE_VARARGS_H */
-
-/* Name of package */
-#define PACKAGE "libeXosip2"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME ""
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING ""
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME ""
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION ""
-
-/* Define to the necessary symbol if this constant uses a non-standard name on
- your system. */
-/* #undef PTHREAD_CREATE_JOINABLE */
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Version number of package */
-#define VERSION "3.1.0"
diff --git a/submodules/externals/build/libxml2/Android.mk b/submodules/externals/build/libxml2/Android.mk
index f378940cb..ba827c011 100644
--- a/submodules/externals/build/libxml2/Android.mk
+++ b/submodules/externals/build/libxml2/Android.mk
@@ -56,6 +56,8 @@ common_C_INCLUDES += \
LOCAL_C_INCLUDES += $(common_C_INCLUDES)
#LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_SRC_FILES := $(common_SRC_FILES)
+
LOCAL_MODULE:= liblpxml2
include $(BUILD_STATIC_LIBRARY)
diff --git a/submodules/externals/build/osip/Android.mk b/submodules/externals/build/osip/Android.mk
deleted file mode 100755
index b8bb072a7..000000000
--- a/submodules/externals/build/osip/Android.mk
+++ /dev/null
@@ -1,92 +0,0 @@
-
-LOCAL_PATH:= $(call my-dir)/../../osip
-include $(CLEAR_VARS)
-
-
-libosip2_SRC_FILES = \
- src/osip2/ict_fsm.c \
- src/osip2/ist_fsm.c \
- src/osip2/nict_fsm.c \
- src/osip2/nist_fsm.c \
- src/osip2/ict.c \
- src/osip2/ist.c \
- src/osip2/nict.c \
- src/osip2/nist.c \
- src/osip2/fsm_misc.c \
- src/osip2/osip.c \
- src/osip2/osip_transaction.c \
- src/osip2/osip_event.c \
- src/osip2/port_fifo.c \
- src/osip2/osip_dialog.c \
- src/osip2/osip_time.c \
- src/osip2/port_sema.c \
- src/osip2/port_thread.c \
- src/osip2/port_condv.c
-
-libosipparser2_SRC_FILES = \
- src/osipparser2/osip_proxy_authorization.c \
- src/osipparser2/osip_cseq.c \
- src/osipparser2/osip_record_route.c \
- src/osipparser2/osip_route.c \
- src/osipparser2/osip_to.c \
- src/osipparser2/osip_from.c \
- src/osipparser2/osip_uri.c \
- src/osipparser2/osip_authorization.c \
- src/osipparser2/osip_header.c \
- src/osipparser2/osip_www_authenticate.c \
- src/osipparser2/osip_via.c \
- src/osipparser2/osip_body.c \
- src/osipparser2/osip_md5c.c \
- src/osipparser2/osip_message.c \
- src/osipparser2/osip_list.c \
- src/osipparser2/osip_call_id.c \
- src/osipparser2/osip_message_parse.c \
- src/osipparser2/osip_contact.c \
- src/osipparser2/osip_message_to_str.c \
- src/osipparser2/osip_content_length.c \
- src/osipparser2/osip_parser_cfg.c \
- src/osipparser2/osip_content_type.c \
- src/osipparser2/osip_proxy_authenticate.c \
- src/osipparser2/osip_mime_version.c \
- src/osipparser2/osip_port.c
-
-# BUILD_MAXSIZE: -UMINISIZE
-libosipparser2_SRC_FILES += \
- src/osipparser2/osip_accept_encoding.c \
- src/osipparser2/osip_content_encoding.c \
- src/osipparser2/osip_authentication_info.c \
- src/osipparser2/osip_proxy_authentication_info.c \
- src/osipparser2/osip_accept_language.c \
- src/osipparser2/osip_accept.c \
- src/osipparser2/osip_alert_info.c \
- src/osipparser2/osip_error_info.c \
- src/osipparser2/osip_allow.c \
- src/osipparser2/osip_content_disposition.c \
- src/osipparser2/sdp_accessor.c \
- src/osipparser2/sdp_message.c \
- src/osipparser2/osip_call_info.c
-
-LOCAL_SRC_FILES := \
- $(libosip2_SRC_FILES) \
- $(libosipparser2_SRC_FILES)
-
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/include
-
-LOCAL_MODULE:= libosip2
-
-# global flags
-LOCAL_CFLAGS += \
- -UHAVE_CONFIG_H \
- -include $(LOCAL_PATH)/../build/osip/libosip2_AndroidConfig.h
-
-# specific flags
-LOCAL_CFLAGS += \
- -DOSIP_MT \
- -DHAVE_PTHREAD \
- -DENABLE_TRACE \
- -DUSE_GPERF
-
-#LOCAL_LDLIBS += -lpthread
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/submodules/externals/build/osip/libosip2_AndroidConfig.h b/submodules/externals/build/osip/libosip2_AndroidConfig.h
deleted file mode 100755
index b754cebf7..000000000
--- a/submodules/externals/build/osip/libosip2_AndroidConfig.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* config.h. Generated from config.h.in by configure. */
-/* config.h.in. Generated from configure.in by autoheader. */
-
-/* Define to 1 if you have the header file. */
-#define HAVE_ASSERT_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_CTYPE_H 1
-
-/* Define to 1 if you have header file */
-/* #undef HAVE_DICT_DICT_H */
-
-/* Define to 1 if you have the header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Defined if you have lrand48 */
-#define HAVE_LRAND48
-
-/* Define to 1 if you have the header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define if you have POSIX threads libraries and header files. */
-#define HAVE_PTHREAD 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SEMAPHORE_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SIGNAL_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STDARG_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STDIO_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if the system has the type `struct timeval'. */
-#define HAVE_STRUCT_TIMEVAL 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SYSLOG_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SYS_SELECT_H 1
-
-/* Define to 1 if you have the header file. */
-/* #undef HAVE_SYS_SEM_H */
-
-/* Define to 1 if you have the header file. */
-/* #undef HAVE_SYS_SIGNAL_H */
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SYS_TIME_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the header file. */
-/* #undef HAVE_SYS_UNISTD_H */
-
-/* Define to 1 if you have the header file. */
-#define HAVE_TIME_H 1
-
-/* Define to 1 if you have the header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if you have the header file. */
-/* #undef HAVE_VARARGS_H */
-
-/* Name of package */
-#define PACKAGE "libosip2"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME ""
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING ""
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME ""
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION ""
-
-/* Define to the necessary symbol if this constant uses a non-standard name on
- your system. */
-/* #undef PTHREAD_CREATE_JOINABLE */
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Version number of package */
-#define VERSION "3.1.0"
diff --git a/submodules/externals/build/polarssl/Android.mk b/submodules/externals/build/polarssl/Android.mk
new file mode 100644
index 000000000..c3d48a556
--- /dev/null
+++ b/submodules/externals/build/polarssl/Android.mk
@@ -0,0 +1,60 @@
+
+LOCAL_PATH:= $(call my-dir)/../../polarssl/library
+include $(CLEAR_VARS)
+
+LOCAL_MODULE:= libpolarssl
+
+LOCAL_SRC_FILES := \
+ aes.c \
+ arc4.c \
+ asn1parse.c \
+ asn1write.c \
+ base64.c \
+ bignum.c \
+ blowfish.c \
+ camellia.c \
+ certs.c \
+ cipher.c \
+ cipher_wrap.c \
+ ctr_drbg.c \
+ debug.c \
+ des.c \
+ dhm.c \
+ entropy.c \
+ entropy_poll.c \
+ error.c \
+ gcm.c \
+ havege.c \
+ md2.c \
+ md4.c \
+ md5.c \
+ md.c \
+ md_wrap.c \
+ net.c \
+ padlock.c \
+ pbkdf2.c \
+ pem.c \
+ pkcs11.c \
+ rsa.c \
+ sha1.c \
+ sha2.c \
+ sha4.c \
+ ssl_cache.c \
+ ssl_cli.c \
+ ssl_srv.c \
+ ssl_tls.c \
+ timing.c \
+ version.c \
+ x509parse.c \
+ x509write.c \
+ xtea.c
+
+
+
+#LOCAL_CFLAGS += \
+
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/../include
+
+include $(BUILD_STATIC_LIBRARY)
+
diff --git a/submodules/externals/cunit b/submodules/externals/cunit
new file mode 160000
index 000000000..dc9283c76
--- /dev/null
+++ b/submodules/externals/cunit
@@ -0,0 +1 @@
+Subproject commit dc9283c76517b1f093d132d1ee0aa9671b558e56
diff --git a/submodules/externals/exosip b/submodules/externals/exosip
deleted file mode 160000
index b42d2eb4f..000000000
--- a/submodules/externals/exosip
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit b42d2eb4f137386c35c3226616e0cca213b94629
diff --git a/submodules/externals/osip b/submodules/externals/osip
deleted file mode 160000
index 7e98a3379..000000000
--- a/submodules/externals/osip
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 7e98a3379280307811ed4ad67a95fbf73ba5bbb6
diff --git a/submodules/externals/polarssl b/submodules/externals/polarssl
new file mode 160000
index 000000000..b772d5593
--- /dev/null
+++ b/submodules/externals/polarssl
@@ -0,0 +1 @@
+Subproject commit b772d5593c025e6fb945e21ee683b50ba327e211
diff --git a/submodules/externals/srtp b/submodules/externals/srtp
index c01a03a47..14027d37c 160000
--- a/submodules/externals/srtp
+++ b/submodules/externals/srtp
@@ -1 +1 @@
-Subproject commit c01a03a478d4c97fa7e2af80844f8d60440af0a6
+Subproject commit 14027d37c7574b27bf22e57f508137b4e86b6466
diff --git a/submodules/linphone b/submodules/linphone
index 53f7cedf0..af0df9b19 160000
--- a/submodules/linphone
+++ b/submodules/linphone
@@ -1 +1 @@
-Subproject commit 53f7cedf0047ee73d5f0d2c823dfbe1297322cab
+Subproject commit af0df9b19b40aa1e46d7135c809db4f694218790
diff --git a/submodules/mssilk b/submodules/mssilk
index b3392dc7f..2958b2904 160000
--- a/submodules/mssilk
+++ b/submodules/mssilk
@@ -1 +1 @@
-Subproject commit b3392dc7f07c94a27eb270eafaa861a127189555
+Subproject commit 2958b2904de6f58372cda7068db3828308563f7d
diff --git a/tests/.classpath b/tests/.classpath
index 01e79d6cf..8890c27cc 100644
--- a/tests/.classpath
+++ b/tests/.classpath
@@ -1,14 +1,15 @@
-
-
-
-
+
-
+
+
+
+
+
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 30c743114..a43330b26 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -4,16 +4,41 @@
android:versionCode="1"
android:versionName="1.0" >
- />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/ant.properties b/tests/ant.properties
new file mode 100644
index 000000000..836edf047
--- /dev/null
+++ b/tests/ant.properties
@@ -0,0 +1,18 @@
+# This file is used to override default values used by the Ant build system.
+#
+# This file must be checked into Version Control Systems, as it is
+# integral to the build system of your project.
+
+# This file is only used by the Ant script.
+
+# You can use this to override default values such as
+# 'source.dir' for the location of your java source folder and
+# 'out.dir' for the location of your output folder.
+
+# You can also use it define how the release builds are signed by declaring
+# the following properties:
+# 'key.store' for the location of your keystore and
+# 'key.alias' for the name of the key to use.
+# The password will be asked during the build when you use the 'release' target.
+
+tested.project.dir=../
diff --git a/tests/project.properties b/tests/project.properties
index 9b84a6b4b..a3ee5ab64 100644
--- a/tests/project.properties
+++ b/tests/project.properties
@@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
-target=android-16
+target=android-17
diff --git a/tests/res/drawable-ldpi/ic_launcher.png b/tests/res/drawable-ldpi/ic_launcher.png
deleted file mode 100644
index 99238729d..000000000
Binary files a/tests/res/drawable-ldpi/ic_launcher.png and /dev/null differ
diff --git a/tests/res/values/config.xml b/tests/res/values/config.xml
new file mode 100644
index 000000000..6942f8fc5
--- /dev/null
+++ b/tests/res/values/config.xml
@@ -0,0 +1,31 @@
+
+
+
+ wizard15
+ wizard15
+ sip.linphone.org
+
+ wizard15
+ wizard15
+ test.linphone.org
+
+ wizard42
+ wizard42
+ wizard42@linphone.org
+
+ viish
+ lucifer
+ sip.linphone.org
+
+ Cot
+ +33952636505
+ viish@sip.linphone.org
+
+ Ping!
+ Pong!
+
+ elviish
+ lucifer
+ sip.linphone.org
+
+
\ No newline at end of file
diff --git a/tests/src/org/linphone/test/AccountAssistant.java b/tests/src/org/linphone/test/AccountAssistant.java
new file mode 100644
index 000000000..0e7b809ef
--- /dev/null
+++ b/tests/src/org/linphone/test/AccountAssistant.java
@@ -0,0 +1,173 @@
+package org.linphone.test;
+
+import junit.framework.Assert;
+
+import org.linphone.LinphoneActivity;
+import org.linphone.LinphoneManager;
+import org.linphone.core.LinphoneCore.RegistrationState;
+import org.linphone.core.LinphoneProxyConfig;
+import org.linphone.mediastream.video.capture.hwconf.Hacks;
+import org.linphone.setup.SetupActivity;
+
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+/**
+ * @author Sylvain Berfini
+ */
+public class AccountAssistant extends SampleTest {
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testAWizardDisplayedAfterInstall() {
+ solo.waitForActivity("SetupActivity", 3000);
+ solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
+ }
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testBLoginWithLinphoneAccount() {
+ solo.waitForActivity("SetupActivity", 1000);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.setup_next));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.setup_login_linphone));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_username), iContext.getString(R.string.account_linphone_login));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password), iContext.getString(R.string.account_linphone_pwd));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.setup_apply));
+
+ if (!Hacks.hasBuiltInEchoCanceller())
+ solo.waitForActivity("LinphoneActivity", 8000);
+ else
+ solo.waitForActivity("LinphoneActivity", 2000);
+ Assert.assertTrue(solo.searchText(iContext.getString(R.string.account_linphone_login) + "@sip.linphone.org"));
+
+ solo.sleep(3000); //Wait for registration to be done
+ LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
+ Assert.assertEquals(proxyConfigs.length, 1);
+ LinphoneProxyConfig proxyConfig = proxyConfigs[0];
+ Assert.assertEquals(RegistrationState.RegistrationOk, proxyConfig.getState());
+
+ //Check the wizard added sip.linphone.org custom settings
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
+ String stunServer = prefs.getString(aContext.getString(org.linphone.R.string.pref_stun_server_key), "");
+ Assert.assertEquals(stunServer, aContext.getString(org.linphone.R.string.default_stun));
+
+ String transport = prefs.getString(aContext.getString(org.linphone.R.string.pref_transport_key), aContext.getString(org.linphone.R.string.pref_transport_udp_key));
+ Assert.assertEquals(transport, aContext.getString(org.linphone.R.string.pref_transport_tls_key));
+
+ String proxy = prefs.getString(aContext.getString(org.linphone.R.string.pref_proxy_key), "");
+ Assert.assertEquals(proxy, aContext.getString(org.linphone.R.string.default_domain) + ":5223");
+ boolean outboundproxy = prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_enable_outbound_proxy_key), false);
+ Assert.assertEquals(outboundproxy, true);
+
+ boolean ice = prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_ice_enable_key), false);
+ Assert.assertEquals(ice, true);
+ }
+
+ @LargeTest
+ public void testCWizardDoesntShowWhenAccountIsConfigured() {
+ solo.waitForActivity("LinphoneActivity", 2000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @LargeTest
+ public void testDLoginWithGenericAccount() {
+ startWizard();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.setup_next));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.setup_login_generic));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_username), iContext.getString(R.string.account_generic_login));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password), iContext.getString(R.string.account_generic_pwd));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_domain), iContext.getString(R.string.account_generic_domain));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.setup_apply));
+
+ if (!Hacks.hasBuiltInEchoCanceller())
+ solo.waitForActivity("LinphoneActivity", 8000);
+ else
+ solo.waitForActivity("LinphoneActivity", 2000);
+ Assert.assertTrue(solo.searchText(iContext.getString(R.string.account_generic_login) + "@" + iContext.getString(R.string.account_generic_domain)));
+
+ solo.sleep(3000); //Wait for registration to be done
+ LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
+ Assert.assertEquals(proxyConfigs.length, 2);
+ LinphoneProxyConfig proxyConfig = proxyConfigs[1];
+ Assert.assertEquals(RegistrationState.RegistrationOk, proxyConfig.getState());
+ }
+
+ @LargeTest
+ public void testECreateNewAccount() {
+ startWizard();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.setup_next));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.setup_create_account));
+
+ TextView error = (TextView) solo.getView(org.linphone.R.id.setup_error);
+ ImageView createAccount = (ImageView) solo.getView(org.linphone.R.id.setup_create);
+ int sleepingTime = 1500;
+
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_username), iContext.getString(R.string.account_create_login).substring(0,2));
+ solo.sleep(sleepingTime);
+ Assert.assertEquals(error.getText(), aContext.getString(org.linphone.R.string.wizard_username_incorrect));
+ Assert.assertFalse(createAccount.isEnabled());
+
+ solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_username));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_username), iContext.getString(R.string.account_linphone_login));
+ solo.sleep(sleepingTime*2);
+ Assert.assertEquals(error.getText(), aContext.getString(org.linphone.R.string.wizard_username_unavailable));
+ Assert.assertFalse(createAccount.isEnabled());
+
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password), iContext.getString(R.string.account_create_pwd).substring(0,2));
+ solo.sleep(sleepingTime);
+ Assert.assertEquals(error.getText(), aContext.getString(org.linphone.R.string.wizard_passwords_unmatched));
+ Assert.assertFalse(createAccount.isEnabled());
+
+ solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_password));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password), iContext.getString(R.string.account_create_pwd).substring(0,2));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password_confirm), iContext.getString(R.string.account_create_pwd).substring(0,2));
+ solo.sleep(sleepingTime);
+ Assert.assertEquals(error.getText(), aContext.getString(org.linphone.R.string.wizard_password_incorrect));
+ Assert.assertFalse(createAccount.isEnabled());
+
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_email), iContext.getString(R.string.account_create_email).substring(0, 12));
+ solo.sleep(sleepingTime);
+ Assert.assertEquals(error.getText(), aContext.getString(org.linphone.R.string.wizard_email_incorrect));
+ Assert.assertFalse(createAccount.isEnabled());
+
+ solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_username));
+ solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_password));
+ solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_password_confirm));
+ solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_email));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_username), iContext.getString(R.string.account_create_login));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password), iContext.getString(R.string.account_create_pwd));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password_confirm), iContext.getString(R.string.account_create_pwd));
+ solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_email), iContext.getString(R.string.account_create_email));
+ solo.sleep(sleepingTime);
+ Assert.assertEquals(error.getText(), "");
+ Assert.assertTrue(createAccount.isEnabled());
+ }
+
+ @LargeTest
+ public void testFCancelWizard() {
+ startWizard();
+ solo.clickOnView(solo.getView(org.linphone.R.id.setup_cancel));
+
+ solo.waitForActivity("LinphoneActivity", 2000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ private void startWizard() {
+ solo.waitForActivity("LinphoneActivity", 2000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.settings));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.setup_title).substring(0, STRING_LENGTH_MAX));
+ }
+}
diff --git a/tests/src/org/linphone/test/AccountManagement.java b/tests/src/org/linphone/test/AccountManagement.java
new file mode 100644
index 000000000..4b2611ac9
--- /dev/null
+++ b/tests/src/org/linphone/test/AccountManagement.java
@@ -0,0 +1,91 @@
+package org.linphone.test;
+
+import junit.framework.Assert;
+
+import org.linphone.FragmentsAvailable;
+import org.linphone.LinphoneActivity;
+import org.linphone.LinphoneManager;
+import org.linphone.core.LinphoneCore.RegistrationState;
+import org.linphone.core.LinphoneProxyConfig;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.view.KeyEvent;
+
+/**
+ * @author Sylvain Berfini
+ */
+public class AccountManagement extends SampleTest {
+
+ @LargeTest
+ public void testAEditAccount() {
+ goToSettings();
+ solo.clickOnText(iContext.getString(R.string.account_generic_login) + "@" + iContext.getString(R.string.account_generic_domain));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_username));
+ solo.enterText(0, "new");
+ //Hack to validate the dialog
+ solo.sendKey(KeyEvent.KEYCODE_ENTER);
+ solo.sendKey(KeyEvent.KEYCODE_TAB);
+ solo.sendKey(KeyEvent.KEYCODE_ENTER);
+ //End of hack
+
+ solo.goBack();
+ solo.goBack();
+ solo.waitForFragmentByTag(FragmentsAvailable.DIALER.toString(), 2000);
+
+ solo.sleep(2000); //Wait for registration to be done
+ LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
+ Assert.assertEquals(proxyConfigs.length, 2);
+ LinphoneProxyConfig proxyConfig = proxyConfigs[1];
+ Assert.assertEquals(RegistrationState.RegistrationOk, proxyConfig.getState());
+ Assert.assertTrue(proxyConfig.getIdentity(), proxyConfig.getIdentity().contains("new"));
+ }
+
+ @LargeTest
+ public void testBDeleteAccount() {
+ goToSettings();
+ solo.clickOnText(iContext.getString(R.string.account_generic_login) + "new");
+ selectItemInListOnUIThread(7);
+ solo.clickLongOnText(aContext.getString(org.linphone.R.string.pref_delete_account));
+
+ solo.goBack();
+ solo.goBack();
+
+ LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
+ Assert.assertEquals(proxyConfigs.length, 1);
+ }
+
+ @LargeTest
+ public void testCDisableAccount() {
+ goToSettings();
+ solo.clickOnText(iContext.getString(R.string.account_linphone_login));
+ selectItemInListOnUIThread(5);
+ solo.clickLongOnText(aContext.getString(org.linphone.R.string.pref_disable_account));
+
+ solo.goBack();
+ solo.goBack();
+
+ LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
+ Assert.assertEquals(proxyConfigs.length, 0);
+ }
+
+ @LargeTest
+ public void testDEnableAccount() {
+ goToSettings();
+ solo.clickOnText(iContext.getString(R.string.account_linphone_login));
+ selectItemInListOnUIThread(5);
+ solo.clickLongOnText(aContext.getString(org.linphone.R.string.pref_disable_account));
+
+ solo.goBack();
+ solo.goBack();
+
+ LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
+ Assert.assertEquals(proxyConfigs.length, 1);
+ }
+
+ private void goToSettings() {
+ solo.waitForActivity("LinphoneActivity", 2000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.settings));
+ }
+}
diff --git a/tests/src/org/linphone/test/AccountsTest.java b/tests/src/org/linphone/test/AccountsTest.java
deleted file mode 100644
index c3fc473e1..000000000
--- a/tests/src/org/linphone/test/AccountsTest.java
+++ /dev/null
@@ -1,226 +0,0 @@
-package org.linphone.test;
-
-import junit.framework.Assert;
-
-import org.linphone.LinphoneActivity;
-import org.linphone.R;
-import org.linphone.mediastream.video.capture.hwconf.Hacks;
-import org.linphone.setup.SetupActivity;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.test.ActivityInstrumentationTestCase2;
-import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import com.jayway.android.robotium.solo.Solo;
-
-public class AccountsTest extends
- ActivityInstrumentationTestCase2 {
-
- private Solo solo;
-
- @SuppressWarnings("deprecation")
- public AccountsTest() {
- super("org.linphone", LinphoneActivity.class);
- }
-
- private void selectItemInListOnUIThread(final int item) {
- solo.sleep(500);
- getActivity().runOnUiThread(new Runnable() {
- public void run() {
- ListView list = (ListView) solo.getView(android.R.id.list);
- list.setSelection(item);
- }
- });
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- solo = new Solo(getInstrumentation(), getActivity());
- }
-
- public void testAConfigureExistingLinphoneAccount() {
- Context context = getActivity();
-
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
- int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
-
- solo.waitForActivity("SetupActivity", 2000);
- solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
- Log.testSuccess("Wizard launching at first startup");
-
- solo.clickOnView(solo.getView(R.id.setup_next));
- solo.clickOnText(context.getString(R.string.setup_login_linphone));
- solo.enterText((EditText) solo.getView(R.id.setup_username), "wizard15");
- solo.enterText((EditText) solo.getView(R.id.setup_password), "wizard15");
- solo.clickOnText(context.getString(R.string.setup_apply));
-
- if (!Hacks.hasBuiltInEchoCanceller())
- solo.waitForActivity("LinphoneActivity", 8000);
- else
- solo.waitForActivity("LinphoneActivity", 2000);
- Assert.assertTrue(solo.searchText("wizard15@sip.linphone.org"));
-
- int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
- Assert.assertEquals(nbAccountsBefore + 1, nbAccountsAfter);
- Log.testSuccess("Configure existing sip.linphone.org account");
-
- String stunServer = prefs.getString(context.getString(R.string.pref_stun_server_key), "");
- Assert.assertEquals(stunServer, context.getString(R.string.default_stun));
- Log.testSuccess("Default stun server is configured");
-
- String transport = prefs.getString(context.getString(R.string.pref_transport_key), context.getString(R.string.pref_transport_udp_key));
- Assert.assertEquals(transport, context.getString(R.string.pref_transport_tls_key));
- Log.testSuccess("TLS is set by default");
-
- String proxy = prefs.getString(context.getString(R.string.pref_proxy_key), "");
- Assert.assertEquals(proxy, context.getString(R.string.default_domain) + ":5223");
- boolean outboundproxy = prefs.getBoolean(context.getString(R.string.pref_enable_outbound_proxy_key), false);
- Assert.assertEquals(outboundproxy, true);
- Log.testSuccess("Outbound proxy is configured");
-
- boolean ice = prefs.getBoolean(context.getString(R.string.pref_ice_enable_key), false);
- Assert.assertEquals(ice, true);
- Log.testSuccess("ICE is enabled");
- }
-
- public void testBConfigureExternalSIPAccount() {
- Context context = getActivity();
-
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
- int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- Log.testSuccess("Wizard not launching at startup if account is configured");
-
- solo.clickOnView(solo.getView(R.id.settings));
- solo.clickOnText(context.getString(R.string.setup_title));
-
- solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
- solo.clickOnView(solo.getView(R.id.setup_next));
- solo.clickOnText(context.getString(R.string.setup_login_generic));
- solo.enterText((EditText) solo.getView(R.id.setup_username), "junit");
- solo.enterText((EditText) solo.getView(R.id.setup_password), "junit");
- solo.enterText((EditText) solo.getView(R.id.setup_domain), "test.linphone.org");
- solo.clickOnText(context.getString(R.string.setup_apply));
-
- solo.waitForActivity("LinphoneActivity", 2000);
- Assert.assertTrue(solo.searchText("junit@test.linphone.org"));
-
- int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
- Assert.assertEquals(nbAccountsBefore + 1, nbAccountsAfter);
- Log.testSuccess("Configure existing generic account");
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.settings));
- Assert.assertTrue(solo.searchText("junit@test.linphone.org"));
-
- solo.clickOnText("junit@test.linphone.org");
- selectItemInListOnUIThread(6);
- solo.clickOnText(context.getString(R.string.pref_default_account));
- solo.goBack();
- int defaultAccount = prefs.getInt(context.getString(R.string.pref_default_account_key), 0);
- solo.sleep(1000);
- Assert.assertEquals(1, defaultAccount);
- Log.testSuccess("Select another account as default");
- }
-
- public void testCDeleteConfiguredAccount() {
- Context context = getActivity();
-
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
- int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
-
- solo.clickOnView(solo.getView(R.id.settings));
- Assert.assertTrue(solo.searchText("wizard15@sip.linphone.org"));
-
- solo.clickOnText("wizard15@sip.linphone.org");
- selectItemInListOnUIThread(7);
- solo.clickOnText(context.getString(R.string.pref_delete_account));
-
- solo.goBack();
-
- int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
- Assert.assertEquals(nbAccountsBefore - 1, nbAccountsAfter);
- Log.testSuccess("Deleting existing SIP account");
- }
-
- public void testDTryCreatingExistingAccount() {
- Context context = getActivity();
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
-
- solo.clickOnView(solo.getView(R.id.settings));
- solo.clickOnText(context.getString(R.string.setup_title));
-
- solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
-
- solo.clickOnView(solo.getView(R.id.setup_next));
- solo.clickOnText(context.getString(R.string.setup_create_account));
-
- TextView error = (TextView) solo.getView(R.id.setup_error);
- ImageView createAccount = (ImageView) solo.getView(R.id.setup_create);
- int sleepingTime = 1500;
-
- solo.enterText((EditText) solo.getView(R.id.setup_username), "wi");
- solo.sleep(sleepingTime);
- Assert.assertEquals(error.getText(), context.getString(R.string.wizard_username_incorrect));
- Assert.assertFalse(createAccount.isEnabled());
- Log.testSuccess("Username incorrect error message");
-
- solo.clearEditText((EditText) solo.getView(R.id.setup_username));
- solo.enterText((EditText) solo.getView(R.id.setup_username), "wizard15");
- solo.sleep(sleepingTime*2);
- Assert.assertEquals(error.getText(), context.getString(R.string.wizard_username_unavailable));
- Assert.assertFalse(createAccount.isEnabled());
- Log.testSuccess("Username already in use error message");
-
- solo.enterText((EditText) solo.getView(R.id.setup_password), "wi");
- solo.sleep(sleepingTime);
- Assert.assertEquals(error.getText(), context.getString(R.string.wizard_password_incorrect));
- Assert.assertFalse(createAccount.isEnabled());
- Log.testSuccess("Password incorrect error message");
-
- solo.clearEditText((EditText) solo.getView(R.id.setup_password));
- solo.enterText((EditText) solo.getView(R.id.setup_password), "wizard15");
- solo.enterText((EditText) solo.getView(R.id.setup_password_confirm), "wizard14");
- solo.sleep(sleepingTime);
- Assert.assertEquals(error.getText(), context.getString(R.string.wizard_passwords_unmatched));
- Assert.assertFalse(createAccount.isEnabled());
- Log.testSuccess("Passwords doesn't match error message");
-
- solo.enterText((EditText) solo.getView(R.id.setup_email), "wizard15@lin");
- solo.sleep(sleepingTime);
- Assert.assertEquals(error.getText(), context.getString(R.string.wizard_email_incorrect));
- Assert.assertFalse(createAccount.isEnabled());
- Log.testSuccess("Email incorrect error message");
-
- solo.clearEditText((EditText) solo.getView(R.id.setup_username));
- solo.clearEditText((EditText) solo.getView(R.id.setup_password));
- solo.clearEditText((EditText) solo.getView(R.id.setup_password_confirm));
- solo.clearEditText((EditText) solo.getView(R.id.setup_email));
- solo.enterText((EditText) solo.getView(R.id.setup_username), "wizard42");
- solo.enterText((EditText) solo.getView(R.id.setup_password), "wizard42");
- solo.enterText((EditText) solo.getView(R.id.setup_password_confirm), "wizard42");
- solo.enterText((EditText) solo.getView(R.id.setup_email), "wizard42@linphone.org");
- solo.sleep(sleepingTime);
- Assert.assertEquals(error.getText(), "");
- Assert.assertTrue(createAccount.isEnabled());
- Log.testSuccess("All wizard fields correctly filled");
- }
-
- @Override
- public void tearDown() throws Exception {
- solo.finishOpenedActivities();
- }
-}
diff --git a/tests/src/org/linphone/test/AccountzFreephonieTest.java b/tests/src/org/linphone/test/AccountzFreephonieTest.java
deleted file mode 100644
index 4387f1b5a..000000000
--- a/tests/src/org/linphone/test/AccountzFreephonieTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.linphone.test;
-
-import junit.framework.Assert;
-
-import org.linphone.InCallActivity;
-import org.linphone.LinphoneActivity;
-import org.linphone.LinphoneManager;
-import org.linphone.R;
-import org.linphone.core.LinphoneCall;
-import org.linphone.setup.SetupActivity;
-
-import android.content.Context;
-import android.test.ActivityInstrumentationTestCase2;
-import android.widget.EditText;
-import android.widget.ListView;
-
-import com.jayway.android.robotium.solo.Solo;
-
-public class AccountzFreephonieTest extends ActivityInstrumentationTestCase2 {
-
- private static final String numberToCallToTestPSTNGateway = "0482532176";
- private Solo solo;
-
- @SuppressWarnings("deprecation")
- public AccountzFreephonieTest() {
- super("org.linphone", LinphoneActivity.class);
- }
-
- private void selectItemInListOnUIThread(final int item) {
- solo.sleep(500);
- getActivity().runOnUiThread(new Runnable() {
- public void run() {
- ListView list = (ListView) solo.getView(android.R.id.list);
- list.setSelection(item);
- }
- });
- }
-
- private void configureFreephonieAccount() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.settings));
-
- selectItemInListOnUIThread(6);
- solo.clickOnText(context.getString(R.string.pref_network_title));
- solo.clickOnText(context.getString(R.string.pref_transport));
- solo.clickOnText(context.getString(R.string.pref_transport_udp));
- solo.goBack();
- selectItemInListOnUIThread(0);
-
- solo.clickOnText(context.getString(R.string.setup_title));
- solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
- solo.clickOnView(solo.getView(R.id.setup_next));
- solo.clickOnText(context.getString(R.string.setup_login_generic));
- solo.enterText((EditText) solo.getView(R.id.setup_username), "0953335419");
- solo.enterText((EditText) solo.getView(R.id.setup_password), "jodeeeeeer");
- solo.enterText((EditText) solo.getView(R.id.setup_domain), "freephonie.net");
- solo.clickOnText(context.getString(R.string.setup_apply));
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.settings));
-
- solo.clickOnText("0953335419@freephonie.net");
- selectItemInListOnUIThread(6);
- solo.clickOnText(context.getString(R.string.pref_default_account));
-
-// solo.clickOnText(context.getString(R.string.pref_proxy));
-// solo.enterText(0, "sip.linphone.org");
-// solo.clickOnText("OK");
-// solo.clickOnText(context.getString(R.string.pref_enable_outbound_proxy));
-
- solo.goBack();
- solo.goBack();
- }
-
- private void deleteFreephonieAccount() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.settings));
-
- selectItemInListOnUIThread(0);
- solo.clickOnText("junit@test.linphone.org");
- selectItemInListOnUIThread(6);
- solo.clickOnText(context.getString(R.string.pref_default_account));
- solo.goBack();
-
- solo.clickOnText("0953335419@freephonie.net");
- selectItemInListOnUIThread(7);
- solo.clickOnText(context.getString(R.string.pref_delete_account));
-
- selectItemInListOnUIThread(6);
- solo.clickOnText(context.getString(R.string.pref_network_title));
- solo.clickOnText(context.getString(R.string.pref_transport));
- solo.clickOnText(context.getString(R.string.pref_transport_tls));
- solo.goBack();
-
- solo.goBack();
- }
-
- private void goToDialerAndOutgoingCall() {
- solo.clickOnView(solo.getView(R.id.dialer));
- solo.clickOnView(solo.getView(R.id.Adress));
- solo.enterText((EditText) solo.getView(R.id.Adress), numberToCallToTestPSTNGateway);
- solo.clickOnView(solo.getView(R.id.Call));
-
- solo.waitForActivity("InCallActivity", 2000);
- solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
- solo.sleep(2000);
- try {
- LinphoneCall.State state = LinphoneManager.getLcIfManagerNotDestroyedOrNull().getCalls()[0].getState();
- Assert.assertTrue(state == LinphoneCall.State.OutgoingEarlyMedia || state == LinphoneCall.State.OutgoingRinging || state == LinphoneCall.State.StreamsRunning);
- } catch (AssertionError ae) {
- } finally {
- solo.clickOnView(solo.getView(R.id.hangUp));
- }
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- solo = new Solo(getInstrumentation(), getActivity());
- }
-
- public void testAOutgoingCallUsingPSTNGatewayAndFreephonieNetwork() {
- configureFreephonieAccount();
- goToDialerAndOutgoingCall();
- deleteFreephonieAccount();
- }
-
- @Override
- public void tearDown() throws Exception {
- solo.finishOpenedActivities();
- }
-}
diff --git a/tests/src/org/linphone/test/AinitTestEnv.java b/tests/src/org/linphone/test/AinitTestEnv.java
new file mode 100644
index 000000000..90f88595f
--- /dev/null
+++ b/tests/src/org/linphone/test/AinitTestEnv.java
@@ -0,0 +1,26 @@
+package org.linphone.test;
+
+import junit.framework.Assert;
+
+import org.linphone.core.LinphoneCore.RegistrationState;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+
+/**
+ * @author Sylvain Berfini
+ */
+public class AinitTestEnv extends SampleTest {
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testAInitLinphoneCore() {
+ LinphoneTestManager.createAndStart(aContext, iContext, 1);
+
+ solo.sleep(2000);
+ Assert.assertEquals(RegistrationState.RegistrationOk, LinphoneTestManager.getLc().getProxyConfigList()[0].getState());
+ }
+
+}
diff --git a/tests/src/org/linphone/test/AudioAndVideoCodecsTest.java b/tests/src/org/linphone/test/AudioAndVideoCodecsTest.java
deleted file mode 100644
index ea6b87e7f..000000000
--- a/tests/src/org/linphone/test/AudioAndVideoCodecsTest.java
+++ /dev/null
@@ -1,385 +0,0 @@
-package org.linphone.test;
-
-import junit.framework.Assert;
-
-import org.linphone.InCallActivity;
-import org.linphone.LinphoneActivity;
-import org.linphone.R;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.test.ActivityInstrumentationTestCase2;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.ListView;
-
-import com.jayway.android.robotium.solo.Solo;
-
-public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2 {
- private static final String sipAdressToCall = "cotcot@sip.linphone.org";
- private Solo solo;
-
- @SuppressWarnings("deprecation")
- public AudioAndVideoCodecsTest() {
- super("org.linphone", LinphoneActivity.class);
- }
-
- private void selectItemInListOnUIThread(final int item) {
- solo.sleep(500);
- getActivity().runOnUiThread(new Runnable() {
- public void run() {
- ListView list = (ListView) solo.getView(android.R.id.list);
- list.setSelection(item);
- }
- });
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- solo = new Solo(getInstrumentation(), getActivity());
- }
-
- private boolean getBoolean(int key) {
- return getActivity().getResources().getBoolean(key);
- }
-
- private void goToAudioCodecsSettings() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.settings));
-
- selectItemInListOnUIThread(4);
- solo.clickOnText(context.getString(R.string.pref_audio));
- solo.sleep(500);
- }
-
- private void goToVideoCodecsSettings() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.settings));
-
- selectItemInListOnUIThread(6);
- if (solo.searchText(context.getString(R.string.pref_video), 2)) // Needed in case pref_video_enable_title contains pref_video
- solo.clickOnText(context.getString(R.string.pref_video), 2);
- else
- solo.clickOnText(context.getString(R.string.pref_video));
- solo.sleep(500);
- }
-
- private void disableAllEnabledAudioCodecs() {
- Context context = getActivity();
-
- goToAudioCodecsSettings();
-
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- if (prefs.getBoolean(context.getString(R.string.pref_codec_speex16_key), getBoolean(R.bool.pref_codec_speex16_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_speex16));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_codec_speex8_key), getBoolean(R.bool.pref_codec_speex8_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_speex8));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_codec_ilbc_key), getBoolean(R.bool.pref_codec_ilbc_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_ilbc));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_codec_amr_key), getBoolean(R.bool.pref_codec_amr_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_amr));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_codec_amrwb_key), getBoolean(R.bool.pref_codec_amrwb_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_amrwb));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_codec_g729_key), getBoolean(R.bool.pref_codec_g729_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_g729));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_codec_gsm_key), getBoolean(R.bool.pref_codec_gsm_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_gsm));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_codec_g722_key), getBoolean(R.bool.pref_codec_g722_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_g722));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_codec_silk24_key), getBoolean(R.bool.pref_codec_silk24_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_silk24));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_codec_silk16_key), getBoolean(R.bool.pref_codec_silk16_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_silk16));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_codec_pcmu_key), getBoolean(R.bool.pref_codec_pcmu_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_pcmu));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_codec_pcma_key), getBoolean(R.bool.pref_codec_pcma_default))) {
- solo.clickOnText(context.getString(R.string.pref_codec_pcma));
- solo.sleep(500);
- }
- }
-
- private void disableAllEnabledVideoCodecs() {
- Context context = getActivity();
-
- goToVideoCodecsSettings();
-
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- if (prefs.getBoolean(context.getString(R.string.pref_video_codec_vp8_key), getBoolean(R.bool.pref_video_codec_vp8_default))) {
- solo.clickOnText(context.getString(R.string.pref_video_codec_vp8_title));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_video_codec_h264_key), getBoolean(R.bool.pref_video_codec_h264_default))) {
- solo.clickOnText(context.getString(R.string.pref_video_codec_h264_title));
- solo.sleep(500);
- }
-
- if (prefs.getBoolean(context.getString(R.string.pref_video_codec_mpeg4_key), getBoolean(R.bool.pref_video_codec_mpeg4_default))) {
- solo.clickOnText(context.getString(R.string.pref_video_codec_mpeg4_title));
- solo.sleep(500);
- }
- }
-
- private void goToDialerAndOutgoingCall(String codecTextToAssert) {
- Context context = getActivity();
-
- solo.clickOnView(solo.getView(R.id.dialer));
- solo.clickOnView(solo.getView(R.id.Adress));
- solo.enterText((EditText) solo.getView(R.id.Adress), sipAdressToCall);
- solo.clickOnView(solo.getView(R.id.Call));
-
- boolean incompatibleMediaParams = solo.waitForText(context.getString(R.string.error_incompatible_media), 1, 1500);
- if (!incompatibleMediaParams) { // There is a possiblity the callee doesn't support the codec, in which case we don't have to wait for the incall view
- solo.waitForActivity("InCallActivity", 1000);
- solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
- solo.clickOnView(solo.getView(R.id.status));
- solo.waitForText(codecTextToAssert, 1, 6000);
- Assert.assertTrue(solo.searchText(codecTextToAssert, 1));
-
- View hangUp = solo.getView(R.id.hangUp);
- if (hangUp.getVisibility() == View.VISIBLE)
- solo.clickOnView(hangUp);
- else { // While on video, menu can hide. Click the first time to display it back, then click again to really hang up
- solo.clickOnView(hangUp);
- solo.sleep(1000);
- solo.clickOnView(hangUp);
- }
- } else {
- Log.testFailure("Incompatible media parameters for codec " + codecTextToAssert);
- }
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- }
-
- public void testADisableVideo() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.settings));
-
- selectItemInListOnUIThread(4);
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- if (prefs.getBoolean(context.getString(R.string.pref_video_enable_key), getBoolean(R.bool.pref_video_enable_default))) {
- solo.clickOnText(context.getString(R.string.pref_video_enable_title));
- solo.sleep(500);
- }
- }
-
- public void testBOutgoingAudioCallPCMA() {
- Context context = getActivity();
- disableAllEnabledAudioCodecs();
- solo.clickOnText(context.getString(R.string.pref_codec_pcma));
- solo.goBack();
-
- goToDialerAndOutgoingCall("PCMA");
- solo.sleep(1000);
- }
-
- public void testCOutgoingAudioCallPCMU() {
- Context context = getActivity();
- disableAllEnabledAudioCodecs();
- solo.clickOnText(context.getString(R.string.pref_codec_pcmu));
- solo.goBack();
-
- goToDialerAndOutgoingCall("PCMU");
- solo.sleep(1000);
- }
-
- public void testDOutgoingAudioCallSilk16() {
- Context context = getActivity();
- disableAllEnabledAudioCodecs();
- solo.clickOnText(context.getString(R.string.pref_codec_silk16));
- solo.goBack();
-
- goToDialerAndOutgoingCall("SILK");
- solo.sleep(1000);
- }
-
- public void testEOutgoingAudioCallSilk24() {
-// Silk24 no longer available
-// Context context = getActivity();
-// disableAllEnabledAudioCodecs();
-// solo.clickOnText(context.getString(R.string.pref_codec_silk24));
-// solo.goBack();
-//
-// goToDialerAndOutgoingCall("SILK");
-// solo.sleep(1000);
- }
-
- public void testFOutgoingAudioCallG722() {
- Context context = getActivity();
- disableAllEnabledAudioCodecs();
- solo.clickOnText(context.getString(R.string.pref_codec_g722));
- solo.goBack();
-
- goToDialerAndOutgoingCall("G722");
- solo.sleep(1000);
- }
-
- public void testGOutgoingAudioCallGSM() {
- Context context = getActivity();
- disableAllEnabledAudioCodecs();
- solo.clickOnText(context.getString(R.string.pref_codec_gsm));
- solo.goBack();
-
- goToDialerAndOutgoingCall("GSM");
- solo.sleep(1000);
- }
-
- public void testHOutgoingAudioCallAMR() {
- Context context = getActivity();
- disableAllEnabledAudioCodecs();
- solo.clickOnText(context.getString(R.string.pref_codec_amr));
- solo.goBack();
-
- goToDialerAndOutgoingCall("AMR");
- solo.sleep(1000);
- }
-
- public void testIOutgoingAudioCallAMRWB() {
- Context context = getActivity();
- disableAllEnabledAudioCodecs();
- solo.clickOnText(context.getString(R.string.pref_codec_amrwb));
- solo.goBack();
-
- goToDialerAndOutgoingCall("AMRWB");
- solo.sleep(1000);
- }
-
- public void testJOutgoingAudioCallG729() {
- Context context = getActivity();
- disableAllEnabledAudioCodecs();
- solo.clickOnText(context.getString(R.string.pref_codec_g729));
- solo.goBack();
-
- goToDialerAndOutgoingCall("G729");
- solo.sleep(1000);
- }
-
- public void testKOutgoingAudioCallILBC() {
- Context context = getActivity();
- disableAllEnabledAudioCodecs();
- solo.clickOnText(context.getString(R.string.pref_codec_ilbc));
- solo.goBack();
-
- goToDialerAndOutgoingCall("iLBC");
- solo.sleep(1000);
- }
-
- public void testLOutgoingAudioCallSpeex8() {
- Context context = getActivity();
- disableAllEnabledAudioCodecs();
- solo.clickOnText(context.getString(R.string.pref_codec_speex8));
- solo.goBack();
-
- goToDialerAndOutgoingCall("speex");
- solo.sleep(1000);
- }
-
- public void testMOutgoingAudioCallSpeex16() {
- Context context = getActivity();
- disableAllEnabledAudioCodecs();
- solo.clickOnText(context.getString(R.string.pref_codec_speex16));
- solo.goBack();
-
- goToDialerAndOutgoingCall("speex");
- solo.sleep(1000);
- }
-
- public void testNEnableVideo() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.settings));
-
- solo.sleep(500);
- selectItemInListOnUIThread(4);
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- if (!prefs.getBoolean(context.getString(R.string.pref_video_enable_key), getBoolean(R.bool.pref_video_enable_default))) {
- solo.clickOnText(context.getString(R.string.pref_video_enable_title));
- solo.sleep(500);
- }
- }
-
- public void testOOutgoingVideoCallVP8() {
- Context context = getActivity();
- disableAllEnabledVideoCodecs();
- solo.clickOnText(context.getString(R.string.pref_video_codec_vp8_title));
- solo.goBack();
-
- goToDialerAndOutgoingCall("VP8");
- solo.sleep(1000);
- }
-
- public void testPOutgoingVideoCallH264() {
- Context context = getActivity();
- disableAllEnabledVideoCodecs();
- solo.clickOnText(context.getString(R.string.pref_video_codec_h264_title));
- solo.goBack();
-
- goToDialerAndOutgoingCall("H264");
- solo.sleep(1000);
- }
-
- public void testQOutgoingVideoCallMPG4() {
- Context context = getActivity();
- disableAllEnabledVideoCodecs();
- solo.clickOnText(context.getString(R.string.pref_video_codec_mpeg4_title));
- solo.goBack();
-
- goToDialerAndOutgoingCall("MP4V-ES");
- solo.sleep(1000);
- }
-
- @Override
- public void tearDown() throws Exception {
- if (solo.getCurrentActivity().getClass() == InCallActivity.class) {
- solo.clickOnView(solo.getView(R.id.hangUp));
- }
- solo.finishOpenedActivities();
- }
-}
diff --git a/tests/src/org/linphone/test/CallsAudio.java b/tests/src/org/linphone/test/CallsAudio.java
new file mode 100644
index 000000000..d0bc75655
--- /dev/null
+++ b/tests/src/org/linphone/test/CallsAudio.java
@@ -0,0 +1,457 @@
+package org.linphone.test;
+
+import junit.framework.Assert;
+
+import org.linphone.InCallActivity;
+import org.linphone.IncomingCallActivity;
+import org.linphone.LinphoneActivity;
+import org.linphone.LinphoneManager;
+import org.linphone.core.LinphoneCall;
+import org.linphone.core.LinphoneCoreException;
+
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.util.DisplayMetrics;
+import android.view.View;
+
+/**
+ * @author Sylvain Berfini
+ */
+public class CallsAudio extends SampleTest {
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testAInit() {
+ //Disable video
+ goToSettings();
+
+ selectItemInListOnUIThread(3);
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_enable_title));
+ solo.sleep(500);
+
+ solo.goBack();
+ solo.sleep(1000);
+ Assert.assertFalse(LinphoneManager.getLc().isVideoEnabled());
+ }
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testBOutgoingCallWithDefaultConfig() {
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testCDTMFRFC2833InPCMUCall() {
+ disableAllEnabledAudioCodecs();
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcmu));
+ goBackToDialerAfterCodecChanges();
+ solo.sleep(1000);
+
+ LinphoneManager.getLc().setUseRfc2833ForDtmfs(true);
+ LinphoneManager.getLc().setUseSipInfoForDtmfs(false);
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Digit3));
+ solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
+
+ solo.sleep(1000);
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+
+ //To enable when issue http://git.linphone.org/mantis/view.php?id=750 will be fixed
+ //Assert.assertTrue(LinphoneTestManager.getInstance().isDTMFReceived);
+ LinphoneTestManager.getInstance().isDTMFReceived = false;
+
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testDDTMFSIPINFO() {
+ LinphoneManager.getLc().setUseRfc2833ForDtmfs(false);
+ LinphoneManager.getLc().setUseSipInfoForDtmfs(true);
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Digit3));
+ solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
+
+ solo.sleep(1000);
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+
+ //To enable when issue http://git.linphone.org/mantis/view.php?id=751 will be fixed
+ //Assert.assertTrue(LinphoneTestManager.getInstance().isDTMFReceived);
+ LinphoneTestManager.getInstance().isDTMFReceived = false;
+
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testEOutgoingCallToAudioClient() {
+ LinphoneTestManager.getLc().enableVideo(false, false);
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testFOutgoingCallToVideoClient() {
+ LinphoneTestManager.getLc().enableVideo(true, true);
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testGOutgoingCallCancelled() {
+ LinphoneTestManager.getInstance().autoAnswer = false;
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ solo.waitForActivity("InCallActivity", 5000);
+ solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
+
+ solo.sleep(2000);
+ Assert.assertEquals(LinphoneCall.State.OutgoingRinging, LinphoneManager.getLc().getCalls()[0].getState());
+
+ LinphoneTestManager.getInstance().autoAnswer = true;
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testHOutgoingCallDeclined() {
+ LinphoneTestManager.getInstance().autoAnswer = true; // Just in case
+ LinphoneTestManager.getInstance().declineCall = true;
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ solo.sleep(500);
+ Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.error_call_declined)));
+
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ LinphoneTestManager.getInstance().declineCall = false;
+ }
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testIIncomingAudioCall() {
+ LinphoneTestManager.getInstance().declineCall = false; // Just in case
+ LinphoneTestManager.getLc().enableVideo(false, false);
+
+ solo.sleep(2000);
+ try {
+ LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
+ } catch (LinphoneCoreException e) {
+ e.printStackTrace();
+ }
+
+ solo.waitForActivity("IncomingCallActivity", 5000);
+ solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
+
+ solo.sleep(1000);
+ View topLayout = solo.getView(org.linphone.R.id.topLayout);
+ int topLayoutHeigh = topLayout.getMeasuredHeight();
+ DisplayMetrics dm = new DisplayMetrics();
+ getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
+ int topOffset = dm.heightPixels - topLayoutHeigh;
+ int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
+ solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);
+
+ assertCallIsCorrectlyRunning();
+ }
+
+ @LargeTest
+ public void testJIncomingVideoCall() {
+ LinphoneTestManager.getLc().enableVideo(true, true);
+
+ solo.sleep(2000);
+ try {
+ LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
+ } catch (LinphoneCoreException e) {
+ e.printStackTrace();
+ }
+
+ solo.waitForActivity("IncomingCallActivity", 5000);
+ solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
+
+ solo.sleep(1000);
+ View topLayout = solo.getView(org.linphone.R.id.topLayout);
+ int topLayoutHeigh = topLayout.getMeasuredHeight();
+ DisplayMetrics dm = new DisplayMetrics();
+ getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
+ int topOffset = dm.heightPixels - topLayoutHeigh;
+ int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
+ solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);
+
+ assertCallIsCorrectlyRunning();
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testKSelfPauseResumeCall() {
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.pause));
+ LinphoneCall.State state = LinphoneManager.getLc().getCalls()[0].getState();
+ solo.sleep(1000);
+
+ Assert.assertTrue(LinphoneCall.State.Paused == state || LinphoneCall.State.Pausing == state);
+ solo.clickOnView(solo.getView(org.linphone.R.id.pause));
+ solo.sleep(1000);
+
+ state = LinphoneManager.getLc().getCalls()[0].getState();
+ Assert.assertTrue(LinphoneCall.State.Resuming == state || LinphoneCall.State.StreamsRunning == state);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testLRemotePauseResumeCall() {
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ LinphoneTestManager.getLc().pauseAllCalls();
+ solo.sleep(1000);
+
+ Assert.assertEquals(LinphoneCall.State.PausedByRemote, LinphoneManager.getLc().getCalls()[0].getState());
+ LinphoneTestManager.getLc().resumeCall(LinphoneTestManager.getLc().getCalls()[0]);
+ solo.sleep(1000);
+
+ LinphoneCall.State state = LinphoneManager.getLc().getCalls()[0].getState();
+ Assert.assertTrue(LinphoneCall.State.Resuming == state || LinphoneCall.State.StreamsRunning == state);
+
+ solo.clickLongOnScreen(200, 200); //To ensure controls are shown
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @LargeTest
+ public void testMSwitchOnVideoInCallIsNotAllowed() {
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ Assert.assertFalse(solo.getView(org.linphone.R.id.video).isEnabled());
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @LargeTest
+ public void testNDeclineIncomingCall() {
+ LinphoneTestManager.getInstance().declineCall = false; // Just in case
+ LinphoneTestManager.getLc().enableVideo(false, false);
+
+ solo.sleep(2000);
+ try {
+ LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
+ } catch (LinphoneCoreException e) {
+ e.printStackTrace();
+ }
+
+ solo.waitForActivity("IncomingCallActivity", 5000);
+ solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
+
+ solo.sleep(1000);
+ View topLayout = solo.getView(org.linphone.R.id.topLayout);
+ int topLayoutHeigh = topLayout.getMeasuredHeight();
+ DisplayMetrics dm = new DisplayMetrics();
+ getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
+ int topOffset = dm.heightPixels - topLayoutHeigh;
+ int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
+ solo.drag(topLayout.getMeasuredWidth() - 10, 10, slidersTop, slidersTop, 10);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testOCancelledIncomingCall() {
+ LinphoneTestManager.getInstance().declineCall = false; // Just in case
+ LinphoneTestManager.getLc().enableVideo(false, false);
+
+ solo.sleep(2000);
+ try {
+ LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
+ } catch (LinphoneCoreException e) {
+ e.printStackTrace();
+ }
+
+ solo.waitForActivity("IncomingCallActivity", 5000);
+ solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
+
+ LinphoneTestManager.getLc().terminateAllCalls();
+
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testPDisplayMissedCallsNumber() {
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ Assert.assertTrue(solo.searchText("1"));
+ }
+
+ //TODO: Test each audio codec
+
+ private void assertCallIsCorrectlyRunning() {
+ solo.waitForActivity("InCallActivity", 5000);
+ solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
+
+ solo.sleep(2000);
+ LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
+
+ if (call.getState() == LinphoneCall.State.OutgoingProgress) {
+ solo.sleep(3000);
+ }
+
+ Assert.assertEquals(LinphoneCall.State.StreamsRunning, call.getState());
+ }
+
+ private void goToSettings() {
+ solo.waitForActivity("LinphoneActivity", 2000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.settings));
+ }
+
+ private void goToAudioCodecsSettings() {
+ goToSettings();
+
+ selectItemInListOnUIThread(4);
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_audio));
+ solo.sleep(500);
+ }
+
+ private void disableAllEnabledAudioCodecs() {
+ goToAudioCodecsSettings();
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(aContext);
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_speex16_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_speex16_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_speex16));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_speex8_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_speex8_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_speex8));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_ilbc_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_ilbc_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_ilbc));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_amr_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_amr_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_amr));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_amrwb_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_amrwb_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_amrwb));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_g729_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_g729_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_g729));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_gsm_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_gsm_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_gsm));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_g722_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_g722_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_g722));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_silk24_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_silk24_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_silk24));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_silk16_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_silk16_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_silk16));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_pcmu_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_pcmu_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcmu));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_pcma_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_pcma_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcma));
+ solo.sleep(500);
+ }
+ }
+
+ private void goBackToDialerAfterCodecChanges() {
+ solo.goBack();
+ solo.goBack();
+
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+}
diff --git a/tests/src/org/linphone/test/CallsVideo.java b/tests/src/org/linphone/test/CallsVideo.java
new file mode 100644
index 000000000..f3c6afa82
--- /dev/null
+++ b/tests/src/org/linphone/test/CallsVideo.java
@@ -0,0 +1,435 @@
+package org.linphone.test;
+
+import junit.framework.Assert;
+
+import org.linphone.InCallActivity;
+import org.linphone.IncomingCallActivity;
+import org.linphone.LinphoneActivity;
+import org.linphone.LinphoneManager;
+import org.linphone.core.LinphoneCall;
+import org.linphone.core.LinphoneCoreException;
+
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.util.DisplayMetrics;
+import android.view.View;
+
+/**
+ * @author Sylvain Berfini
+ */
+public class CallsVideo extends SampleTest {
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testAInit() {
+ //Disable video
+ goToSettings();
+
+ selectItemInListOnUIThread(3);
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_enable_title));
+ solo.sleep(500);
+
+ solo.goBack();
+ solo.sleep(1000);
+ Assert.assertTrue(LinphoneManager.getLc().isVideoEnabled());
+ }
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testBOutgoingCallWithDefaultConfig() {
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testCDTMFRFC2833InPCMUCall() {
+ disableAllEnabledAudioCodecs();
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcmu));
+ goBackToDialerAfterCodecChanges();
+ solo.sleep(1000);
+
+ LinphoneManager.getLc().setUseRfc2833ForDtmfs(true);
+ LinphoneManager.getLc().setUseSipInfoForDtmfs(false);
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Digit3));
+ solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
+
+ solo.sleep(1000);
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+
+ //To enable when issue http://git.linphone.org/mantis/view.php?id=750 will be fixed
+ //Assert.assertTrue(LinphoneTestManager.getInstance().isDTMFReceived);
+ LinphoneTestManager.getInstance().isDTMFReceived = false;
+
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testDDTMFSIPINFO() {
+ LinphoneManager.getLc().setUseRfc2833ForDtmfs(false);
+ LinphoneManager.getLc().setUseSipInfoForDtmfs(true);
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Digit3));
+ solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
+
+ solo.sleep(1000);
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+
+ //To enable when issue http://git.linphone.org/mantis/view.php?id=751 will be fixed
+ //Assert.assertTrue(LinphoneTestManager.getInstance().isDTMFReceived);
+ LinphoneTestManager.getInstance().isDTMFReceived = false;
+
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testEOutgoingCallToAudioClient() {
+ LinphoneTestManager.getLc().enableVideo(false, false);
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testFOutgoingCallToVideoClient() {
+ LinphoneTestManager.getLc().enableVideo(true, true);
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testGOutgoingCallCancelled() {
+ LinphoneTestManager.getInstance().autoAnswer = false;
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ solo.waitForActivity("InCallActivity", 5000);
+ solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
+
+ solo.sleep(2000);
+ Assert.assertEquals(LinphoneCall.State.OutgoingRinging, LinphoneManager.getLc().getCalls()[0].getState());
+
+ LinphoneTestManager.getInstance().autoAnswer = true;
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testHOutgoingCallDeclined() {
+ LinphoneTestManager.getInstance().autoAnswer = true; // Just in case
+ LinphoneTestManager.getInstance().declineCall = true;
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ solo.sleep(500);
+ Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.error_call_declined)));
+
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ LinphoneTestManager.getInstance().declineCall = false;
+ }
+
+ @LargeTest
+ public void testIIncomingAudioCall() {
+ LinphoneTestManager.getInstance().declineCall = false; // Just in case
+ LinphoneTestManager.getLc().enableVideo(false, false);
+
+ solo.sleep(2000);
+ try {
+ LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
+ } catch (LinphoneCoreException e) {
+ e.printStackTrace();
+ }
+
+ solo.waitForActivity("IncomingCallActivity", 5000);
+ solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
+
+ solo.sleep(1000);
+ View topLayout = solo.getView(org.linphone.R.id.topLayout);
+ int topLayoutHeigh = topLayout.getMeasuredHeight();
+ DisplayMetrics dm = new DisplayMetrics();
+ getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
+ int topOffset = dm.heightPixels - topLayoutHeigh;
+ int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
+ solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);
+
+ assertCallIsCorrectlyRunning();
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testJIncomingVideoCall() {
+ LinphoneTestManager.getLc().enableVideo(true, true);
+
+ solo.sleep(2000);
+ try {
+ LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
+ } catch (LinphoneCoreException e) {
+ e.printStackTrace();
+ }
+
+ solo.waitForActivity("IncomingCallActivity", 5000);
+ solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
+
+ solo.sleep(1000);
+ View topLayout = solo.getView(org.linphone.R.id.topLayout);
+ int topLayoutHeigh = topLayout.getMeasuredHeight();
+ DisplayMetrics dm = new DisplayMetrics();
+ getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
+ int topOffset = dm.heightPixels - topLayoutHeigh;
+ int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
+ solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);
+
+ assertCallIsCorrectlyRunning();
+ }
+
+ //TODO: Test each video codec
+
+ @MediumTest
+ @LargeTest
+ public void testKSelfPauseResumeCall() {
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.pause));
+ LinphoneCall.State state = LinphoneManager.getLc().getCalls()[0].getState();
+ solo.sleep(1000);
+
+ Assert.assertTrue(LinphoneCall.State.Paused == state || LinphoneCall.State.Pausing == state);
+ solo.clickOnView(solo.getView(org.linphone.R.id.pause));
+ solo.sleep(1000);
+
+ state = LinphoneManager.getLc().getCalls()[0].getState();
+ Assert.assertTrue(LinphoneCall.State.Resuming == state || LinphoneCall.State.StreamsRunning == state);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testLRemotePauseResumeCall() {
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ LinphoneTestManager.getLc().pauseAllCalls();
+ solo.sleep(1000);
+
+ Assert.assertEquals(LinphoneCall.State.PausedByRemote, LinphoneManager.getLc().getCalls()[0].getState());
+ LinphoneTestManager.getLc().resumeCall(LinphoneTestManager.getLc().getCalls()[0]);
+ solo.sleep(1000);
+
+ LinphoneCall.State state = LinphoneManager.getLc().getCalls()[0].getState();
+ Assert.assertTrue(LinphoneCall.State.Resuming == state || LinphoneCall.State.StreamsRunning == state);
+
+ solo.clickLongOnScreen(200, 200); //To ensure controls are shown
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testMSwitchOffVideoInCall() {
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning();
+
+ Assert.assertTrue(solo.getView(org.linphone.R.id.video).isEnabled());
+ solo.clickOnView(solo.getView(org.linphone.R.id.video));
+ Assert.assertFalse(LinphoneManager.getLc().getCurrentCall().cameraEnabled());
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ private void assertCallIsCorrectlyRunning() {
+ solo.waitForActivity("InCallActivity", 5000);
+ solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
+
+ solo.sleep(2000);
+ LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
+
+ if (call.getState() == LinphoneCall.State.OutgoingProgress) {
+ solo.sleep(3000);
+ }
+
+ Assert.assertEquals(LinphoneCall.State.StreamsRunning, call.getState());
+ }
+
+ private void goToSettings() {
+ solo.waitForActivity("LinphoneActivity", 2000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.settings));
+ }
+
+ private void goToAudioCodecsSettings() {
+ goToSettings();
+
+ selectItemInListOnUIThread(4);
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_audio));
+ solo.sleep(500);
+ }
+
+ private void goToVideoCodecsSettings() {
+ goToSettings();
+
+ selectItemInListOnUIThread(6);
+ if (solo.searchText(aContext.getString(org.linphone.R.string.pref_video), 2)) // Needed in case pref_video_enable_title contains pref_video
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video), 2);
+ else
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video));
+ solo.sleep(500);
+ }
+
+ private void disableAllEnabledAudioCodecs() {
+ goToAudioCodecsSettings();
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(aContext);
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_speex16_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_speex16_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_speex16));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_speex8_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_speex8_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_speex8));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_ilbc_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_ilbc_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_ilbc));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_amr_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_amr_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_amr));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_amrwb_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_amrwb_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_amrwb));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_g729_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_g729_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_g729));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_gsm_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_gsm_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_gsm));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_g722_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_g722_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_g722));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_silk24_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_silk24_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_silk24));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_silk16_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_silk16_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_silk16));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_pcmu_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_pcmu_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcmu));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_pcma_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_pcma_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcma));
+ solo.sleep(500);
+ }
+ }
+
+ private void disableAllEnabledVideoCodecs() {
+ goToVideoCodecsSettings();
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(aContext);
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_video_codec_vp8_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_video_codec_vp8_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_vp8_title));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_video_codec_h264_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_video_codec_h264_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_h264_title));
+ solo.sleep(500);
+ }
+
+ if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_video_codec_mpeg4_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_video_codec_mpeg4_default))) {
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_mpeg4_title));
+ solo.sleep(500);
+ }
+ }
+
+ private void goBackToDialerAfterCodecChanges()
+ {
+ solo.goBack();
+ solo.goBack();
+
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+}
diff --git a/tests/src/org/linphone/test/Chat.java b/tests/src/org/linphone/test/Chat.java
new file mode 100644
index 000000000..35954c728
--- /dev/null
+++ b/tests/src/org/linphone/test/Chat.java
@@ -0,0 +1,105 @@
+package org.linphone.test;
+
+import junit.framework.Assert;
+
+import org.linphone.LinphoneActivity;
+import org.linphone.core.LinphoneChatMessage;
+import org.linphone.core.LinphoneChatMessage.State;
+import org.linphone.core.LinphoneChatRoom;
+import org.linphone.mediastream.Log;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+
+/**
+ * @author Sylvain Berfini
+ */
+public class Chat extends SampleTest {
+
+ @LargeTest
+ public void testBEmptyChatHistory() {
+ goToChat();
+
+ Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_chat_history)));
+ }
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testCSendTextMessage() {
+ goToChat();
+
+ solo.enterText(0, "sip:" + iContext.getString(R.string.account_test_calls_login) + "@" + iContext.getString(R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.newDiscussion));
+
+ solo.enterText(0, iContext.getString(R.string.chat_test_text_sent));
+ solo.clickOnView(solo.getView(org.linphone.R.id.sendMessage));
+
+ solo.sleep(1000);
+ Assert.assertTrue(solo.searchText(iContext.getString(R.string.chat_test_text_sent)));
+ Assert.assertEquals(iContext.getString(R.string.chat_test_text_sent), LinphoneTestManager.getInstance().lastMessageReceived);
+ }
+
+ @LargeTest
+ public void testDNotEmptyChatHistory() {
+ goToChat();
+
+ Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.account_test_calls_login)));
+ }
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testEReceiveTextMessage() {
+ goToChat();
+ solo.clickOnText(iContext.getString(org.linphone.test.R.string.account_test_calls_login));
+
+ LinphoneChatRoom chatRoom = LinphoneTestManager.getLc().createChatRoom("sip:" + iContext.getString(R.string.account_linphone_login) + "@" + iContext.getString(R.string.account_linphone_domain));
+ LinphoneChatMessage msg = chatRoom.createLinphoneChatMessage(iContext.getString(R.string.chat_test_text_received));
+ chatRoom.sendMessage(msg, new LinphoneChatMessage.StateListener() {
+ @Override
+ public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg,
+ State state) {
+ Log.e("Chat message state = " + state.toString());
+ }
+ });
+
+ solo.sleep(1000);
+ Assert.assertTrue(solo.searchText(iContext.getString(R.string.chat_test_text_received)));
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testFDeleteMessage() {
+ goToChat();
+ solo.clickOnText(iContext.getString(org.linphone.test.R.string.account_test_calls_login));
+
+ solo.clickLongOnText(iContext.getString(R.string.chat_test_text_received));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.delete));
+
+ solo.sleep(1000);
+ Assert.assertFalse(solo.searchText(iContext.getString(R.string.chat_test_text_received)));
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testGDeleteConversation() {
+ goToChat();
+
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_edit));
+ solo.clickOnView(solo.getView(org.linphone.R.id.delete));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_ok));
+
+ solo.sleep(1000);
+ Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_chat_history)));
+ }
+
+ private void goToChat() {
+ solo.waitForActivity("LinphoneActivity", 2000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.chat));
+ }
+
+}
diff --git a/tests/src/org/linphone/test/ChatTest.java b/tests/src/org/linphone/test/ChatTest.java
deleted file mode 100644
index f48d0cc27..000000000
--- a/tests/src/org/linphone/test/ChatTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.linphone.test;
-
-import junit.framework.Assert;
-
-import org.linphone.LinphoneActivity;
-import org.linphone.R;
-
-import android.content.Context;
-import android.test.ActivityInstrumentationTestCase2;
-import android.widget.EditText;
-
-import com.jayway.android.robotium.solo.Solo;
-
-public class ChatTest extends ActivityInstrumentationTestCase2 {
-
- private static final String testTextMessage = "Test";
- private Solo solo;
-
- @SuppressWarnings("deprecation")
- public ChatTest() {
- super("org.linphone", LinphoneActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- solo = new Solo(getInstrumentation(), getActivity());
- }
-
- public void testADisplayEmptyChatList() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.chat));
-
- Assert.assertTrue(solo.searchText(context.getString(R.string.no_chat_history)));
- Log.testSuccess("Empty chat list displayed");
- }
-
- public void testBStartConversationAndSaveItAsDraft() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.chat));
-
- solo.enterText((EditText) solo.getView(R.id.newFastChat), "cotcot@sip.linphone.org");
- solo.clickOnText(context.getString(R.string.button_new_chat));
- solo.sleep(1000);
-
- solo.enterText((EditText) solo.getView(R.id.message), testTextMessage);
- solo.goBack();
- solo.sleep(1000);
- Assert.assertTrue(solo.searchText(context.getString(R.string.draft)));
- Log.testSuccess("Conversation created and message saved as draft");
- }
-
- public void testCUseSavedDraftMessageAndSentIt() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.chat));
-
- solo.clickOnText(context.getString(R.string.draft));
- Assert.assertTrue(solo.searchText(testTextMessage));
- Log.testSuccess("Draft successfully restored");
-
- solo.clickOnText(context.getString(R.string.button_send_message));
- solo.sleep(1000);
- Assert.assertTrue(solo.searchText(testTextMessage));
- Log.testSuccess("Chat message sent");
-
- solo.goBack();
- solo.sleep(1000);
- Assert.assertTrue(solo.searchText("cotcot"));
- Assert.assertFalse(solo.searchText(context.getString(R.string.draft), true));
- Log.testSuccess("Conversation created but no more saved as draft");
- }
-
- public void testDDeleteMessage() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.chat));
-
- solo.clickOnText("cotcot");
- Assert.assertTrue(solo.searchText(testTextMessage));
- solo.clickLongOnText(testTextMessage);
- solo.sleep(1000);
-
- solo.clickOnText(context.getString(R.string.delete));
- solo.sleep(1000);
- Assert.assertFalse(solo.searchText(testTextMessage));
- Log.testSuccess("Chat message successfully deleted");
- }
-
- public void testEIncomingMessageAndDeleteConversation() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.chat));
-
- solo.enterText((EditText) solo.getView(R.id.newFastChat), "junit");
- solo.clickOnText(context.getString(R.string.button_new_chat));
- solo.sleep(1000);
-
- solo.enterText((EditText) solo.getView(R.id.message), testTextMessage);
- solo.clickOnText(context.getString(R.string.button_send_message));
- solo.sleep(1000);
-
- Assert.assertTrue(solo.searchText(testTextMessage, 2));
- Log.testSuccess("Chat message successfully received");
-
- solo.goBack();
- Assert.assertTrue(solo.searchText("junit", 2));
- solo.clickOnView(solo.getView(R.id.clearFastChatField));
- EditText fastChat = (EditText) solo.getView(R.id.newFastChat);
- Assert.assertEquals(fastChat.getText().toString(), "");
- Log.testSuccess("Fast new chat cleaned");
-
- solo.clickOnText(context.getString(R.string.button_edit));
- solo.clickOnText("junit");
- solo.clickOnText(context.getString(R.string.button_ok));
- solo.sleep(1000);
-
- Assert.assertTrue(solo.searchText(context.getString(R.string.no_chat_history)));
- Log.testSuccess("Conversation successfully deleted");
- }
-
- @Override
- public void tearDown() throws Exception {
- solo.finishOpenedActivities();
- }
-}
diff --git a/tests/src/org/linphone/test/ConferenceAndMultiCall.java b/tests/src/org/linphone/test/ConferenceAndMultiCall.java
new file mode 100644
index 000000000..cb26cd0f4
--- /dev/null
+++ b/tests/src/org/linphone/test/ConferenceAndMultiCall.java
@@ -0,0 +1,293 @@
+package org.linphone.test;
+
+import java.util.ArrayList;
+
+import junit.framework.Assert;
+
+import org.linphone.InCallActivity;
+import org.linphone.IncomingCallActivity;
+import org.linphone.LinphoneActivity;
+import org.linphone.LinphoneManager;
+import org.linphone.core.LinphoneCall;
+import org.linphone.core.LinphoneCore.RegistrationState;
+import org.linphone.core.LinphoneCoreException;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.util.DisplayMetrics;
+import android.view.View;
+
+public class ConferenceAndMultiCall extends SampleTest {
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testAInit() {
+ LinphoneTestManager.createAndStart(aContext, iContext, 2);
+
+ solo.sleep(2000);
+ Assert.assertEquals(RegistrationState.RegistrationOk, LinphoneTestManager.getLc(2).getProxyConfigList()[0].getState());
+
+ //Disable video
+ goToSettings();
+
+ selectItemInListOnUIThread(3);
+ solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_enable_title));
+ solo.sleep(500);
+
+ solo.goBack();
+ solo.sleep(1000);
+ Assert.assertFalse(LinphoneManager.getLc().isVideoEnabled());
+ }
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testBSimpleConference() {
+ startConference();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @LargeTest
+ public void testCRemoveOneFromConference() {
+ startConference();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.callStatus));
+
+ Assert.assertEquals(1, LinphoneTestManager.getLc(1).getCallsNb());
+ Assert.assertEquals(1, LinphoneTestManager.getLc(2).getCallsNb());
+ Assert.assertEquals(2, LinphoneManager.getLc().getCallsNb());
+ Assert.assertFalse(LinphoneManager.getLc().isInConference());
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.sleep(1000);
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @LargeTest
+ public void testDChangePausedCall() {
+ startTwoCalls();
+
+ solo.sleep(2000);
+ LinphoneCall call1 = LinphoneTestManager.getLc(1).getCalls()[0];
+ LinphoneCall call2 = LinphoneTestManager.getLc(2).getCalls()[0];
+ Assert.assertEquals(LinphoneCall.State.StreamsRunning, call2.getState());
+ Assert.assertEquals(LinphoneCall.State.PausedByRemote, call1.getState());
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.callStatus));
+ solo.sleep(2000);
+ Assert.assertEquals(LinphoneCall.State.StreamsRunning, call1.getState());
+ Assert.assertEquals(LinphoneCall.State.PausedByRemote, call2.getState());
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.sleep(1000);
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @LargeTest
+ public void testEPauseAllCalls() {
+ startTwoCalls();
+
+ solo.sleep(2000);
+ LinphoneCall call1 = LinphoneTestManager.getLc(1).getCalls()[0];
+ LinphoneCall call2 = LinphoneTestManager.getLc(2).getCalls()[0];
+ Assert.assertEquals(LinphoneCall.State.StreamsRunning, call2.getState());
+ Assert.assertEquals(LinphoneCall.State.PausedByRemote, call1.getState());
+
+ ArrayList views = solo.getViews(solo.getView(2));
+ solo.clickOnView(views.get(2)); // Second call pause button
+ solo.sleep(2000);
+ Assert.assertEquals(LinphoneCall.State.PausedByRemote, call1.getState());
+ Assert.assertEquals(LinphoneCall.State.PausedByRemote, call2.getState());
+
+ // All calls are paused, one click on hangUp terminates them all
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @LargeTest
+ public void testFAddNewCallAndCancelIt() {
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning(1);
+ LinphoneTestManager.getInstance().autoAnswer = false;
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.options));
+ solo.clickOnView(solo.getView(org.linphone.R.id.addCall));
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.conference_account_login) + "@" + iContext.getString(org.linphone.test.R.string.conference_account_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ solo.sleep(2000);
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+
+ Assert.assertEquals(LinphoneCall.State.PausedByRemote, LinphoneTestManager.getLc(1).getCalls()[0].getState());
+ solo.clickOnView(solo.getView(org.linphone.R.id.pause));
+ solo.sleep(1000);
+ Assert.assertEquals(LinphoneCall.State.StreamsRunning, LinphoneTestManager.getLc(1).getCalls()[0].getState());
+
+ solo.sleep(1000);
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ LinphoneTestManager.getInstance().autoAnswer = true;
+ }
+
+ @LargeTest
+ public void testGAddNewCallDeclined() {
+ LinphoneTestManager.getInstance().autoAnswer = true; // Just in case
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning(1);
+ LinphoneTestManager.getInstance().declineCall = true;
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.options));
+ solo.clickOnView(solo.getView(org.linphone.R.id.addCall));
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.conference_account_login) + "@" + iContext.getString(org.linphone.test.R.string.conference_account_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ solo.sleep(2000);
+ Assert.assertEquals(LinphoneCall.State.PausedByRemote, LinphoneTestManager.getLc(1).getCalls()[0].getState());
+
+ solo.sleep(1000);
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ LinphoneTestManager.getInstance().declineCall = false;
+ }
+
+ @LargeTest
+ public void testHIncomingCallWhileInCallAndDecline() {
+ LinphoneTestManager.getInstance().declineCall = false; //Just in case
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning(1);
+
+ solo.sleep(2000);
+ try {
+ LinphoneTestManager.getLc(2).invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
+ } catch (LinphoneCoreException e) {
+ e.printStackTrace();
+ }
+
+ solo.waitForActivity("IncomingCallActivity", 5000);
+ solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
+
+ solo.sleep(1000);
+ View topLayout = solo.getView(org.linphone.R.id.topLayout);
+ int topLayoutHeigh = topLayout.getMeasuredHeight();
+ DisplayMetrics dm = new DisplayMetrics();
+ getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
+ int topOffset = dm.heightPixels - topLayoutHeigh;
+ int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
+ solo.drag(topLayout.getMeasuredWidth() - 10, 10, slidersTop, slidersTop, 10);
+
+ assertCallIsCorrectlyRunning(1);
+
+ solo.sleep(2000);
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @LargeTest
+ public void testIIncomingCallWhileInCallAndAccept() {
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning(1);
+
+ solo.sleep(2000);
+ try {
+ LinphoneTestManager.getLc(2).invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
+ } catch (LinphoneCoreException e) {
+ e.printStackTrace();
+ }
+
+ solo.waitForActivity("IncomingCallActivity", 5000);
+ solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
+
+ solo.sleep(1000);
+ View topLayout = solo.getView(org.linphone.R.id.topLayout);
+ int topLayoutHeigh = topLayout.getMeasuredHeight();
+ DisplayMetrics dm = new DisplayMetrics();
+ getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
+ int topOffset = dm.heightPixels - topLayoutHeigh;
+ int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
+ solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);
+
+ solo.sleep(1000);
+ LinphoneCall call1 = LinphoneTestManager.getLc(1).getCalls()[0];
+ Assert.assertEquals(LinphoneCall.State.PausedByRemote, call1.getState());
+ assertCallIsCorrectlyRunning(2);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.sleep(1000);
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ private void goToSettings() {
+ solo.waitForActivity("LinphoneActivity", 2000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.settings));
+ }
+
+ private void startTwoCalls() {
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning(1);
+ solo.clickOnView(solo.getView(org.linphone.R.id.options));
+ solo.clickOnView(solo.getView(org.linphone.R.id.addCall));
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.conference_account_login) + "@" + iContext.getString(org.linphone.test.R.string.conference_account_domain));
+ solo.clickOnView(solo.getView(org.linphone.R.id.Call));
+
+ assertCallIsCorrectlyRunning(2);
+ }
+
+ private void startConference() {
+ startTwoCalls();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.conference));
+ solo.sleep(1000);
+
+ assertCallIsCorrectlyRunning(1);
+ assertCallIsCorrectlyRunning(2);
+ Assert.assertTrue(LinphoneManager.getLc().isInConference());
+ }
+
+ private void assertCallIsCorrectlyRunning(int lcId) {
+ solo.waitForActivity("InCallActivity", 5000);
+ solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
+
+ solo.sleep(2000);
+ LinphoneCall call = LinphoneTestManager.getLc(lcId).getCalls()[0];
+
+ if (call.getState() == LinphoneCall.State.OutgoingProgress || call.getState() == LinphoneCall.State.IncomingReceived) {
+ solo.sleep(3000);
+ }
+
+ Assert.assertEquals(LinphoneCall.State.StreamsRunning, call.getState());
+ }
+}
diff --git a/tests/src/org/linphone/test/Contacts.java b/tests/src/org/linphone/test/Contacts.java
new file mode 100644
index 000000000..2aec197fa
--- /dev/null
+++ b/tests/src/org/linphone/test/Contacts.java
@@ -0,0 +1,125 @@
+package org.linphone.test;
+
+import junit.framework.Assert;
+
+import org.linphone.LinphoneActivity;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+
+/**
+ * @author Sylvain Berfini
+ */
+public class Contacts extends SampleTest {
+
+ @MediumTest
+ @LargeTest
+ public void testAAddContactFromHistoryAndDeleteIt() {
+ goToHistory();
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.detail));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.add_to_contacts));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_add_contact));
+
+ Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain)));
+
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.contact_name));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_ok));
+
+ Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_name)));
+
+ solo.clickOnText(iContext.getString(org.linphone.test.R.string.contact_name));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_edit));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.delete_contact));
+
+ Assert.assertFalse(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_name)));
+ }
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testBCreateContactWithPhoneNumber() {
+ goToContacts();
+
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_add_contact));
+ solo.enterText(0, iContext.getString(org.linphone.test.R.string.contact_name));
+ solo.enterText(2, iContext.getString(org.linphone.test.R.string.contact_number));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_ok));
+
+ Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_name)));
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testCTestContactFilter1() {
+ goToContacts();
+
+ Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_name)));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_sip_contacts));
+ Assert.assertFalse(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_name)));
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testDEditContactAddSipAddressAndRemoveNumber() {
+ goToContacts();
+
+ solo.clickOnText(iContext.getString(org.linphone.test.R.string.contact_name));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_edit));
+ solo.clickOnView(solo.getView(org.linphone.R.id.delete));
+ solo.enterText(3, iContext.getString(org.linphone.test.R.string.contact_sip));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_ok));
+
+ Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_sip)));
+ Assert.assertFalse(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_number)));
+
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testETestContactFilter2() {
+ goToContacts();
+
+ Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_name)));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_sip_contacts));
+ Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_name)));
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testFStartChatFromContact() {
+ goToContacts();
+
+ solo.clickOnText(iContext.getString(org.linphone.test.R.string.contact_name));
+ solo.clickOnView(solo.getView(org.linphone.R.id.start_chat));
+ Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.button_send_message)));
+ }
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testGDeleteContact() {
+ goToContacts();
+
+ solo.clickOnText(iContext.getString(org.linphone.test.R.string.contact_name));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_edit));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.delete_contact));
+
+ Assert.assertFalse(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_name)));
+ }
+
+ private void goToContacts() {
+ solo.waitForActivity("LinphoneActivity", 2000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.contacts));
+ }
+
+ private void goToHistory() {
+ solo.waitForActivity("LinphoneActivity", 2000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.history));
+ }
+}
diff --git a/tests/src/org/linphone/test/History.java b/tests/src/org/linphone/test/History.java
new file mode 100644
index 000000000..745996279
--- /dev/null
+++ b/tests/src/org/linphone/test/History.java
@@ -0,0 +1,82 @@
+package org.linphone.test;
+
+import junit.framework.Assert;
+
+import org.linphone.InCallActivity;
+import org.linphone.LinphoneActivity;
+import org.linphone.core.LinphoneCall;
+
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+
+/**
+ * @author Sylvain Berfini
+ */
+public class History extends SampleTest {
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testACheckForTestCallInHistory() {
+ goToHistory();
+
+ Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.today)));
+ Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.account_test_calls_login)));
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testBFilterMissedCalls() {
+ goToHistory();
+
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_missed_call));
+ Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_missed_call_history)));
+ }
+
+ public void testCCallBackFromHistory() {
+ goToHistory();
+
+ solo.clickOnText(iContext.getString(org.linphone.test.R.string.account_test_calls_login));
+
+ solo.waitForActivity("InCallActivity", 5000);
+ solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
+
+ solo.sleep(2000);
+ Assert.assertEquals(1, LinphoneTestManager.getLc().getCallsNb());
+ Assert.assertEquals(LinphoneCall.State.StreamsRunning, LinphoneTestManager.getLc().getCalls()[0].getState());
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
+ solo.waitForActivity("LinphoneActivity", 5000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+ }
+
+ @MediumTest
+ @LargeTest
+ public void testDDeleteOne() {
+ goToHistory();
+
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_edit));
+ solo.clickOnView(solo.getView(org.linphone.R.id.delete));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_ok));
+ }
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testEDeleteAll() {
+ goToHistory();
+
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_edit));
+ solo.clickOnView(solo.getView(org.linphone.R.id.deleteAll));
+ solo.clickOnText(aContext.getString(org.linphone.R.string.button_ok));
+ Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_call_history)));
+ }
+
+ private void goToHistory() {
+ solo.waitForActivity("LinphoneActivity", 2000);
+ solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
+
+ solo.clickOnView(solo.getView(org.linphone.R.id.history));
+ }
+}
diff --git a/tests/src/org/linphone/test/HistoryTest.java b/tests/src/org/linphone/test/HistoryTest.java
deleted file mode 100644
index ac102d9b8..000000000
--- a/tests/src/org/linphone/test/HistoryTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package org.linphone.test;
-
-import junit.framework.Assert;
-
-import org.linphone.InCallActivity;
-import org.linphone.LinphoneActivity;
-import org.linphone.LinphoneManager;
-import org.linphone.R;
-
-import android.content.Context;
-import android.test.ActivityInstrumentationTestCase2;
-import android.widget.EditText;
-import android.widget.ListView;
-
-import com.jayway.android.robotium.solo.Solo;
-
-public class HistoryTest extends ActivityInstrumentationTestCase2 {
-
- private Solo solo;
-
- @SuppressWarnings("deprecation")
- public HistoryTest() {
- super("org.linphone", LinphoneActivity.class);
- }
-
- private void selectItemInListOnUIThread(final int item) {
- solo.sleep(500);
- getActivity().runOnUiThread(new Runnable() {
- public void run() {
- ListView list = (ListView) solo.getView(android.R.id.list);
- list.setSelection(item);
- }
- });
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- solo = new Solo(getInstrumentation(), getActivity());
-
- //Depending on previous tests, history may not be empty
- LinphoneManager.getLc().clearCallLogs();
- }
-
- public void testADisplayEmptyHistory() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.history));
-
- Assert.assertTrue(solo.searchText(context.getString(R.string.no_call_history)));
- Log.testSuccess("Empty History displayed");
- }
-
- public void testBCallToFillHistory() {
- Context context = getActivity();
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
-
- solo.clickOnView(solo.getView(R.id.settings));
- selectItemInListOnUIThread(4);
- solo.clickOnText(context.getString(R.string.pref_video_enable_title));
-
- solo.clickOnView(solo.getView(R.id.dialer));
- solo.clickOnView(solo.getView(R.id.Adress));
- solo.enterText((EditText) solo.getView(R.id.Adress), "cotcot@sip.linphone.org");
- solo.clickOnView(solo.getView(R.id.Call));
-
- solo.waitForActivity("InCallActivity", 2000);
- solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
- Log.testSuccess("Outgoing call to cotcot successfull");
-
- solo.clickOnView(solo.getView(R.id.hangUp));
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
-
- solo.clickOnView(solo.getView(R.id.history));
- Assert.assertTrue(solo.searchText("cotcot"));
- Log.testSuccess("Cotcot entry in history");
- }
-
- public void testCDisplayEmptyMissedCallHistory() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.history));
-
- solo.clickOnText(context.getString(R.string.button_missed_call));
- Assert.assertTrue(solo.searchText(context.getString(R.string.no_missed_call_history)));
- Log.testSuccess("Empty Missed Call History displayed");
- }
-
- public void testDCallBackFromHistoryEntry() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.history));
-
- solo.clickOnText(context.getString(R.string.button_all_call));
- solo.sleep(500);
- solo.clickOnText("cotcot");
- solo.waitForActivity("InCallActivity", 2000);
- solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
- Log.testSuccess("Outgoing call to cotcot from history successfull");
-
- solo.clickOnView(solo.getView(R.id.hangUp));
- solo.waitForActivity("LinphoneActivity", 2000);
- }
-
- public void testEDisplayHistoryDetails() {
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.history));
-
- solo.clickOnView(solo.getView(R.id.detail));
- Assert.assertTrue(solo.searchText("cotcot@sip.linphone.org"));
- Log.testSuccess("Displaying history entry details");
- }
-
- public void testFDeleteHistoryEntry() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.history));
-
- solo.clickOnText(context.getString(R.string.button_edit));
- solo.sleep(1000);
- solo.clickOnText("cotcot");
- solo.clickOnText(context.getString(R.string.button_ok));
-
- Assert.assertFalse(solo.searchText("cotcot", 2));
- Log.testSuccess("Clean history from one cotcot entries");
- }
-
- public void testGDeleteAllHistoryEntries() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.history));
-
- solo.clickOnText(context.getString(R.string.button_edit));
- solo.sleep(2000);
- solo.clickOnText(context.getString(R.string.button_delete_all));
- solo.clickOnText(context.getString(R.string.button_ok));
-
- Assert.assertTrue(solo.searchText(context.getString(R.string.no_call_history)));
- Log.testSuccess("Clean history from all entries");
- }
-
- @Override
- public void tearDown() throws Exception {
- solo.finishOpenedActivities();
- }
-}
diff --git a/tests/src/org/linphone/test/LinphoneTestManager.java b/tests/src/org/linphone/test/LinphoneTestManager.java
new file mode 100644
index 000000000..cd312bfe3
--- /dev/null
+++ b/tests/src/org/linphone/test/LinphoneTestManager.java
@@ -0,0 +1,576 @@
+package org.linphone.test;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.linphone.LinphoneException;
+import org.linphone.LinphoneManager;
+import org.linphone.LinphoneManager.LinphoneConfigException;
+import org.linphone.LinphoneService;
+import org.linphone.R;
+import org.linphone.core.LinphoneAddress;
+import org.linphone.core.LinphoneAuthInfo;
+import org.linphone.core.LinphoneCall;
+import org.linphone.core.LinphoneCall.State;
+import org.linphone.core.LinphoneCallStats;
+import org.linphone.core.LinphoneChatMessage;
+import org.linphone.core.LinphoneChatRoom;
+import org.linphone.core.LinphoneContent;
+import org.linphone.core.LinphoneCore;
+import org.linphone.core.LinphoneCore.EcCalibratorStatus;
+import org.linphone.core.LinphoneCore.FirewallPolicy;
+import org.linphone.core.LinphoneCore.GlobalState;
+import org.linphone.core.LinphoneCore.MediaEncryption;
+import org.linphone.core.LinphoneCore.RegistrationState;
+import org.linphone.core.LinphoneCore.Transports;
+import org.linphone.core.LinphoneCoreException;
+import org.linphone.core.LinphoneCoreFactory;
+import org.linphone.core.LinphoneCoreListener;
+import org.linphone.core.LinphoneEvent;
+import org.linphone.core.LinphoneFriend;
+import org.linphone.core.LinphoneInfoMessage;
+import org.linphone.core.LinphoneProxyConfig;
+import org.linphone.core.PayloadType;
+import org.linphone.core.SubscriptionState;
+import org.linphone.mediastream.Log;
+import org.linphone.mediastream.Version;
+import org.linphone.mediastream.video.capture.AndroidVideoApi5JniWrapper;
+import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
+import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration.AndroidCamera;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.telephony.TelephonyManager;
+
+public class LinphoneTestManager implements LinphoneCoreListener {
+
+ private static LinphoneTestManager instance;
+ private Context mContext, mIContext;
+ private LinphoneCore mLc1, mLc2;
+ private static Transports initialTransports;
+
+ public String lastMessageReceived;
+ public boolean isDTMFReceived = false;
+ public boolean autoAnswer = true;
+ public boolean declineCall = false;
+
+ private Timer mTimer = new Timer("Linphone scheduler");
+
+ private LinphoneTestManager(Context ac, Context ic) {
+ mContext = ac;
+ mIContext = ic;
+ }
+
+ public static LinphoneTestManager createAndStart(Context ac, Context ic, int id) {
+ if (instance == null)
+ instance = new LinphoneTestManager(ac, ic);
+
+ instance.startLibLinphone(ic, id);
+ TelephonyManager tm = (TelephonyManager) ac.getSystemService(Context.TELEPHONY_SERVICE);
+ boolean gsmIdle = tm.getCallState() == TelephonyManager.CALL_STATE_IDLE;
+ setGsmIdle(gsmIdle, id);
+
+ if (Version.isVideoCapable())
+ AndroidVideoApi5JniWrapper.setAndroidSdkVersion(Version.sdk());
+ return instance;
+ }
+
+ private synchronized void startLibLinphone(Context c, int id) {
+ try {
+ LinphoneCoreFactory.instance().setDebugMode(true, "LinphoneTester");
+
+ final LinphoneCore mLc = LinphoneCoreFactory.instance().createLinphoneCore(this);
+ if (id == 2) {
+ mLc2 = mLc;
+ } else {
+ mLc1 = mLc;
+ }
+
+ mLc.getConfig().setInt("sip", "store_auth_info", 0);
+ mLc.setContext(c);
+ try {
+ String versionName = c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName;
+ if (versionName == null) {
+ versionName = String.valueOf(c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionCode);
+ }
+ mLc.setUserAgent("LinphoneAndroid", versionName);
+ } catch (NameNotFoundException e) {
+ Log.e(e, "cannot get version name");
+ }
+
+ mLc.enableIpv6(false);
+ mLc.setRing(null);
+
+ int availableCores = Runtime.getRuntime().availableProcessors();
+ Log.w("MediaStreamer : " + availableCores + " cores detected and configured");
+ mLc.setCpuCount(availableCores);
+
+ try {
+ initFromConf(mLc);
+ } catch (LinphoneException e) {
+ Log.w("no config ready yet");
+ }
+
+ TimerTask lTask = new TimerTask() {
+ @Override
+ public void run() {
+ mLc.iterate();
+ }
+ };
+ mTimer.scheduleAtFixedRate(lTask, 0, 20);
+
+ IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
+ lFilter.addAction(Intent.ACTION_SCREEN_OFF);
+
+ resetCameraFromPreferences();
+ }
+ catch (Exception e) {
+ Log.e(e, "Cannot start linphone");
+ }
+ }
+
+ private void resetCameraFromPreferences() {
+ boolean useFrontCam = true;
+ int camId = 0;
+ AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras();
+ for (AndroidCamera androidCamera : cameras) {
+ if (androidCamera.frontFacing == useFrontCam)
+ camId = androidCamera.id;
+ }
+ LinphoneManager.getLc().setVideoDevice(camId);
+ }
+
+ public void initFromConf(LinphoneCore mLc) throws LinphoneConfigException {
+ LinphoneCoreFactory.instance().setDebugMode(true, "LinphoneTester");
+
+ if (initialTransports == null)
+ initialTransports = mLc.getSignalingTransportPorts();
+
+ setSignalingTransportsFromConfiguration(initialTransports, mLc);
+ initMediaEncryption(mLc);
+
+ mLc.setVideoPolicy(true, true);
+
+ readAndSetAudioAndVideoPorts(mLc);
+
+ String defaultIncomingCallTimeout = mContext.getString(org.linphone.R.string.pref_incoming_call_timeout_default);
+ int incomingCallTimeout = tryToParseIntValue(defaultIncomingCallTimeout, defaultIncomingCallTimeout);
+ mLc.setIncomingTimeout(incomingCallTimeout);
+
+ try {
+ // Configure audio codecs
+// enableDisableAudioCodec("speex", 32000, 1, R.string.pref_codec_speex32_key);
+ enableDisableAudioCodec("speex", 32000, 1, false, mLc);
+ enableDisableAudioCodec("speex", 16000, 1, R.string.pref_codec_speex16_key, mLc);
+ enableDisableAudioCodec("speex", 8000, 1, R.string.pref_codec_speex8_key, mLc);
+ enableDisableAudioCodec("iLBC", 8000, 1, R.string.pref_codec_ilbc_key, mLc);
+ enableDisableAudioCodec("GSM", 8000, 1, R.string.pref_codec_gsm_key, mLc);
+ enableDisableAudioCodec("G722", 8000, 1, R.string.pref_codec_g722_key, mLc);
+ enableDisableAudioCodec("G729", 8000, 1, R.string.pref_codec_g729_key, mLc);
+ enableDisableAudioCodec("PCMU", 8000, 1, R.string.pref_codec_pcmu_key, mLc);
+ enableDisableAudioCodec("PCMA", 8000, 1, R.string.pref_codec_pcma_key, mLc);
+ enableDisableAudioCodec("AMR", 8000, 1, R.string.pref_codec_amr_key, mLc);
+ enableDisableAudioCodec("AMR-WB", 16000, 1, R.string.pref_codec_amrwb_key, mLc);
+ //enableDisableAudioCodec("SILK", 24000, 1, R.string.pref_codec_silk24_key);
+ enableDisableAudioCodec("SILK", 24000, 1, false, mLc);
+ enableDisableAudioCodec("SILK", 16000, 1, R.string.pref_codec_silk16_key, mLc);
+ //enableDisableAudioCodec("SILK", 12000, 1, R.string.pref_codec_silk12_key);
+ enableDisableAudioCodec("SILK", 12000, 1, false, mLc);
+ enableDisableAudioCodec("SILK", 8000, 1, R.string.pref_codec_silk8_key, mLc);
+
+ // Configure video codecs
+ for (PayloadType videoCodec : mLc.getVideoCodecs()) {
+ enableDisableVideoCodecs(videoCodec, mLc);
+ }
+ } catch (LinphoneCoreException e) {
+ throw new LinphoneConfigException(mContext.getString(R.string.wrong_settings),e);
+ }
+ boolean isVideoEnabled = true;
+ mLc.enableVideo(isVideoEnabled, isVideoEnabled);
+
+ //stun server
+ String lStun = mContext.getString(R.string.default_stun);
+ mLc.setStunServer(lStun);
+ if (lStun!=null && lStun.length()>0) {
+ mLc.setFirewallPolicy(FirewallPolicy.UseIce);
+ } else {
+ mLc.setFirewallPolicy(FirewallPolicy.NoFirewall);
+ }
+
+ mLc.setUseRfc2833ForDtmfs(false);
+ mLc.setUseSipInfoForDtmfs(true);
+
+ //accounts
+ try {
+ initAccounts(mLc);
+
+ //init network state
+ mLc.setNetworkReachable(true);
+ } catch (LinphoneCoreException e) {
+ throw new LinphoneConfigException(mContext.getString(R.string.wrong_settings),e);
+ }
+ }
+
+ public boolean detectVideoCodec(String mime, LinphoneCore mLc) {
+ for (PayloadType videoCodec : mLc.getVideoCodecs()) {
+ if (mime.equals(videoCodec.getMime())) return true;
+ }
+ return false;
+ }
+
+ public boolean detectAudioCodec(String mime, LinphoneCore mLc){
+ for (PayloadType audioCodec : mLc.getAudioCodecs()) {
+ if (mime.equals(audioCodec.getMime())) return true;
+ }
+ return false;
+ }
+
+ void initMediaEncryption(LinphoneCore mLc){
+ MediaEncryption me=MediaEncryption.None;
+ mLc.setMediaEncryption(me);
+ }
+
+ public void initAccounts(LinphoneCore mLc) throws LinphoneCoreException {
+ mLc.clearAuthInfos();
+ mLc.clearProxyConfigs();
+
+ String username, password, domain;
+ if (mLc.equals(mLc1)) {
+ username = mIContext.getString(org.linphone.test.R.string.account_test_calls_login);
+ password = mIContext.getString(org.linphone.test.R.string.account_test_calls_pwd);
+ domain = mIContext.getString(org.linphone.test.R.string.account_test_calls_domain);
+ } else {
+ username = mIContext.getString(org.linphone.test.R.string.conference_account_login);
+ password = mIContext.getString(org.linphone.test.R.string.conference_account_password);
+ domain = mIContext.getString(org.linphone.test.R.string.conference_account_domain);
+ }
+ LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(username, password, null);
+ mLc.addAuthInfo(lAuthInfo);
+ String identity = "sip:" + username +"@" + domain;
+ String proxy = "sip:" + domain;
+ LinphoneProxyConfig proxycon = LinphoneCoreFactory.instance().createProxyConfig(identity, proxy, null, true);
+ mLc.addProxyConfig(proxycon);
+ mLc.setDefaultProxyConfig(proxycon);
+
+ LinphoneProxyConfig lDefaultProxyConfig = mLc.getDefaultProxyConfig();
+ if (lDefaultProxyConfig != null) {
+ //escape +
+ lDefaultProxyConfig.setDialEscapePlus(false);
+ } else if (LinphoneService.isReady()) {
+ LinphoneService.instance().onRegistrationStateChanged(RegistrationState.RegistrationNone, null);
+ }
+ }
+
+ private void readAndSetAudioAndVideoPorts(LinphoneCore mLc) throws NumberFormatException {
+ int aPortStart, aPortEnd, vPortStart, vPortEnd;
+ int defaultAudioPort, defaultVideoPort;
+ defaultAudioPort = Integer.parseInt(mContext.getString(R.string.default_audio_port));
+ defaultVideoPort = Integer.parseInt(mContext.getString(R.string.default_video_port));
+ aPortStart = aPortEnd = defaultAudioPort;
+ vPortStart = vPortEnd = defaultVideoPort;
+
+ String audioPort = String.valueOf(aPortStart);
+ String videoPort = String.valueOf(vPortStart);
+
+ if (audioPort.contains("-")) {
+ // Port range
+ aPortStart = Integer.parseInt(audioPort.split("-")[0]);
+ aPortEnd = Integer.parseInt(audioPort.split("-")[1]);
+ } else {
+ try {
+ aPortStart = aPortEnd = Integer.parseInt(audioPort);
+ } catch (NumberFormatException nfe) {
+ aPortStart = aPortEnd = defaultAudioPort;
+ }
+ }
+
+ if (videoPort.contains("-")) {
+ // Port range
+ vPortStart = Integer.parseInt(videoPort.split("-")[0]);
+ vPortEnd = Integer.parseInt(videoPort.split("-")[1]);
+ } else {
+ try {
+ vPortStart = vPortEnd = Integer.parseInt(videoPort);
+ } catch (NumberFormatException nfe) {
+ vPortStart = vPortEnd = defaultVideoPort;
+ }
+ }
+
+ if (aPortStart >= aPortEnd) {
+ mLc.setAudioPort(aPortStart);
+ } else {
+ mLc.setAudioPortRange(aPortStart, aPortEnd);
+ }
+
+ if (vPortStart >= vPortEnd) {
+ mLc.setVideoPort(vPortStart);
+ } else {
+ mLc.setVideoPortRange(vPortStart, vPortEnd);
+ }
+ }
+
+ private int tryToParseIntValue(String valueToParse, String defaultValue) {
+ return tryToParseIntValue(valueToParse, Integer.parseInt(defaultValue));
+ }
+
+ private int tryToParseIntValue(String valueToParse, int defaultValue) {
+ try {
+ int returned = Integer.parseInt(valueToParse);
+ return returned;
+ } catch (NumberFormatException nfe) {
+
+ }
+ return defaultValue;
+ }
+
+ public static synchronized final LinphoneTestManager getInstance() {
+ return instance;
+ }
+
+ private void setSignalingTransportsFromConfiguration(Transports t, LinphoneCore mLc) {
+ Transports ports = new Transports(t);
+ boolean useRandomPort = true;
+ int lPreviousPort = 5060;
+ if (lPreviousPort>0xFFFF || useRandomPort) {
+ lPreviousPort=(int)(Math.random() * (0xFFFF - 1024)) + 1024;
+ Log.w("Using random port " + lPreviousPort);
+ }
+
+ ports.udp = 0;
+ ports.tls = 0;
+ ports.tcp = lPreviousPort;
+
+ mLc.setSignalingTransportPorts(ports);
+ }
+
+ public static synchronized final LinphoneCore getLc(int i) {
+ if (i == 2)
+ return getInstance().mLc2;
+ return getInstance().mLc1;
+ }
+
+ public static synchronized final LinphoneCore getLc() {
+ return getLc(1);
+ }
+
+ private void enableDisableAudioCodec(String codec, int rate, int channels, int key, LinphoneCore mLc) throws LinphoneCoreException {
+ PayloadType pt = mLc.findPayloadType(codec, rate, channels);
+ if (pt !=null) {
+ boolean enable = true;
+ mLc.enablePayloadType(pt, enable);
+ }
+ }
+ private void enableDisableAudioCodec(String codec, int rate, int channels, boolean enable, LinphoneCore mLc) throws LinphoneCoreException {
+ PayloadType pt = mLc.findPayloadType(codec, rate, channels);
+ if (pt !=null) {
+ mLc.enablePayloadType(pt, enable);
+ }
+ }
+
+ private void enableDisableVideoCodecs(PayloadType videoCodec, LinphoneCore mLc) throws LinphoneCoreException {
+ boolean enable = true;
+ mLc.enablePayloadType(videoCodec, enable);
+ }
+
+ private int savedMaxCallWhileGsmIncall;
+ private synchronized void preventSIPCalls(LinphoneCore mLc) {
+ if (savedMaxCallWhileGsmIncall != 0) {
+ Log.w("SIP calls are already blocked due to GSM call running");
+ return;
+ }
+ savedMaxCallWhileGsmIncall = mLc.getMaxCalls();
+ mLc.setMaxCalls(0);
+ }
+ private synchronized void allowSIPCalls(LinphoneCore mLc) {
+ if (savedMaxCallWhileGsmIncall == 0) {
+ Log.w("SIP calls are already allowed as no GSM call knowned to be running");
+ return;
+ }
+ mLc.setMaxCalls(savedMaxCallWhileGsmIncall);
+ savedMaxCallWhileGsmIncall = 0;
+ }
+ public static void setGsmIdle(boolean gsmIdle, int id) {
+ LinphoneTestManager mThis = instance;
+ if (mThis == null) return;
+ if (gsmIdle) {
+ mThis.allowSIPCalls(LinphoneTestManager.getLc(id));
+ } else {
+ mThis.preventSIPCalls(LinphoneTestManager.getLc(id));
+ }
+ }
+
+ private void doDestroy() {
+ try {
+ mTimer.cancel();
+ mLc1.destroy();
+ mLc2.destroy();
+ }
+ catch (RuntimeException e) {
+ e.printStackTrace();
+ }
+ finally {
+ mLc1 = null;
+ mLc2 = null;
+ instance = null;
+ }
+ }
+
+ public static synchronized void destroy() {
+ if (instance == null) return;
+ instance.doDestroy();
+ }
+
+ @Override
+ public void authInfoRequested(LinphoneCore lc, String realm, String username) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void globalState(LinphoneCore lc, GlobalState state, String message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void callState(LinphoneCore lc, LinphoneCall call, State cstate,
+ String message) {
+ // TODO Auto-generated method stub
+ Log.e("Call state = " + cstate.toString());
+ if (cstate == LinphoneCall.State.IncomingReceived) {
+ if (declineCall) {
+ lc.terminateCall(call);
+ } else if (autoAnswer) {
+ try {
+ lc.acceptCall(call);
+ } catch (LinphoneCoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void callStatsUpdated(LinphoneCore lc, LinphoneCall call,
+ LinphoneCallStats stats) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,
+ boolean encrypted, String authenticationToken) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg,
+ RegistrationState cstate, String smessage) {
+ // TODO Auto-generated method stub
+ Log.e("Registration state = " + cstate.toString());
+ }
+
+ @Override
+ public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,
+ String url) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,
+ LinphoneAddress from, String message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr,
+ LinphoneChatMessage message) {
+ // TODO Auto-generated method stub
+ Log.e("Message received = " + message.getText());
+ lastMessageReceived = message.getText();
+ }
+
+ @Override
+ public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {
+ // TODO Auto-generated method stub
+ Log.e("DTMF received = " + dtmf);
+ isDTMFReceived = true;
+ }
+
+ @Override
+ public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,
+ int delay_ms, Object data) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void notifyReceived(LinphoneCore lc, LinphoneCall call,
+ LinphoneAddress from, byte[] event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void show(LinphoneCore lc) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void displayStatus(LinphoneCore lc, String message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void displayMessage(LinphoneCore lc, String message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void displayWarning(LinphoneCore lc, String message) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void transferState(LinphoneCore lc, LinphoneCall call,
+ State new_call_state) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void infoReceived(LinphoneCore lc, LinphoneCall call,
+ LinphoneInfoMessage info) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
+ SubscriptionState state) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void notifyReceived(LinphoneCore lc, LinphoneEvent ev,
+ String eventName, LinphoneContent content) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/tests/src/org/linphone/test/Log.java b/tests/src/org/linphone/test/Log.java
deleted file mode 100644
index 63e3df1f7..000000000
--- a/tests/src/org/linphone/test/Log.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.linphone.test;
-
-public class Log {
- public static void testSuccess(String testName) {
- android.util.Log.wtf("TEST SUCCESS", testName);
- }
-
- public static void testFailure(String testName) {
- android.util.Log.wtf("TEST FAILURE", testName);
- }
-}
diff --git a/tests/src/org/linphone/test/PushNotificationTest.java b/tests/src/org/linphone/test/PushNotificationTest.java
deleted file mode 100644
index 3685d8e67..000000000
--- a/tests/src/org/linphone/test/PushNotificationTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.linphone.test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.apache.http.HttpVersion;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.conn.ClientConnectionManager;
-import org.apache.http.conn.scheme.PlainSocketFactory;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.impl.client.BasicResponseHandler;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
-import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpProtocolParams;
-import org.apache.http.protocol.HTTP;
-import org.linphone.LinphoneActivity;
-import org.linphone.R;
-import org.linphone.core.Log;
-
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.test.ActivityInstrumentationTestCase2;
-
-import com.jayway.android.robotium.solo.Solo;
-
-public class PushNotificationTest extends
- ActivityInstrumentationTestCase2 {
-
- private Solo solo;
-
- @SuppressWarnings("deprecation")
- public PushNotificationTest() {
- super("org.linphone", LinphoneActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- solo = new Solo(getInstrumentation(), getActivity());
- }
-
- private HttpClient createHttpClient()
- {
- HttpParams params = new BasicHttpParams();
- HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
- HttpProtocolParams.setContentCharset(params, HTTP.DEFAULT_CONTENT_CHARSET);
- HttpProtocolParams.setUseExpectContinue(params, true);
-
- SchemeRegistry schReg = new SchemeRegistry();
- schReg.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
- schReg.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
- ClientConnectionManager conMgr = new ThreadSafeClientConnManager(params, schReg);
-
- return new DefaultHttpClient(conMgr, params);
- }
-
- public void testIncomingPushNotification() {
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
-
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
- String regId = prefs.getString(getActivity().getString(R.string.push_reg_id_key), null);
-
- // Send a push notification
- // To do the same from a terminal use: curl --header "Authorization: key=AIzaSyBJAhCVeeqIErwTfYwy-t83_EwvZlCFo9I" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"DEVICE_REG_ID\"]}"
- HttpClient httpClient = createHttpClient();
- HttpPost httpPost = new HttpPost("https://android.googleapis.com/gcm/send");
- httpPost.setHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8");
- httpPost.setHeader("Authorization", "key=AIzaSyBJAhCVeeqIErwTfYwy-t83_EwvZlCFo9I"); // Test API
-// httpPost.setHeader("Authorization", "key=AIzaSyDbCO1_KgFhkig_aaTutxx0jEHIib0i8C0");
-
- List nameValuePairs = new ArrayList(2);
- nameValuePairs.add(new BasicNameValuePair("data.test", "TEST"));
- nameValuePairs.add(new BasicNameValuePair("registration_id", regId));
- try {
- httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
- String result = httpClient.execute(httpPost, new BasicResponseHandler());
- Log.d("TEST Http POST result: " + result);
- } catch (Exception e) {
- e.printStackTrace();
- new junit.framework.TestFailure(this, e.getCause());
- }
-
- // Can be true if a previous notification worked and log hasn't been cleared since...
- Assert.assertTrue(solo.waitForLogMessage("Push notification received", 3000));
- }
-
- @Override
- public void tearDown() throws Exception {
- solo.finishOpenedActivities();
- }
-}
diff --git a/tests/src/org/linphone/test/SampleTest.java b/tests/src/org/linphone/test/SampleTest.java
new file mode 100644
index 000000000..40269f94b
--- /dev/null
+++ b/tests/src/org/linphone/test/SampleTest.java
@@ -0,0 +1,48 @@
+package org.linphone.test;
+
+import org.linphone.LinphoneLauncherActivity;
+import org.linphone.LinphoneManager;
+
+import android.content.Context;
+import android.test.ActivityInstrumentationTestCase2;
+import android.widget.ListView;
+
+import com.jayway.android.robotium.solo.Solo;
+
+/**
+ * @author Sylvain Berfini
+ */
+public abstract class SampleTest extends ActivityInstrumentationTestCase2{
+
+ protected final int STRING_LENGTH_MAX = 20;
+
+ protected Solo solo;
+ protected Context aContext, iContext;
+
+ public SampleTest() {
+ super(LinphoneLauncherActivity.class);
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ solo = new Solo(getInstrumentation());
+ aContext = getActivity();
+ iContext = getInstrumentation().getContext();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ LinphoneManager.getLcIfManagerNotDestroyedOrNull().terminateAllCalls();
+ solo.finishOpenedActivities();
+ }
+
+ protected void selectItemInListOnUIThread(final int item) {
+ solo.sleep(500);
+ getActivity().runOnUiThread(new Runnable() {
+ public void run() {
+ ListView list = (ListView) solo.getView(android.R.id.list);
+ list.setSelection(item);
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/tests/src/org/linphone/test/SignalingTest.java b/tests/src/org/linphone/test/SignalingTest.java
deleted file mode 100644
index 83e962ab1..000000000
--- a/tests/src/org/linphone/test/SignalingTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.linphone.test;
-
-import junit.framework.Assert;
-
-import org.linphone.InCallActivity;
-import org.linphone.LinphoneActivity;
-import org.linphone.R;
-
-import android.content.Context;
-import android.test.ActivityInstrumentationTestCase2;
-import android.widget.EditText;
-import android.widget.ListView;
-
-import com.jayway.android.robotium.solo.Solo;
-
-public class SignalingTest extends ActivityInstrumentationTestCase2 {
- private static final String sipAdressToCall = "cotcot@sip.linphone.org";
- private Solo solo;
-
- @SuppressWarnings("deprecation")
- public SignalingTest() {
- super("org.linphone", LinphoneActivity.class);
- }
-
- private void selectItemInListOnUIThread(final int item) {
- solo.sleep(500);
- getActivity().runOnUiThread(new Runnable() {
- public void run() {
- ListView list = (ListView) solo.getView(android.R.id.list);
- list.setSelection(item);
- }
- });
- }
-
- private void goToNetworkSettings() {
- Context context = getActivity();
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- solo.clickOnView(solo.getView(R.id.settings));
-
- selectItemInListOnUIThread(6);
- solo.clickOnText(context.getString(R.string.pref_network_title));
- solo.sleep(500);
- }
-
- private void goToDialerAndOutgoingCall() {
- solo.clickOnView(solo.getView(R.id.dialer));
- solo.clickOnView(solo.getView(R.id.Adress));
- solo.enterText((EditText) solo.getView(R.id.Adress), sipAdressToCall);
- solo.clickOnView(solo.getView(R.id.Call));
-
- solo.waitForActivity("InCallActivity", 2000);
- solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
- solo.waitForText("03", 1, 5000);
- solo.clickOnView(solo.getView(R.id.hangUp));
-
- solo.waitForActivity("LinphoneActivity", 2000);
- solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- solo = new Solo(getInstrumentation(), getActivity());
- }
-
- public void testARegistrationUDP() {
- Context context = getActivity();
- goToNetworkSettings();
-
- solo.clickOnText(context.getString(R.string.pref_transport));
- solo.clickOnText(context.getString(R.string.pref_transport_udp));
- solo.goBack();
- solo.goBack();
-
- Assert.assertTrue(solo.searchText(context.getString(R.string.status_connected, 2000)));
- }
-
- public void testBOutgoingCallUDP() {
- goToDialerAndOutgoingCall();
- }
-
- public void testCRegistrationTCP() {
- Context context = getActivity();
- goToNetworkSettings();
-
- solo.clickOnText(context.getString(R.string.pref_transport));
- solo.clickOnText(context.getString(R.string.pref_transport_tcp));
- solo.goBack();
- solo.goBack();
-
- Assert.assertTrue(solo.searchText(context.getString(R.string.status_connected, 2000)));
- }
-
- public void testDOutgoingCallTCP() {
- goToDialerAndOutgoingCall();
- }
-
- public void testERegistrationTLS() {
- Context context = getActivity();
- goToNetworkSettings();
-
- solo.clickOnText(context.getString(R.string.pref_transport));
- solo.clickOnText(context.getString(R.string.pref_transport_tls));
- solo.goBack();
- solo.goBack();
-
- Assert.assertTrue(solo.searchText(context.getString(R.string.status_connected, 2000)));
- }
-
- public void testFOutgoingCallTLS() {
- goToDialerAndOutgoingCall();
- }
-
- @Override
- public void tearDown() throws Exception {
- solo.finishOpenedActivities();
- }
-}
diff --git a/tests/src/org/linphone/test/ZShutdownTestEnv.java b/tests/src/org/linphone/test/ZShutdownTestEnv.java
new file mode 100644
index 000000000..6b5271410
--- /dev/null
+++ b/tests/src/org/linphone/test/ZShutdownTestEnv.java
@@ -0,0 +1,25 @@
+package org.linphone.test;
+
+import static android.content.Intent.ACTION_MAIN;
+
+import org.linphone.LinphoneService;
+
+import android.content.Intent;
+import android.test.suitebuilder.annotation.LargeTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+
+/**
+ * @author Sylvain Berfini
+ */
+public class ZShutdownTestEnv extends SampleTest {
+
+ @SmallTest
+ @MediumTest
+ @LargeTest
+ public void testZShutDownLinphoneCore() {
+ LinphoneTestManager.destroy();
+ aContext.stopService(new Intent(ACTION_MAIN).setClass(aContext, LinphoneService.class));
+ }
+
+}