using NUnit.Framework;
using System;
+using System.Threading.Tasks;
namespace Tizen.Multimedia.Remoting.Tests
{
[Test]
[Category("P2")]
- [Description("Check whether VideoResolution throws exception when it's already disposed.")]
+ [Description("Check whether VideoResolution throws exception when source is not video.")]
[Property("SPEC", "Tizen.Multimedia.Remoting.MediaSource.VideoResolution A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PEX")]
[Test]
[Category("P1")]
+ [Description("Check whether VideoFrameRate returns expected value or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaSource.VideoFrameRate A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void VideoFrameRate_READ_WRITE()
+ {
+ int fps = 30;
+
+ var source = new MediaTestSource(MediaType.Video);
+ _offerClient.AddSource(source);
+
+ source.VideoFrameRate = fps;
+ Assert.That(source.VideoFrameRate == fps, "Should return same value");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether VideoFrameRate throws exception when VideoFrameRate is less than zero.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaSource.VideoFrameRate A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void VideoFrameRate_THROWS_IF_INVALID_FPS()
+ {
+ int fps = -1;
+
+ var source = new MediaTestSource(MediaType.Video);
+ _offerClient.AddSource(source);
+
+ Assert.That(() => source.VideoFrameRate = fps, Throws.ArgumentException,
+ "Should throws ArgumentException");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether VideoFrameRate throws exception when it's not attached.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaSource.VideoFrameRate A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void VideoFrameRate_THROWS_IF_NOT_ATTACHED()
+ {
+ int fps = 30;
+
+ var source = new MediaTestSource(MediaType.Video);
+
+ Assert.That(() => source.VideoFrameRate = fps, Throws.InvalidOperationException,
+ "Should return InvalidOperationException");
+
+ Assert.That(() => source.VideoFrameRate, Throws.InvalidOperationException,
+ "Should return InvalidOperationException");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether VideoFrameRate throws exception when it's already disposed.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaSource.VideoFrameRate A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void VideoFrameRate_THROWS_IF_ALREADY_DISPOSED()
+ {
+ int fps = 30;
+
+ var source = new MediaTestSource(MediaType.Video);
+ _offerClient.AddSource(source);
+
+ _offerClient.Dispose();
+
+ Assert.That(() => source.VideoFrameRate, Throws.TypeOf<ObjectDisposedException>(),
+ "Should return ObjectDisposedException");
+
+ Assert.That(() => source.VideoFrameRate = fps, Throws.TypeOf<ObjectDisposedException>(),
+ "Should return ObjectDisposedException");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether VideoFrameRate throws exception when source is not video.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaSource.VideoFrameRate A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void VideoFrameRate_THROWS_IF_SOURCE_IS_NOT_VIDEO_TYPE()
+ {
+ int fps = 30;
+
+ var source = new MediaTestSource(MediaType.Audio);
+ _offerClient.AddSource(source);
+
+ Assert.That(() => source.VideoFrameRate, Throws.InvalidOperationException,
+ "Should return InvalidOperationException");
+
+ Assert.That(() => source.VideoFrameRate = fps, Throws.InvalidOperationException,
+ "Should return InvalidOperationException");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether VideoFrameRate throws exception when media source is not supported type.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaSource.VideoFrameRate A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void VideoFrameRate_THROWS_IF_SOURCE_IS_NOT_SUPPORTED_MEDIA_FILE_SOURCE()
+ {
+ int fps = 30;
+
+ var source = new MediaFileSource(MediaType.Video, VideoFilePath);
+ _offerClient.AddSource(source);
+
+ Assert.That(() => source.VideoFrameRate, Throws.InvalidOperationException,
+ "Should return InvalidOperationException");
+
+ Assert.That(() => source.VideoFrameRate = fps, Throws.InvalidOperationException,
+ "Should return InvalidOperationException");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether VideoFrameRate throws exception when media source is not supported type.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.MediaSource.VideoFrameRate A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void VideoFrameRate_THROWS_IF_SOURCE_IS_NOT_SUPPORTED_MEDIA_PACKET_SOURCE()
+ {
+ int fps = 30;
+
+ var source = new MediaPacketSource(VideoDecoderParser.Format);
+ _offerClient.AddSource(source);
+
+ Assert.That(() => source.VideoFrameRate, Throws.InvalidOperationException,
+ "Should return InvalidOperationException");
+
+ Assert.That(() => source.VideoFrameRate = fps, Throws.InvalidOperationException,
+ "Should return InvalidOperationException");
+ }
+
+ [Test]
+ [Category("P1")]
[Description("Test EnableAudioLoopback whether throws exception or not.")]
[Property("SPEC", "Tizen.Multimedia.Remoting.MediaSource.EnableAudioLoopback M")]
[Property("SPEC_URL", "-")]
[Test]
[Category("P2")]
- [Description("Test SetTurnServer whether throws exception or not.")]
+ [Description("Test SetTurnServer throws ObjectDisposedException if webrtc is already disposed.")]
[Property("SPEC", "Tizen.Multimedia.Remoting.WebRTC.SetTurnServer M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
[Test]
[Category("P2")]
- [Description("Test SetTurnServers whether throws exception or not.")]
+ [Description("Test SetTurnServers throws ObjectDisposedException if webrtc is already disposed.")]
[Property("SPEC", "Tizen.Multimedia.Remoting.WebRTC.SetTurnServers M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MEX")]
[Test]
[Category("P2")]
- [Description("Check whether StunServer returns expected value or not.")]
+ [Description("Check whether StunServer throws ObjectDisposedException if webrtc is already disposed.")]
[Property("SPEC", "Tizen.Multimedia.Remoting.WebRTC.StunServer A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRW")]
[Test]
[Category("P2")]
- [Description("Check whether IceTransportPolicy returns expected value or not.")]
+ [Description("Check whether IceTransportPolicy throws ObjectDisposedException if webrtc is already disposed.")]
[Property("SPEC", "Tizen.Multimedia.Remoting.WebRTC.IceTransportPolicy A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRW")]
Assert.That(() => _webRtc.IceTransportPolicy, Throws.TypeOf<ObjectDisposedException>(),
"Should throws ObjectDisposedException");
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether BundlePolicy returns expected value or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTC.BundlePolicy A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void BundlePolicy_READ_WRITE()
+ {
+ Assert.That(() => _webRtc.BundlePolicy = WebRTCBundlePolicy.None, Throws.Nothing,
+ "Should not throws exception");
+
+ Assert.That(_webRtc.BundlePolicy, Is.EqualTo(WebRTCBundlePolicy.None),
+ "Should return same value");
+
+ Assert.That(() => _webRtc.BundlePolicy = WebRTCBundlePolicy.MaxBundle, Throws.Nothing,
+ "Should not throws exception");
+
+ Assert.That(_webRtc.BundlePolicy, Is.EqualTo(WebRTCBundlePolicy.MaxBundle),
+ "Should return same value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Check whether BundlePolicy returns expected value or not.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTC.BundlePolicy A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PDV")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void BundlePolicy_CHECK_DEFAULT_VALUE()
+ {
+ Assert.That(_webRtc.BundlePolicy, Is.EqualTo(WebRTCBundlePolicy.MaxBundle),
+ "Should return MaxBundle");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Check whether BundlePolicy throws ObjectDisposedException if webrtc is already disposed.")]
+ [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTC.BundlePolicy A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PEX")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void BundlePolicy_THROWS_IF_ALREADY_DISPOSED()
+ {
+ _webRtc.Dispose();
+
+ Assert.Throws<ObjectDisposedException>(() => _webRtc.BundlePolicy = WebRTCBundlePolicy.None,
+ "Should throws ObjectDisposedException");
+
+ Assert.That(() => _webRtc.BundlePolicy, Throws.TypeOf<ObjectDisposedException>(),
+ "Should throws ObjectDisposedException");
+ }
}
}