fix liblinphone tester
This commit is contained in:
parent
018c96e20e
commit
7c7719677f
9 changed files with 46 additions and 43 deletions
2
Makefile
2
Makefile
|
@ -259,7 +259,7 @@ $(TOPDIR)/res/raw/rootca.pem:
|
|||
|
||||
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/. \
|
||||
cp -f $$file $(TOPDIR)/liblinphone_tester/assets/rc_files/. \
|
||||
;done
|
||||
|
||||
#SQLite3
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="linphone/j2se"/>
|
||||
<classpathentry kind="src" path="linphone/impl"/>
|
||||
<classpathentry kind="src" path="linphone/common"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry excluding="org/linphone/mediastream/MediastreamerActivity.java" kind="src" path="mediastreamer2"/>
|
||||
<classpathentry kind="lib" path="libs/android-support-v4.jar"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
|
|
2
liblinphone_tester/.gitignore
vendored
2
liblinphone_tester/.gitignore
vendored
|
@ -16,3 +16,5 @@ obj/
|
|||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
|
||||
assets
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>linphone</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-1-PROJECT_LOCATION/submodules/linphone/java</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>mediastreamer2</name>
|
||||
<type>2</type>
|
||||
|
|
12
liblinphone_tester/res/raw/.gitignore
vendored
12
liblinphone_tester/res/raw/.gitignore
vendored
|
@ -1,12 +0,0 @@
|
|||
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
|
|
@ -7,7 +7,9 @@ import java.io.InputStream;
|
|||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.AssetManager;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
|
@ -16,34 +18,9 @@ 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);
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.linphone.tester;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestSuite;
|
||||
import android.os.Bundle;
|
||||
import android.test.InstrumentationTestRunner;
|
||||
|
@ -13,6 +15,7 @@ public class TestRunner extends InstrumentationTestRunner {
|
|||
public void onCreate(Bundle arguments) {
|
||||
mSuite = arguments.getString("suite");
|
||||
mTest = arguments.getString("test");
|
||||
|
||||
super.onCreate(arguments);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,49 @@
|
|||
package org.linphone.tester;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import android.content.Context;
|
||||
import android.test.AndroidTestCase;
|
||||
|
||||
public class TestUnit extends AndroidTestCase {
|
||||
private String mSuite;
|
||||
private String mTest;
|
||||
static Boolean isAssetCopied=false;
|
||||
|
||||
public TestUnit(String suite, String test) {
|
||||
mSuite = suite;
|
||||
mTest = test;
|
||||
setName(suite + "/" + test);
|
||||
}
|
||||
|
||||
private void copyAssetsFromPackage() throws IOException {
|
||||
Context ctx= getContext();
|
||||
for (String file :ctx.getAssets().list("rc_files")) {
|
||||
FileOutputStream lOutputStream = ctx.openFileOutput (new File(file).getName(), 0);
|
||||
InputStream lInputStream = ctx.getAssets().open("rc_files/"+file);
|
||||
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 setUp() throws Exception {
|
||||
super.setUp();
|
||||
if (isAssetCopied ==false) {
|
||||
copyAssetsFromPackage();
|
||||
isAssetCopied=true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +53,7 @@ public class TestUnit extends AndroidTestCase {
|
|||
|
||||
@Override
|
||||
protected void runTest() {
|
||||
String path = getContext().getFilesDir().getAbsolutePath();
|
||||
String path = getContext().getFilesDir().getPath();
|
||||
Tester tester = new Tester();
|
||||
List<String> list = new LinkedList<String>(Arrays.asList(new String[]{"tester", "--verbose", "--config", path, "--suite", mSuite, "--test", mTest}));
|
||||
String[] array = list.toArray(new String[list.size()]);
|
||||
|
|
|
@ -24,6 +24,7 @@ public class Tester {
|
|||
}
|
||||
|
||||
static {
|
||||
|
||||
LinphoneCoreFactory.instance();
|
||||
|
||||
System.loadLibrary("cunit");
|
||||
|
|
Loading…
Reference in a new issue