diff --git a/liblinphone_tester/AndroidManifest.xml b/liblinphone_tester/AndroidManifest.xml
index 95dfc350d..be725f20f 100644
--- a/liblinphone_tester/AndroidManifest.xml
+++ b/liblinphone_tester/AndroidManifest.xml
@@ -8,16 +8,16 @@
android:minSdkVersion="8"
android:targetSdkVersion="17" />
-
+
-
-
+
+
+ android:theme="@style/AppTheme" >
@@ -27,6 +27,14 @@
+
+
+
+
\ No newline at end of file
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
index 69f4752d0..751318d94 100644
--- a/liblinphone_tester/res/layout/activity_main.xml
+++ b/liblinphone_tester/res/layout/activity_main.xml
@@ -1,34 +1,15 @@
-
+ tools:context=".SuitesActivity" >
-
+ android:gravity="center_horizontal"
+ android:orientation="vertical" >
+
-
-
-
-
\ No newline at end of file
+
\ 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_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/values/strings.xml b/liblinphone_tester/res/values/strings.xml
index 973b9fab5..941a872da 100644
--- a/liblinphone_tester/res/values/strings.xml
+++ b/liblinphone_tester/res/values/strings.xml
@@ -2,7 +2,9 @@
liblinphone tester
- Start
+ All
Settings
+ LogsActivity
+ SuitesActivity
\ 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..2e20a15fa
--- /dev/null
+++ b/liblinphone_tester/src/org/linphone/tester/LogsActivity.java
@@ -0,0 +1,79 @@
+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", "--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();
+ }
+ });
+ }
+ }
+
+ @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()) {
+ 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
index b812fac0f..374cbbf18 100644
--- a/liblinphone_tester/src/org/linphone/tester/MainActivity.java
+++ b/liblinphone_tester/src/org/linphone/tester/MainActivity.java
@@ -7,34 +7,15 @@ 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.TextView;
-
-import org.linphone.tester.Tester;
+import android.widget.Button;
+import android.widget.LinearLayout;
+import android.widget.LinearLayout.LayoutParams;
public class MainActivity extends Activity {
- static public MainActivity instance = null;
- static public Tester tester = new Tester();
- String mLogs = "";
- MainThread mThread;
-
- private class MainThread extends Thread {
- MainActivity mActivity;
- public MainThread(MainActivity activity) {
- mActivity = activity;
- }
- @Override
- public void run() {
- String path = mActivity.getFilesDir().getAbsolutePath();
- tester.run(new String[]{"tester", "--verbose", "--config", path});
- mActivity.runOnUiThread(new Runnable() {
- public void run() {
- mActivity.done();
- }
- });
- }
- }
private void copyFromPackage(int ressourceId,String target) throws IOException{
FileOutputStream lOutputStream = openFileOutput (target, 0);
@@ -51,6 +32,7 @@ public class MainActivity extends Activity {
@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());
@@ -59,17 +41,41 @@ public class MainActivity extends Activity {
} catch (IOException e) {
e.printStackTrace();
}
-
- super.onCreate(savedInstanceState);
- instance = this;
+
setContentView(R.layout.activity_main);
- ((TextView)findViewById(R.id.textView1)).setText(mLogs);
- if(mThread == null || !mThread.isAlive()) {
- findViewById(R.id.button1).setEnabled(true);
- } else {
- findViewById(R.id.button1).setEnabled(true);
+
+ TesterList suitesTest = new TesterList();
+ suitesTest.run(new String[]{"tester", "--list-suites"});
+ LinearLayout layout = ((LinearLayout)findViewById(R.id.suites_list));
+ layout.removeAllViewsInLayout();
+ 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) {
@@ -77,21 +83,4 @@ public class MainActivity extends Activity {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
-
- public void onBtnClicked(View v) {
- mLogs = "";
- ((TextView)findViewById(R.id.textView1)).setText(mLogs);
- findViewById(R.id.button1).setEnabled(false);
- mThread = new MainThread(this);
- mThread.start();
- }
-
- public void addLog(int level, String message) {
- mLogs += message;
- ((TextView)findViewById(R.id.textView1)).append(message);
- }
-
- public void done() {
- findViewById(R.id.button1).setEnabled(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..c8d0a8a25
--- /dev/null
+++ b/liblinphone_tester/src/org/linphone/tester/SuitesActivity.java
@@ -0,0 +1,69 @@
+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) {
+ TesterList suitesTest = new TesterList();
+ suitesTest.run(new String[]{"tester", "--list-tests", mSuite});
+ LinearLayout layout = ((LinearLayout)findViewById(R.id.tests_list));
+ layout.removeAllViewsInLayout();
+ 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/Tester.java b/liblinphone_tester/src/org/linphone/tester/Tester.java
index d45cd1a7f..a8e317419 100644
--- a/liblinphone_tester/src/org/linphone/tester/Tester.java
+++ b/liblinphone_tester/src/org/linphone/tester/Tester.java
@@ -89,11 +89,6 @@ public class Tester {
public native int run(String args[]);
public void printLog(final int level, final String message) {
- MainActivity.instance.runOnUiThread(new Runnable() {
- public void run() {
- MainActivity.instance.addLog(level, message);
- }
- });
switch(level) {
case 0:
android.util.Log.i(TAG, message);
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/submodules/externals/build/cunit/Android.mk b/submodules/externals/build/cunit/Android.mk
index 68e1cc003..1aeebfaf0 100644
--- a/submodules/externals/build/cunit/Android.mk
+++ b/submodules/externals/build/cunit/Android.mk
@@ -14,9 +14,14 @@ LOCAL_SRC_FILES := \
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