From: Haesu Gwon Date: Mon, 7 Aug 2023 02:03:59 +0000 (+0900) Subject: [TCSACR-544][WebRTC] Add WebRTC display feature for video APIs X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b990c8b28d1b39a65e4beacdbff5f9f581e071e4;p=test%2Ftct%2Fcsharp%2Fapi.git [TCSACR-544][WebRTC] Add WebRTC display feature for video APIs Change-Id: Ia9f77bff7eb86e858c7deded414129ed7be69973 --- diff --git a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaSource.cs b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaSource.cs index 931b556..5093b1a 100755 --- a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaSource.cs +++ b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaSource.cs @@ -791,7 +791,7 @@ namespace Tizen.Multimedia.Remoting.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] - public void EnableAudioLoopback_THROWS_POLICY_IS_NULL() + public void EnableAudioLoopback_THROWS_IF_POLICY_IS_NULL() { var source = new MediaTestSource(MediaType.Audio); _offerClient.AddSource(source); @@ -807,7 +807,7 @@ namespace Tizen.Multimedia.Remoting.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] - public void EnableAudioLoopback_THROWS_SOURCE_IS_NOT_AUDIO() + public void EnableAudioLoopback_THROWS_IF_SOURCE_IS_NOT_AUDIO() { var source = new MediaTestSource(MediaType.Video); _offerClient.AddSource(source); @@ -823,7 +823,7 @@ namespace Tizen.Multimedia.Remoting.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] - public void EnableAudioLoopback_THROWS_POLICY_ALREADY_DISPOSED() + public void EnableAudioLoopback_THROWS_IF_POLICY_ALREADY_DISPOSED() { var source = new MediaTestSource(MediaType.Audio); _offerClient.AddSource(source); @@ -842,7 +842,7 @@ namespace Tizen.Multimedia.Remoting.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] - public void EnableAudioLoopback_THROWS_WEBRTC_ALREADY_DISPOSED() + public void EnableAudioLoopback_THROWS_IF_WEBRTC_ALREADY_DISPOSED() { var source = new MediaTestSource(MediaType.Audio); _offerClient.AddSource(source); @@ -879,7 +879,7 @@ namespace Tizen.Multimedia.Remoting.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] - public void EnableVideoLoopback_THROWS_DISPLAY_IS_ALREADY_ALLOCATED() + public void EnableVideoLoopback_THROWS_IF_DISPLAY_IS_ALREADY_ALLOCATED() { var source = new MediaTestSource(MediaType.Video); var display = new Display(CreateWindow()); @@ -898,7 +898,7 @@ namespace Tizen.Multimedia.Remoting.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] - public void EnableVideoLoopback_THROWS_POLICY_IS_NULL() + public void EnableVideoLoopback_THROWS_IF_POLICY_IS_NULL() { var source = new MediaTestSource(MediaType.Video); _offerClient.AddSource(source); @@ -914,7 +914,7 @@ namespace Tizen.Multimedia.Remoting.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] - public void EnableVideoLoopback_THROWS_SOURCE_IS_NOT_VIDEO() + public void EnableVideoLoopback_THROWS_IF_SOURCE_IS_NOT_VIDEO() { var source = new MediaTestSource(MediaType.Audio); _offerClient.AddSource(source); @@ -930,7 +930,7 @@ namespace Tizen.Multimedia.Remoting.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] - public void EnableVideoLoopback_THROWS_ALREADY_DISPOSED() + public void EnableVideoLoopback_THROWS_IF_ALREADY_DISPOSED() { var source = new MediaTestSource(MediaType.Video); _offerClient.AddSource(source); @@ -942,6 +942,29 @@ namespace Tizen.Multimedia.Remoting.Tests } [Test] + [Category("P2")] + [Description("Check EnableVideoLoopback whether throws NotSupportedException if display feature is not supported.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.MediaSource.EnableVideoLoopback M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void EnableVideoLoopback_THROWS_IF_NOT_SUPPORTED() + { + if (!FeatureChecker.IsSupported(Features.Display)) + { + var source = new MediaTestSource(MediaType.Video); + _offerClient.AddSource(source); + + Assert.That(() => source.EnableVideoLoopback(new Display(CreateWindow())), + Throws.TypeOf(), "Should throw NotSupportedException"); + } + else + { + Assert.Pass("display feature is supported. So this TC cannot be tested."); + } + } + + [Test] [Category("P1")] [Description("Check whether EncoderBitrate returns expected value or not.")] [Property("SPEC", "Tizen.Multimedia.Remoting.MediaSource.EncoderBitrate A")] diff --git a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaStreamTrack.cs b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaStreamTrack.cs index 2828c81..75d6b3b 100755 --- a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaStreamTrack.cs +++ b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaStreamTrack.cs @@ -190,6 +190,50 @@ namespace Tizen.Multimedia.Remoting.Tests } [Test] + [Category("P2")] + [Description("Check whether Display throw exception when display feature is not supported.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.MediaStreamTrack.Display A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public async Task Display_THROWS_IF_NOT_SUPPORTED() + { + var window = CreateWindow(); + + var tcsAnswerTrackAdded = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + + EventHandler eventHandler = (s, e) => + tcsAnswerTrackAdded.TrySetResult(e.MediaStreamTrack); + + _answerClient.TrackAdded += eventHandler; + + try + { + _offerClient.AddSource(new MediaTestSource(MediaType.Video)); + + await ConnectPeerAsync(_offerClient, _answerClient); + + var mediaStreamTrack = await tcsAnswerTrackAdded.Task; + + if (!FeatureChecker.IsSupported(Features.Display)) + { + Assert.That(() => mediaStreamTrack.Display = new Display(window), Throws.TypeOf(), + "Should throw NotSupportedException"); + + await Task.Delay(1000); + } + else + { + Assert.Pass("display feature is supported. So this TC cannot be tested."); + } + } + finally + { + _answerClient.TrackAdded -= eventHandler; + } + } + + [Test] [Category("P1")] [Description("Check whether DisplayMode returns expected value or not.")] [Property("SPEC", "Tizen.Multimedia.Remoting.MediaStreamTrack.DisplayMode A")] @@ -388,6 +432,48 @@ namespace Tizen.Multimedia.Remoting.Tests [Test] [Category("P2")] + [Description("Check whether DisplayMode throws exception when display feature is not supported.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.MediaStreamTrack.DisplayMode A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public async Task DisplayMode_THROWS_IF_NOT_SUPPORTED() + { + var tcsAnswerTrackAdded = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + + EventHandler eventHandler = (s, e) => + tcsAnswerTrackAdded.TrySetResult(e.MediaStreamTrack); + + _answerClient.TrackAdded += eventHandler; + + try + { + _offerClient.AddSource(new MediaTestSource(MediaType.Audio)); + + await ConnectPeerAsync(_offerClient, _answerClient); + + var track = await tcsAnswerTrackAdded.Task; + + if (!FeatureChecker.IsSupported(Features.Display)) + { + Assert.That(() => track.DisplayMode = WebRTCDisplayMode.OriginSize, Throws.TypeOf(), + "Should throw NotSupportedException"); + + await Task.Delay(1000); + } + else + { + Assert.Pass("display feature is supported. So this TC cannot be tested."); + } + } + finally + { + _answerClient.TrackAdded -= eventHandler; + } + } + + [Test] + [Category("P2")] [Description("Check whether DisplayVisible throws exception when Display property is not set.")] [Property("SPEC", "Tizen.Multimedia.Remoting.MediaStreamTrack.DisplayVisible A")] [Property("SPEC_URL", "-")] @@ -457,6 +543,48 @@ namespace Tizen.Multimedia.Remoting.Tests } [Test] + [Category("P2")] + [Description("Check whether DisplayVisible throws exception when display feature is not supported.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.MediaStreamTrack.DisplayVisible A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public async Task DisplayVisible_THROWS_IF_NOT_SUPPORTED() + { + var tcsAnswerTrackAdded = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + + EventHandler eventHandler = (s, e) => + tcsAnswerTrackAdded.TrySetResult(e.MediaStreamTrack); + + _answerClient.TrackAdded += eventHandler; + + try + { + _offerClient.AddSource(new MediaTestSource(MediaType.Audio)); + + await ConnectPeerAsync(_offerClient, _answerClient); + + var track = await tcsAnswerTrackAdded.Task; + + if (!FeatureChecker.IsSupported(Features.Display)) + { + Assert.That(() => track.DisplayVisible = true, Throws.TypeOf(), + "Should throw NotSupportedException"); + + await Task.Delay(1000); + } + else + { + Assert.Pass("display feature is supported. So this TC cannot be tested."); + } + } + finally + { + _answerClient.TrackAdded -= eventHandler; + } + } + + [Test] [Category("P1")] [Description("Check whether ApplyAudioStreamPolicy returns expected value or not.")] [Property("SPEC", "Tizen.Multimedia.Remoting.MediaStreamTrack.ApplyAudioStreamPolicy M")] diff --git a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.cs b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.cs index de0f462..f18e966 100755 --- a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.cs +++ b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.cs @@ -810,6 +810,26 @@ namespace Tizen.Multimedia.Remoting.Tests { } [Test] + [Category("P2")] + [Description("Test AddSource whether throws NotSupportedException if display feature is not supported in MediaScreenSource.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTC.AddSource M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void AddSource_THROWS_IF_NOT_SUPPORTED_WITH_MEDIASCREENSOURCE() + { + if (!FeatureChecker.IsSupported(Features.Display)) + { + Assert.That(() => _webRtc.AddSource(new MediaScreenSource()), + Throws.TypeOf(), "Should throw NotSupportedException"); + } + else + { + Assert.Pass("display feature is supported. So this TC cannot be tested."); + } + } + + [Test] [Category("P1")] [Description("Test AddSources whether throws exception or not.")] [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTC.AddSources M")] @@ -882,6 +902,26 @@ namespace Tizen.Multimedia.Remoting.Tests { } [Test] + [Category("P2")] + [Description("Test AddSources whether throws NotSupportedException if display feature is not supported in MediaScreenSource.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTC.AddSources M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void AddSources_THROWS_IF_NOT_SUPPORTED_WITH_MEDIASCREENSOURCE() + { + if (!FeatureChecker.IsSupported(Features.Display)) + { + Assert.That(() => _webRtc.AddSources(new MediaScreenSource()), + Throws.TypeOf(), "Should throw NotSupportedException"); + } + else + { + Assert.Pass("display feature is supported. So this TC cannot be tested."); + } + } + + [Test] [Category("P1")] [Description("Test RemoveSource whether throws exception or not.")] [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTC.RemoveSource M")] diff --git a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.statistics.cs b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.statistics.cs index 7b927e4..83f7654 100755 --- a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.statistics.cs +++ b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.statistics.cs @@ -36,8 +36,6 @@ namespace Tizen.Multimedia.Remoting.Tests { WebRTCStatisticsCategory.LocalCandidate | WebRTCStatisticsCategory.RemoteCandidate; - private readonly string _turnServer = "turn://turnserver.address"; - [SetUp] public void Init() { diff --git a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCIceCandidateEventArgs.cs b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCIceCandidateEventArgs.cs index 672741e..50adf4e 100755 --- a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCIceCandidateEventArgs.cs +++ b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCIceCandidateEventArgs.cs @@ -27,8 +27,6 @@ namespace Tizen.Multimedia.Remoting.Tests { // TaskCompletionSource _tcsOfferStatePlaying, _tcsAnswerStatePlaying; TaskCompletionSource _tcsOfferIceGatheringStateCompleted, _tcsAnswerIceGatheringStateCompleted; - TaskCompletionSource _tcsOfferIceConnectionStateCompleted, _tcsAnswerIceConnectionStateCompleted; - TaskCompletionSource _tcsAnswerTrackAdded; List _offerIceCandidate, _answerIceCandidate; diff --git a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/support/Features.cs b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/support/Features.cs index 098e105..5bdba42 100755 --- a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/support/Features.cs +++ b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/support/Features.cs @@ -2,4 +2,5 @@ internal static class Features { public const string Microphone = "http://tizen.org/feature/microphone"; public const string Camera = "http://tizen.org/feature/camera"; + public const string Display = "http://tizen.org/feature/display"; }