[TCSACR-544][WebRTC] Add WebRTC display feature for video APIs 69/296869/1
authorHaesu Gwon <haesu.gwon@samsung.com>
Mon, 7 Aug 2023 02:03:59 +0000 (11:03 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Mon, 7 Aug 2023 02:03:59 +0000 (11:03 +0900)
Change-Id: Ia9f77bff7eb86e858c7deded414129ed7be69973

tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaSource.cs
tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaStreamTrack.cs
tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.cs
tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTC.statistics.cs
tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCIceCandidateEventArgs.cs
tct-suite-vs/Tizen.WebRTC.Tests/testcase/support/Features.cs

index 931b556..5093b1a 100755 (executable)
@@ -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<NotSupportedException>(), "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")]
index 2828c81..75d6b3b 100755 (executable)
@@ -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<MediaStreamTrack>(TaskCreationOptions.RunContinuationsAsynchronously);
+
+            EventHandler<WebRTCTrackAddedEventArgs> 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<NotSupportedException>(),
+                        "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<MediaStreamTrack>(TaskCreationOptions.RunContinuationsAsynchronously);
+
+            EventHandler<WebRTCTrackAddedEventArgs> 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<NotSupportedException>(),
+                        "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<MediaStreamTrack>(TaskCreationOptions.RunContinuationsAsynchronously);
+
+            EventHandler<WebRTCTrackAddedEventArgs> 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<NotSupportedException>(),
+                        "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")]
index de0f462..f18e966 100755 (executable)
@@ -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<NotSupportedException>(), "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<NotSupportedException>(), "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")]
index 7b927e4..83f7654 100755 (executable)
@@ -36,8 +36,6 @@ namespace Tizen.Multimedia.Remoting.Tests {
                                                                               WebRTCStatisticsCategory.LocalCandidate |
                                                                               WebRTCStatisticsCategory.RemoteCandidate;
 
-        private readonly string _turnServer = "turn://turnserver.address";
-
         [SetUp]
         public void Init()
         {
index 672741e..50adf4e 100755 (executable)
@@ -27,8 +27,6 @@ namespace Tizen.Multimedia.Remoting.Tests {
 
         // TaskCompletionSource<bool> _tcsOfferStatePlaying, _tcsAnswerStatePlaying;
         TaskCompletionSource<bool> _tcsOfferIceGatheringStateCompleted, _tcsAnswerIceGatheringStateCompleted;
-        TaskCompletionSource<bool> _tcsOfferIceConnectionStateCompleted, _tcsAnswerIceConnectionStateCompleted;
-        TaskCompletionSource<bool> _tcsAnswerTrackAdded;
 
         List<string> _offerIceCandidate, _answerIceCandidate;
 
index 098e105..5bdba42 100755 (executable)
@@ -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";
 }