From: Haesu Gwon Date: Thu, 30 Jun 2022 05:25:27 +0000 (+0900) Subject: [TCSACR-491][WebRTC] Add VideoFrameRate and BundlePolicy APIs X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=813c4570de8d87b3c526407ad8e33e324db5d811;p=test%2Ftct%2Fcsharp%2Fapi.git [TCSACR-491][WebRTC] Add VideoFrameRate and BundlePolicy APIs Change-Id: I39fbb09e08ca68402b43454938c110e93e4a9673 --- diff --git a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaSource.cs b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaSource.cs index d3196f2..2184d52 100755 --- a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaSource.cs +++ b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaSource.cs @@ -16,6 +16,7 @@ using NUnit.Framework; using System; +using System.Threading.Tasks; namespace Tizen.Multimedia.Remoting.Tests { @@ -282,7 +283,7 @@ 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")] @@ -303,6 +304,148 @@ namespace Tizen.Multimedia.Remoting.Tests [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(), + "Should return ObjectDisposedException"); + + Assert.That(() => source.VideoFrameRate = fps, Throws.TypeOf(), + "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", "-")] diff --git a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.cs b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.cs index 41324de..2370d8b 100755 --- a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.cs +++ b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.cs @@ -975,7 +975,7 @@ namespace Tizen.Multimedia.Remoting.Tests { [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")] @@ -1016,7 +1016,7 @@ namespace Tizen.Multimedia.Remoting.Tests { [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")] @@ -1075,7 +1075,7 @@ namespace Tizen.Multimedia.Remoting.Tests { [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")] @@ -1117,7 +1117,7 @@ namespace Tizen.Multimedia.Remoting.Tests { [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")] @@ -1132,5 +1132,58 @@ namespace Tizen.Multimedia.Remoting.Tests { Assert.That(() => _webRtc.IceTransportPolicy, Throws.TypeOf(), "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(() => _webRtc.BundlePolicy = WebRTCBundlePolicy.None, + "Should throws ObjectDisposedException"); + + Assert.That(() => _webRtc.BundlePolicy, Throws.TypeOf(), + "Should throws ObjectDisposedException"); + } } }