New tests + new handling of second linphone core for test env + fix in layout for tests
This commit is contained in:
parent
17b07db88d
commit
c22a6688a9
11 changed files with 78 additions and 46 deletions
|
@ -34,7 +34,7 @@
|
||||||
android:src="@drawable/call_answer" />
|
android:src="@drawable/call_answer" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/chat"
|
android:id="@+id/start_chat"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.2"
|
android:layout_weight="0.2"
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class ContactFragment extends Fragment implements OnClickListener {
|
||||||
v.findViewById(R.id.dial).setVisibility(View.GONE);
|
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();
|
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||||
if (lpc != null) {
|
if (lpc != null) {
|
||||||
if (!displayednumberOrAddress.startsWith("sip:")) {
|
if (!displayednumberOrAddress.startsWith("sip:")) {
|
||||||
|
@ -126,9 +126,9 @@ public class ContactFragment extends Fragment implements OnClickListener {
|
||||||
if (!numberOrAddress.contains("@")) {
|
if (!numberOrAddress.contains("@")) {
|
||||||
tag = numberOrAddress + "@" + lpc.getDomain();
|
tag = numberOrAddress + "@" + lpc.getDomain();
|
||||||
}
|
}
|
||||||
v.findViewById(R.id.chat).setTag(tag);
|
v.findViewById(R.id.start_chat).setTag(tag);
|
||||||
} else {
|
} else {
|
||||||
v.findViewById(R.id.chat).setTag(numberOrAddress);
|
v.findViewById(R.id.start_chat).setTag(numberOrAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String finalNumberOrAddress = numberOrAddress;
|
final String finalNumberOrAddress = numberOrAddress;
|
||||||
|
@ -161,7 +161,7 @@ public class ContactFragment extends Fragment implements OnClickListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getResources().getBoolean(R.bool.disable_chat)) {
|
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);
|
controls.addView(v);
|
||||||
|
|
|
@ -18,6 +18,9 @@ import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sylvain Berfini
|
||||||
|
*/
|
||||||
public class AccountAssistant extends SampleTest {
|
public class AccountAssistant extends SampleTest {
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
|
|
|
@ -11,6 +11,9 @@ import org.linphone.core.LinphoneProxyConfig;
|
||||||
import android.test.suitebuilder.annotation.LargeTest;
|
import android.test.suitebuilder.annotation.LargeTest;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sylvain Berfini
|
||||||
|
*/
|
||||||
public class AccountManagement extends SampleTest {
|
public class AccountManagement extends SampleTest {
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
|
@ -33,7 +36,7 @@ public class AccountManagement extends SampleTest {
|
||||||
LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
|
LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
|
||||||
Assert.assertEquals(proxyConfigs.length, 2);
|
Assert.assertEquals(proxyConfigs.length, 2);
|
||||||
LinphoneProxyConfig proxyConfig = proxyConfigs[1];
|
LinphoneProxyConfig proxyConfig = proxyConfigs[1];
|
||||||
Assert.assertEquals(proxyConfig.getState(), RegistrationState.RegistrationOk);
|
Assert.assertEquals(RegistrationState.RegistrationOk, proxyConfig.getState());
|
||||||
Assert.assertTrue(proxyConfig.getIdentity(), proxyConfig.getIdentity().contains("new"));
|
Assert.assertTrue(proxyConfig.getIdentity(), proxyConfig.getIdentity().contains("new"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
26
tests/src/org/linphone/test/AinitTestEnv.java
Normal file
26
tests/src/org/linphone/test/AinitTestEnv.java
Normal file
|
@ -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);
|
||||||
|
|
||||||
|
solo.sleep(2000);
|
||||||
|
Assert.assertEquals(RegistrationState.RegistrationOk, LinphoneTestManager.getLc().getProxyConfigList()[0].getState());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,28 +5,20 @@ import junit.framework.Assert;
|
||||||
import org.linphone.InCallActivity;
|
import org.linphone.InCallActivity;
|
||||||
import org.linphone.LinphoneActivity;
|
import org.linphone.LinphoneActivity;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
|
||||||
|
|
||||||
import android.test.suitebuilder.annotation.LargeTest;
|
import android.test.suitebuilder.annotation.LargeTest;
|
||||||
import android.test.suitebuilder.annotation.MediumTest;
|
import android.test.suitebuilder.annotation.MediumTest;
|
||||||
import android.test.suitebuilder.annotation.SmallTest;
|
import android.test.suitebuilder.annotation.SmallTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sylvain Berfini
|
||||||
|
*/
|
||||||
public class Calls extends SampleTest {
|
public class Calls extends SampleTest {
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
@MediumTest
|
@MediumTest
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public void testAInitLinphoneCore() {
|
public void testASimpleCall() {
|
||||||
LinphoneTestManager.createAndStart(aContext, iContext);
|
|
||||||
|
|
||||||
solo.sleep(2000);
|
|
||||||
Assert.assertEquals(RegistrationState.RegistrationOk, LinphoneTestManager.getLc().getProxyConfigList()[0].getState());
|
|
||||||
}
|
|
||||||
|
|
||||||
@SmallTest
|
|
||||||
@MediumTest
|
|
||||||
@LargeTest
|
|
||||||
public void testBSimpleCall() {
|
|
||||||
solo.enterText(0, iContext.getString(R.string.account_test_calls_login) + "@" + iContext.getString(R.string.account_test_calls_domain));
|
solo.enterText(0, iContext.getString(R.string.account_test_calls_login) + "@" + iContext.getString(R.string.account_test_calls_domain));
|
||||||
solo.clickOnView(solo.getView(org.linphone.R.id.Call));
|
solo.clickOnView(solo.getView(org.linphone.R.id.Call));
|
||||||
|
|
||||||
|
@ -40,11 +32,4 @@ public class Calls extends SampleTest {
|
||||||
solo.waitForActivity("LinphoneActivity", 5000);
|
solo.waitForActivity("LinphoneActivity", 5000);
|
||||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SmallTest
|
|
||||||
@MediumTest
|
|
||||||
@LargeTest
|
|
||||||
public void testZShutDownLinphoneCore() {
|
|
||||||
LinphoneTestManager.destroy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,25 +6,17 @@ import org.linphone.LinphoneActivity;
|
||||||
import org.linphone.core.LinphoneChatMessage;
|
import org.linphone.core.LinphoneChatMessage;
|
||||||
import org.linphone.core.LinphoneChatMessage.State;
|
import org.linphone.core.LinphoneChatMessage.State;
|
||||||
import org.linphone.core.LinphoneChatRoom;
|
import org.linphone.core.LinphoneChatRoom;
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
import android.test.suitebuilder.annotation.LargeTest;
|
import android.test.suitebuilder.annotation.LargeTest;
|
||||||
import android.test.suitebuilder.annotation.MediumTest;
|
import android.test.suitebuilder.annotation.MediumTest;
|
||||||
import android.test.suitebuilder.annotation.SmallTest;
|
import android.test.suitebuilder.annotation.SmallTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sylvain Berfini
|
||||||
|
*/
|
||||||
public class Chat extends SampleTest {
|
public class Chat extends SampleTest {
|
||||||
|
|
||||||
@SmallTest
|
|
||||||
@MediumTest
|
|
||||||
@LargeTest
|
|
||||||
public void testAInitLinphoneCore() {
|
|
||||||
LinphoneTestManager.createAndStart(aContext, iContext);
|
|
||||||
|
|
||||||
solo.sleep(2000);
|
|
||||||
Assert.assertEquals(RegistrationState.RegistrationOk, LinphoneTestManager.getLc().getProxyConfigList()[0].getState());
|
|
||||||
}
|
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public void testBEmptyChatHistory() {
|
public void testBEmptyChatHistory() {
|
||||||
goToChat();
|
goToChat();
|
||||||
|
@ -53,7 +45,6 @@ public class Chat extends SampleTest {
|
||||||
public void testDNotEmptyChatHistory() {
|
public void testDNotEmptyChatHistory() {
|
||||||
goToChat();
|
goToChat();
|
||||||
|
|
||||||
Assert.assertFalse(solo.searchText(aContext.getString(org.linphone.R.string.no_chat_history)));
|
|
||||||
Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.account_test_calls_login)));
|
Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.account_test_calls_login)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,13 +96,6 @@ public class Chat extends SampleTest {
|
||||||
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_chat_history)));
|
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_chat_history)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SmallTest
|
|
||||||
@MediumTest
|
|
||||||
@LargeTest
|
|
||||||
public void testZShutDownLinphoneCore() {
|
|
||||||
LinphoneTestManager.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void goToChat() {
|
private void goToChat() {
|
||||||
solo.waitForActivity("LinphoneActivity", 2000);
|
solo.waitForActivity("LinphoneActivity", 2000);
|
||||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||||
|
|
|
@ -8,6 +8,9 @@ import android.test.suitebuilder.annotation.LargeTest;
|
||||||
import android.test.suitebuilder.annotation.MediumTest;
|
import android.test.suitebuilder.annotation.MediumTest;
|
||||||
import android.test.suitebuilder.annotation.SmallTest;
|
import android.test.suitebuilder.annotation.SmallTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sylvain Berfini
|
||||||
|
*/
|
||||||
public class Contacts extends SampleTest {
|
public class Contacts extends SampleTest {
|
||||||
|
|
||||||
@MediumTest
|
@MediumTest
|
||||||
|
@ -87,6 +90,10 @@ public class Contacts extends SampleTest {
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public void testFStartChatFromContact() {
|
public void testFStartChatFromContact() {
|
||||||
goToContacts();
|
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
|
@SmallTest
|
||||||
|
|
|
@ -10,6 +10,9 @@ import android.test.suitebuilder.annotation.LargeTest;
|
||||||
import android.test.suitebuilder.annotation.MediumTest;
|
import android.test.suitebuilder.annotation.MediumTest;
|
||||||
import android.test.suitebuilder.annotation.SmallTest;
|
import android.test.suitebuilder.annotation.SmallTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sylvain Berfini
|
||||||
|
*/
|
||||||
public class History extends SampleTest {
|
public class History extends SampleTest {
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
|
@ -40,6 +43,7 @@ public class History extends SampleTest {
|
||||||
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
|
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
|
||||||
|
|
||||||
solo.sleep(2000);
|
solo.sleep(2000);
|
||||||
|
Assert.assertEquals(1, LinphoneTestManager.getLc().getCallsNb());
|
||||||
Assert.assertEquals(LinphoneCall.State.StreamsRunning, LinphoneTestManager.getLc().getCalls()[0].getState());
|
Assert.assertEquals(LinphoneCall.State.StreamsRunning, LinphoneTestManager.getLc().getCalls()[0].getState());
|
||||||
|
|
||||||
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
|
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
|
||||||
|
|
|
@ -8,8 +8,9 @@ import android.widget.ListView;
|
||||||
|
|
||||||
import com.jayway.android.robotium.solo.Solo;
|
import com.jayway.android.robotium.solo.Solo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sylvain Berfini
|
||||||
|
*/
|
||||||
public abstract class SampleTest extends ActivityInstrumentationTestCase2<LinphoneLauncherActivity>{
|
public abstract class SampleTest extends ActivityInstrumentationTestCase2<LinphoneLauncherActivity>{
|
||||||
|
|
||||||
protected final int STRING_LENGTH_MAX = 20;
|
protected final int STRING_LENGTH_MAX = 20;
|
||||||
|
|
19
tests/src/org/linphone/test/ZShutdownTestEnv.java
Normal file
19
tests/src/org/linphone/test/ZShutdownTestEnv.java
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package org.linphone.test;
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue