Add a (disabled) Robotium test for CallPlayer

This commit is contained in:
François Grisez 2014-10-22 11:54:34 +02:00
parent e6a5f5aae0
commit 7a71a55379
3 changed files with 94 additions and 4 deletions

View file

@ -115,7 +115,7 @@
<string name="pref_video">Video</string>
<string name="pref_preferences">Preferences</string>
<string name="pref_video_codec_h263_title">H263</string>
<string name="pref_video_codec_mpeg4_title">MPEG4</string>
<string name="pref_video_codec_mpeg4_title">MP4V-ES</string>
<string name="pref_video_codec_h264_title">H264</string>
<string name="pref_video_codecs_title">Codecs</string>
<string name="pref_preferred_video_size">Preferred video size</string>

View file

@ -3,13 +3,13 @@
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry combineaccessrules="false" kind="src" path="/linphone"/>
<classpathentry kind="lib" path="libs/robotium-solo-5.1.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/linphone-android-test/libs/robotium-solo-5.1-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry combineaccessrules="false" kind="src" path="/linphone-android"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View file

@ -9,7 +9,9 @@ import org.linphone.LinphoneManager;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphonePlayer;
import org.linphone.core.PayloadType;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.mediastream.Log;
import android.test.suitebuilder.annotation.LargeTest;
@ -250,6 +252,15 @@ public class CallsVideo extends SampleTest {
assertCallIsRunningWithVideo();
}
// @SmallTest
// @MediumTest
// @LargeTest
// public void testJIncommingCallWithCallPlayer() throws InterruptedException {
// testJIncomingVideoCall();
// Thread.sleep(2000);
// callPlayerTest();
// }
//TODO: Test each video codec
@MediumTest
@ -479,6 +490,44 @@ public class CallsVideo extends SampleTest {
}
}
// private void forceH264Codec() {
// goToVideoCodecsSettings();
//
// if (isVideoCodecEnabled("VP8")) {
// solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_vp8_title));
// solo.sleep(500);
// }
//
// if (!isVideoCodecEnabled("H264")) {
// solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_h264_title));
// solo.sleep(500);
// }
//
// if (isVideoCodecEnabled("MP4V-ES")) {
// solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_mpeg4_title));
// solo.sleep(500);
// }
// }
// private void enableAllDisabledVideoCodecs() {
// goToVideoCodecsSettings();
//
// if (!isVideoCodecEnabled("VP8")) {
// solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_vp8_title));
// solo.sleep(500);
// }
//
// if (!isVideoCodecEnabled("H264")) {
// solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_h264_title));
// solo.sleep(500);
// }
//
// if (!isVideoCodecEnabled("MP4V-ES")) {
// solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_mpeg4_title));
// solo.sleep(500);
// }
// }
private void goBackToDialerAfterCodecChanges()
{
solo.goBack();
@ -487,4 +536,45 @@ public class CallsVideo extends SampleTest {
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
// private void callPlayerTest() throws InterruptedException {
// LinphoneCall call = LinphoneTestManager.getLc().getCurrentCall();
// Assert.assertNotNull(call);
// if(call == null) return;
// LinphonePlayer player = call.getPlayer();
// Assert.assertNotNull(player);
// if(player == null) return;
// EofListenerImpl eof = new EofListenerImpl();
// int openResult = player.open("/storage/sdcard0/Movies/test.mkv", eof);
// Assert.assertEquals(openResult, 0);
// if(openResult == 0) {
// Assert.assertEquals(player.start(), 0);
// try {
// Assert.assertTrue(eof.waitForEof(20000));
// } catch (InterruptedException e) {
// throw e;
// } finally {
// player.close();
// }
// }
// }
//
// private class EofListenerImpl implements LinphonePlayer.Listener {
// private boolean mEof = false;
//
// @Override
// public void endOfFile(LinphonePlayer player) {
// mEof = true;
// }
//
// public boolean waitForEof(int timeout) throws InterruptedException {
// final int refreshTime = 100;
// int time = 0;
// while(time < timeout && !mEof) {
// Thread.sleep(refreshTime);
// time += refreshTime;
// }
// return time < timeout;
// }
// }
}