Keep automatically created accounts for unit tests
This commit is contained in:
parent
05ed87cea6
commit
32eb7bbfe9
4 changed files with 32 additions and 12 deletions
|
@ -4,6 +4,7 @@ import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.lang.Override;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -29,6 +30,7 @@ public class MainActivity extends Activity {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e("liblinphone_tester", "Cannot install rc files",e);
|
Log.e("liblinphone_tester", "Cannot install rc files",e);
|
||||||
}
|
}
|
||||||
|
Tester.keepAccounts(true);
|
||||||
TesterList suitesTest = new TesterList();
|
TesterList suitesTest = new TesterList();
|
||||||
suitesTest.run(new String[]{"tester", "--list-suites"});
|
suitesTest.run(new String[]{"tester", "--list-suites"});
|
||||||
LinearLayout layout = ((LinearLayout)findViewById(R.id.suites_list));
|
LinearLayout layout = ((LinearLayout)findViewById(R.id.suites_list));
|
||||||
|
@ -39,6 +41,13 @@ public class MainActivity extends Activity {
|
||||||
addButton(layout, str, str);
|
addButton(layout, str, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy(){
|
||||||
|
Tester.clearAccounts();
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
private void addButton(LinearLayout layout, String text, String data) {
|
private void addButton(LinearLayout layout, String text, String data) {
|
||||||
Button button = new Button(this);
|
Button button = new Button(this);
|
||||||
button.setText(text);
|
button.setText(text);
|
||||||
|
@ -46,17 +55,17 @@ public class MainActivity extends Activity {
|
||||||
button.setGravity(Gravity.CENTER);
|
button.setGravity(Gravity.CENTER);
|
||||||
button.setOnClickListener(new Button.OnClickListener() {
|
button.setOnClickListener(new Button.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Button button = (Button) v;
|
Button button = (Button) v;
|
||||||
String data = (String)button.getTag();
|
String data = (String)button.getTag();
|
||||||
if(data == null) {
|
if(data == null) {
|
||||||
Intent intent = new Intent(getBaseContext(), LogsActivity.class);
|
Intent intent = new Intent(getBaseContext(), LogsActivity.class);
|
||||||
intent.putExtra("args", new String[]{});
|
intent.putExtra("args", new String[]{});
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else {
|
} else {
|
||||||
Intent intent = new Intent(getBaseContext(), SuitesActivity.class);
|
Intent intent = new Intent(getBaseContext(), SuitesActivity.class);
|
||||||
intent.putExtra("suite", data);
|
intent.putExtra("suite", data);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
layout.addView(button);
|
layout.addView(button);
|
||||||
|
|
|
@ -5,6 +5,8 @@ import android.os.Bundle;
|
||||||
|
|
||||||
import com.zutubi.android.junitreport.JUnitReportTestRunner;
|
import com.zutubi.android.junitreport.JUnitReportTestRunner;
|
||||||
|
|
||||||
|
import java.lang.Override;
|
||||||
|
|
||||||
|
|
||||||
public class TestRunner extends JUnitReportTestRunner {
|
public class TestRunner extends JUnitReportTestRunner {
|
||||||
String mSuite = null;
|
String mSuite = null;
|
||||||
|
@ -14,9 +16,16 @@ public class TestRunner extends JUnitReportTestRunner {
|
||||||
public void onCreate(Bundle arguments) {
|
public void onCreate(Bundle arguments) {
|
||||||
mSuite = arguments.getString("suite");
|
mSuite = arguments.getString("suite");
|
||||||
mTest = arguments.getString("test");
|
mTest = arguments.getString("test");
|
||||||
|
Tester.keepAccounts(true);
|
||||||
|
|
||||||
super.onCreate(arguments);
|
super.onCreate(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
Tester.clearAccounts();
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TestSuite getAllTests () {
|
public TestSuite getAllTests () {
|
||||||
|
|
|
@ -45,6 +45,8 @@ public class Tester {
|
||||||
}
|
}
|
||||||
|
|
||||||
public native int run(String args[]);
|
public native int run(String args[]);
|
||||||
|
public static native void keepAccounts(boolean keep);
|
||||||
|
public static native void clearAccounts();
|
||||||
|
|
||||||
public void printLog(final int level, final String message) {
|
public void printLog(final int level, final String message) {
|
||||||
switch(level) {
|
switch(level) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 23f950a73fe9bacd00e934fddfe40cd7acf970a9
|
Subproject commit 5824199483fbd4ff62d92722cd2c5175e41e7888
|
Loading…
Reference in a new issue