liblinphone updated + changes on call update + signaling tests
This commit is contained in:
parent
ade1bd9904
commit
6ce5cc920d
7 changed files with 136 additions and 25 deletions
|
@ -320,7 +320,6 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
hideOrDisplayCallOptions();
|
hideOrDisplayCallOptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void switchVideo(final boolean displayVideo) {
|
private void switchVideo(final boolean displayVideo) {
|
||||||
final LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
final LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||||
|
@ -334,20 +333,19 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
if (!displayVideo) {
|
if (!displayVideo) {
|
||||||
LinphoneCallParams params = call.getCurrentParamsCopy();
|
LinphoneCallParams params = call.getCurrentParamsCopy();
|
||||||
params.setVideoEnabled(false);
|
params.setVideoEnabled(false);
|
||||||
|
|
||||||
LinphoneManager.getLc().updateCall(call, params);
|
LinphoneManager.getLc().updateCall(call, params);
|
||||||
replaceFragmentVideoByAudio();
|
|
||||||
|
|
||||||
video.setBackgroundResource(R.drawable.video_on);
|
video.setBackgroundResource(R.drawable.video_on);
|
||||||
|
|
||||||
|
replaceFragmentVideoByAudio();
|
||||||
setCallControlsVisibleAndRemoveCallbacks();
|
setCallControlsVisibleAndRemoveCallbacks();
|
||||||
} else {
|
} else {
|
||||||
LinphoneManager.getInstance().addVideo();
|
LinphoneManager.getInstance().addVideo();
|
||||||
isSpeakerEnabled = true;
|
isSpeakerEnabled = true;
|
||||||
LinphoneManager.getInstance().routeAudioToSpeaker();
|
LinphoneManager.getInstance().routeAudioToSpeaker();
|
||||||
speaker.setBackgroundResource(R.drawable.speaker_on);
|
speaker.setBackgroundResource(R.drawable.speaker_on);
|
||||||
|
video.setBackgroundResource(R.drawable.video_off);
|
||||||
|
|
||||||
replaceFragmentAudioByVideo();
|
replaceFragmentAudioByVideo();
|
||||||
video.setBackgroundResource(R.drawable.video_off);
|
|
||||||
displayVideoCallControlsIfHidden();
|
displayVideoCallControlsIfHidden();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -928,14 +926,15 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) {
|
}
|
||||||
mHandler.post(new Runnable() {
|
// else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) {
|
||||||
@Override
|
// mHandler.post(new Runnable() {
|
||||||
public void run() {
|
// @Override
|
||||||
acceptCallUpdate(true);
|
// public void run() {
|
||||||
}
|
// acceptCallUpdate(true);
|
||||||
});
|
// }
|
||||||
}
|
// });
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
|
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
|
||||||
|
|
|
@ -554,12 +554,9 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
||||||
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
|
boolean remoteVideo = call.getRemoteParams().getVideoEnabled();
|
||||||
boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
|
boolean localVideo = call.getCurrentParamsCopy().getVideoEnabled();
|
||||||
boolean autoAcceptCameraPolicy = LinphoneManager.getInstance().isAutoAcceptCamera();
|
boolean autoAcceptCameraPolicy = LinphoneManager.getInstance().isAutoAcceptCamera();
|
||||||
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy) {
|
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
|
||||||
try {
|
try {
|
||||||
LinphoneManager.getLc().deferCallUpdate(call);
|
LinphoneManager.getLc().deferCallUpdate(call);
|
||||||
|
|
||||||
// if (incallListener() != null)
|
|
||||||
// incallListener().onCallStateChanged(call, state, message);
|
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8bec813e52a4949f723b94918f4eb37ac5faad86
|
Subproject commit 5f348a03c29f71c9d536a7dd3baf257259de8f39
|
|
@ -28,6 +28,7 @@ public class AccountsTest extends
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectItemInListOnUIThread(final int item) {
|
private void selectItemInListOnUIThread(final int item) {
|
||||||
|
solo.sleep(500);
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -119,7 +120,6 @@ public class AccountsTest extends
|
||||||
Assert.assertTrue(solo.searchText("junit@test.linphone.org"));
|
Assert.assertTrue(solo.searchText("junit@test.linphone.org"));
|
||||||
|
|
||||||
solo.clickOnText("junit@test.linphone.org");
|
solo.clickOnText("junit@test.linphone.org");
|
||||||
solo.sleep(500);
|
|
||||||
selectItemInListOnUIThread(6);
|
selectItemInListOnUIThread(6);
|
||||||
solo.clickOnText(context.getString(R.string.pref_default_account));
|
solo.clickOnText(context.getString(R.string.pref_default_account));
|
||||||
int defaultAccount = prefs.getInt(context.getString(R.string.pref_default_account_key), 0);
|
int defaultAccount = prefs.getInt(context.getString(R.string.pref_default_account_key), 0);
|
||||||
|
@ -141,7 +141,6 @@ public class AccountsTest extends
|
||||||
Assert.assertTrue(solo.searchText("wizard15@sip.linphone.org"));
|
Assert.assertTrue(solo.searchText("wizard15@sip.linphone.org"));
|
||||||
|
|
||||||
solo.clickOnText("wizard15@sip.linphone.org");
|
solo.clickOnText("wizard15@sip.linphone.org");
|
||||||
solo.sleep(500);
|
|
||||||
selectItemInListOnUIThread(7);
|
selectItemInListOnUIThread(7);
|
||||||
solo.clickOnText(context.getString(R.string.pref_delete_account));
|
solo.clickOnText(context.getString(R.string.pref_delete_account));
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import android.widget.ListView;
|
||||||
import com.jayway.android.robotium.solo.Solo;
|
import com.jayway.android.robotium.solo.Solo;
|
||||||
|
|
||||||
public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2<LinphoneActivity> {
|
public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2<LinphoneActivity> {
|
||||||
private static final String sipAdressToCall = "miaou@sip.linphone.org";
|
private static final String sipAdressToCall = "cotcot@sip.linphone.org";
|
||||||
private Solo solo;
|
private Solo solo;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
@ -25,6 +25,7 @@ public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2<Li
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectItemInListOnUIThread(final int item) {
|
private void selectItemInListOnUIThread(final int item) {
|
||||||
|
solo.sleep(500);
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -47,7 +48,6 @@ public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2<Li
|
||||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||||
solo.clickOnView(solo.getView(R.id.settings));
|
solo.clickOnView(solo.getView(R.id.settings));
|
||||||
|
|
||||||
solo.sleep(500);
|
|
||||||
selectItemInListOnUIThread(11);
|
selectItemInListOnUIThread(11);
|
||||||
solo.clickOnText(context.getString(R.string.pref_codecs));
|
solo.clickOnText(context.getString(R.string.pref_codecs));
|
||||||
solo.sleep(500);
|
solo.sleep(500);
|
||||||
|
@ -60,7 +60,6 @@ public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2<Li
|
||||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||||
solo.clickOnView(solo.getView(R.id.settings));
|
solo.clickOnView(solo.getView(R.id.settings));
|
||||||
|
|
||||||
solo.sleep(500);
|
|
||||||
selectItemInListOnUIThread(14);
|
selectItemInListOnUIThread(14);
|
||||||
solo.clickOnText(context.getString(R.string.pref_video_codecs_title), 2); //Hack: since pref_codecs = pref_video_codecs_title, we have to select the 2nd button
|
solo.clickOnText(context.getString(R.string.pref_video_codecs_title), 2); //Hack: since pref_codecs = pref_video_codecs_title, we have to select the 2nd button
|
||||||
solo.sleep(500);
|
solo.sleep(500);
|
||||||
|
@ -169,7 +168,6 @@ public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2<Li
|
||||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||||
solo.clickOnView(solo.getView(R.id.settings));
|
solo.clickOnView(solo.getView(R.id.settings));
|
||||||
|
|
||||||
solo.sleep(500);
|
|
||||||
selectItemInListOnUIThread(4);
|
selectItemInListOnUIThread(4);
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
if (prefs.getBoolean(context.getString(R.string.pref_video_enable_key), false)) {
|
if (prefs.getBoolean(context.getString(R.string.pref_video_enable_key), false)) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class HistoryTest extends ActivityInstrumentationTestCase2<LinphoneActivi
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectItemInListOnUIThread(final int item) {
|
private void selectItemInListOnUIThread(final int item) {
|
||||||
|
solo.sleep(500);
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -59,7 +60,6 @@ public class HistoryTest extends ActivityInstrumentationTestCase2<LinphoneActivi
|
||||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||||
|
|
||||||
solo.clickOnView(solo.getView(R.id.settings));
|
solo.clickOnView(solo.getView(R.id.settings));
|
||||||
solo.sleep(500);
|
|
||||||
selectItemInListOnUIThread(4);
|
selectItemInListOnUIThread(4);
|
||||||
solo.clickOnText(context.getString(R.string.pref_video_enable_title));
|
solo.clickOnText(context.getString(R.string.pref_video_enable_title));
|
||||||
|
|
||||||
|
|
118
tests/src/org/linphone/test/SignalingTest.java
Normal file
118
tests/src/org/linphone/test/SignalingTest.java
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
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<LinphoneActivity> {
|
||||||
|
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() {
|
||||||
|
@Override
|
||||||
|
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(18);
|
||||||
|
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_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_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_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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue