From: Haesu Gwon Date: Wed, 6 Jul 2022 07:45:53 +0000 (+0900) Subject: [TCSACR-480][WebRTC] Add new DataChannel buffered amount APIs X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F97%2F277397%2F2;p=test%2Ftct%2Fcsharp%2Fapi.git [TCSACR-480][WebRTC] Add new DataChannel buffered amount APIs Change-Id: I94bc651352fa226e843c971958f1a2553cfd079c --- diff --git a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCDataChannel.Events.cs b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCDataChannel.Events.cs index c69f8e2..c551030 100755 --- a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCDataChannel.Events.cs +++ b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCDataChannel.Events.cs @@ -162,5 +162,45 @@ namespace Tizen.Multimedia.Remoting.Tests { Assert.That(await tcsDataChannelMessageReceived.Task, "Event should be raised"); } + + [Test] + [Category("P1")] + [Description("Check whether BufferedAmountLow event is invoked or not.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTCDataChannel.BufferedAmountLow E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public async Task BufferedAmountLow_CHECK_EVENT() + { + var greetingMessage = "BufferedAmountLow event check message."; + + var tcsDataChannel = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var tcsDataChannelBufferedAmountLow = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + + _answerClient.DataChannel += (s, e) => + { + // DataChannel from peer + tcsDataChannel.TrySetResult(e.DataChannel); + }; + + await _offerClient.StartAsync(); + await _answerClient.StartAsync(); + + await ConnectPeerAsync(_offerClient, _answerClient); + + var answerDataChannel = await tcsDataChannel.Task; + + await _tcsAnswerTrackAdded.Task; + + _offerDataChannel.BufferedAmountLowThreshold = 10; + _offerDataChannel.BufferedAmountLow += (s, e) => + { + tcsDataChannelBufferedAmountLow.TrySetResult(true); + }; + + _offerDataChannel.Send(greetingMessage); + + Assert.That(await tcsDataChannelBufferedAmountLow.Task, "Event should be raised"); + } } } \ No newline at end of file diff --git a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCDataChannel.cs b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCDataChannel.cs index 938185e..5e06a3b 100755 --- a/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCDataChannel.cs +++ b/tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSWebRTCDataChannel.cs @@ -175,5 +175,92 @@ namespace Tizen.Multimedia.Remoting.Tests { Assert.That(() => webRtcDataChannel.Send(data), Throws.TypeOf(), "Should throw ObjectDisposedException"); } + + [Test] + [Category("P1")] + [Description("Check whether BufferedAmount returns expected value or not.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTCDataChannel.BufferedAmount A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void BufferedAmount_READ_ONLY() + { + using (var webRtcDataChannel = new WebRTCDataChannel(_webRtc, "test")) + { + Assert.That(() => webRtcDataChannel.BufferedAmount, Is.GreaterThanOrEqualTo(0), + "Should be greater than or equal to zero"); + AssertHelper.PropertyReadOnly(nameof(WebRTCDataChannel.BufferedAmount)); + } + } + + [Test] + [Category("P2")] + [Description("Check whether BufferedAmount throw ObjectDisposedException or not.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTCDataChannel.BufferedAmount A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void BufferedAmount_THROWS_IF_ALREADY_DISPOSED() + { + var webRtcDataChannel = new WebRTCDataChannel(_webRtc, "test"); + webRtcDataChannel.Dispose(); + + Assert.That(() => webRtcDataChannel.BufferedAmount, Throws.TypeOf(), + "Should throw ObjectDisposedException"); + } + + [Test] + [Category("P1")] + [Description("Check whether BufferedAmountLowThreshold returns expected value or not.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTCDataChannel.BufferedAmountLowThreshold A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void BufferedAmountLowThreshold_READ_WRITE() + { + using (var webRtcDataChannel = new WebRTCDataChannel(_webRtc, "test")) + { + Assert.That(() => webRtcDataChannel.BufferedAmountLowThreshold = 10, Throws.Nothing, + "Default value should be zero."); + + Assert.That(() => webRtcDataChannel.BufferedAmountLowThreshold, Is.EqualTo(10), + "Default value should be zero."); + } + } + + [Test] + [Category("P1")] + [Description("Check whether BufferedAmountLowThreshold returns expected value or not.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTCDataChannel.BufferedAmountLowThreshold A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void BufferedAmountLowThreshold_CHECK_DEFAULT_VALUE() + { + using (var webRtcDataChannel = new WebRTCDataChannel(_webRtc, "test")) + { + Assert.That(webRtcDataChannel.BufferedAmountLowThreshold, Is.EqualTo(0), + "Default value should be zero."); + } + } + + [Test] + [Category("P2")] + [Description("Check whether BufferedAmountLowThreshold throw ObjectDisposedException or not.")] + [Property("SPEC", "Tizen.Multimedia.Remoting.WebRTCDataChannel.BufferedAmountLowThreshold A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void BufferedAmountLowThreshold_THROWS_IF_ALREADY_DISPOSED() + { + var webRtcDataChannel = new WebRTCDataChannel(_webRtc, "test"); + webRtcDataChannel.Dispose(); + + Assert.That(() => webRtcDataChannel.BufferedAmountLowThreshold, Throws.TypeOf(), + "Should throw ObjectDisposedException"); + + Assert.That(() => webRtcDataChannel.BufferedAmountLowThreshold = 10, Throws.TypeOf(), + "Should throw ObjectDisposedException"); + } } } \ No newline at end of file