From 7a71a553794b3c6c492a58c37fba342699aa217a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Wed, 22 Oct 2014 11:54:34 +0200 Subject: [PATCH] Add a (disabled) Robotium test for CallPlayer --- res/values/strings.xml | 2 +- tests/.classpath | 6 +- tests/src/org/linphone/test/CallsVideo.java | 90 +++++++++++++++++++++ 3 files changed, 94 insertions(+), 4 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 69679069b..ccee9a3a6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -115,7 +115,7 @@ Video Preferences H263 - MPEG4 + MP4V-ES H264 Codecs Preferred video size diff --git a/tests/.classpath b/tests/.classpath index 6b09f50a7..c126085a7 100644 --- a/tests/.classpath +++ b/tests/.classpath @@ -3,13 +3,13 @@ - - - + + + diff --git a/tests/src/org/linphone/test/CallsVideo.java b/tests/src/org/linphone/test/CallsVideo.java index 85e8d636e..7b82daf46 100644 --- a/tests/src/org/linphone/test/CallsVideo.java +++ b/tests/src/org/linphone/test/CallsVideo.java @@ -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; +// } +// } }