From: Wootak Jung Date: Mon, 12 Oct 2020 02:12:52 +0000 (+0900) Subject: [Bluetooth][Non-ACR] Fix TC test scenario X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ddc1a75de821c83b226268233e6d07c2190abcb4;p=test%2Ftct%2Fcsharp%2Fapi.git [Bluetooth][Non-ACR] Fix TC test scenario Change-Id: I02cc3d5a807d9032f81445d3429dde1834d08872 Signed-off-by: Wootak Jung --- diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAvrcpControl.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAvrcpControl.cs index c2a7299..7ddd22b 100644 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAvrcpControl.cs +++ b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAvrcpControl.cs @@ -13,13 +13,12 @@ namespace Tizen.Network.Bluetooth.Tests public class BluetoothAvrcpControlTests { private BluetoothAvrcpControl _avrcpControlProfile = null; - private BluetoothAudio _audioProfile = null; - private bool _isBluetoothAudioControlSupported = false; - private bool _isPositionPropertyReadPassed = false; - private bool _isPlayStatePropertyReadPassed = false; - private bool _isTrackDataPropertyReadPassed = false; - private bool _isIsConnectedPropertyReadPassed = false; - private bool _isRemoteAddressPropertyReadPassed = false; + private static bool _isBluetoothAudioControlSupported = false; + private static bool _isPositionPropertyReadPassed = false; + private static bool _isPlayStatePropertyReadPassed = false; + private static bool _isTrackDataPropertyReadPassed = false; + private static bool _isIsConnectedPropertyReadPassed = false; + private static bool _isRemoteAddressPropertyReadPassed = false; [SetUp] public void Init() @@ -57,12 +56,6 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); @@ -82,7 +75,7 @@ namespace Tizen.Network.Bluetooth.Tests }; _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); await ManualTest.WaitForConfirm(); _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; } @@ -92,10 +85,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -130,12 +122,6 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); @@ -151,7 +137,7 @@ namespace Tizen.Network.Bluetooth.Tests }; _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); await ManualTest.WaitForConfirm(); _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; } @@ -161,10 +147,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -199,12 +184,6 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); @@ -220,7 +199,7 @@ namespace Tizen.Network.Bluetooth.Tests }; _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); await ManualTest.WaitForConfirm(); _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; } @@ -230,10 +209,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -255,8 +233,6 @@ namespace Tizen.Network.Bluetooth.Tests { try { - uint originValue = 0; - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ if (_isBluetoothAudioControlSupported == false) { @@ -265,12 +241,6 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); @@ -282,14 +252,12 @@ namespace Tizen.Network.Bluetooth.Tests PositionChanged = (sender, e) => { Assert.IsInstanceOf(e.Position, "Position value is not of type uint"); - Assert.AreNotEqual(e.Position, originValue, "Position value is same original value"); _isPositionPropertyReadPassed = true; BluetoothHelper.DisplayPassLabel("PositionChanged_CHECK_EVENT"); }; - originValue = _avrcpControlProfile.GetPosition(); _avrcpControlProfile.PositionChanged += PositionChanged; - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); await ManualTest.WaitForConfirm(); _avrcpControlProfile.PositionChanged -= PositionChanged; } @@ -299,10 +267,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -324,8 +291,6 @@ namespace Tizen.Network.Bluetooth.Tests { try { - uint originValue = 0; - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ if (_isBluetoothAudioControlSupported == false) { @@ -341,12 +306,6 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); @@ -358,13 +317,11 @@ namespace Tizen.Network.Bluetooth.Tests PositionChanged = (sender, e) => { Assert.IsInstanceOf(e.Position, "Position value is not of type uint"); - Assert.AreNotEqual(e.Position, originValue, "Position value is same original value"); BluetoothHelper.DisplayPassLabel("Position_PROPERTY_READ_ONLY"); }; - originValue = _avrcpControlProfile.GetPosition(); _avrcpControlProfile.PositionChanged += PositionChanged; - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); await ManualTest.WaitForConfirm(); _avrcpControlProfile.PositionChanged -= PositionChanged; } @@ -374,10 +331,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -399,8 +355,6 @@ namespace Tizen.Network.Bluetooth.Tests { try { - PlayerState originValue = 0; - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ if (_isBluetoothAudioControlSupported == false) { @@ -409,12 +363,6 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); @@ -426,14 +374,12 @@ namespace Tizen.Network.Bluetooth.Tests PlayStateChanged = (sender, e) => { Assert.IsInstanceOf(e.PlayState, "PlayState value is not of type PlayerState"); - Assert.AreNotEqual(e.PlayState, originValue, "PlayState value is same original value"); _isPlayStatePropertyReadPassed = true; BluetoothHelper.DisplayPassLabel("PlayStateChanged_CHECK_EVENT"); }; - originValue = _avrcpControlProfile.GetPlayStatus(); _avrcpControlProfile.PlayStateChanged += PlayStateChanged; - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); await ManualTest.WaitForConfirm(); _avrcpControlProfile.PlayStateChanged -= PlayStateChanged; } @@ -443,10 +389,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -468,8 +413,6 @@ namespace Tizen.Network.Bluetooth.Tests { try { - PlayerState originValue = 0; - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ if (_isBluetoothAudioControlSupported == false) { @@ -485,12 +428,6 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); @@ -502,13 +439,11 @@ namespace Tizen.Network.Bluetooth.Tests PlayStateChanged = (sender, e) => { Assert.IsInstanceOf(e.PlayState, "PlayState value is not of type PlayerState"); - Assert.AreNotEqual(e.PlayState, originValue, "PlayState value is same original value"); BluetoothHelper.DisplayPassLabel("PlayState_PROPERTY_READ_ONLY"); }; - originValue = _avrcpControlProfile.GetPlayStatus(); _avrcpControlProfile.PlayStateChanged += PlayStateChanged; - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); await ManualTest.WaitForConfirm(); _avrcpControlProfile.PlayStateChanged -= PlayStateChanged; } @@ -518,10 +453,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -543,8 +477,6 @@ namespace Tizen.Network.Bluetooth.Tests { try { - Track originValue = new Track(); - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ if (_isBluetoothAudioControlSupported == false) { @@ -553,12 +485,6 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); @@ -570,14 +496,12 @@ namespace Tizen.Network.Bluetooth.Tests TrackInfoChanged = (sender, e) => { Assert.IsInstanceOf(e.TrackData, "TrackData value is not of type Track"); - Assert.AreNotEqual(e.TrackData, originValue, "TrackData value is same original value"); _isTrackDataPropertyReadPassed = true; BluetoothHelper.DisplayPassLabel("TrackInfoChanged_CHECK_EVENT"); }; - originValue = _avrcpControlProfile.GetTrackInfo(); _avrcpControlProfile.TrackInfoChanged += TrackInfoChanged; - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); await ManualTest.WaitForConfirm(); _avrcpControlProfile.TrackInfoChanged -= TrackInfoChanged; } @@ -587,10 +511,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -612,8 +535,6 @@ namespace Tizen.Network.Bluetooth.Tests { try { - Track originValue = new Track(); - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ if (_isBluetoothAudioControlSupported == false) { @@ -629,12 +550,6 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); @@ -646,13 +561,11 @@ namespace Tizen.Network.Bluetooth.Tests TrackInfoChanged = (sender, e) => { Assert.IsInstanceOf(e.TrackData, "TrackData value is not of type Track"); - Assert.AreNotEqual(e.TrackData, originValue, "TrackData value is same original value"); BluetoothHelper.DisplayPassLabel("TrackData_PROPERTY_READ_ONLY"); }; - originValue = _avrcpControlProfile.GetTrackInfo(); _avrcpControlProfile.TrackInfoChanged += TrackInfoChanged; - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); await ManualTest.WaitForConfirm(); _avrcpControlProfile.TrackInfoChanged -= TrackInfoChanged; } @@ -662,10 +575,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -693,21 +605,12 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); } - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - await _avrcpControlProfile.DisconnectAsync(); // Disconnecting AVRCP Control initially - EventHandler ControlConnectionChanged = null; ControlConnectionChanged = (sender, e) => { @@ -725,10 +628,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -756,27 +658,23 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); } - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - EventHandler ControlConnectionChanged = null; ControlConnectionChanged = (sender, e) => { - BluetoothHelper.DisplayPassLabel("DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST"); - _avrcpControlProfile.ConnectAsync(); //Reconnect AVRCP Control if TC passes + if (e.IsConnected == false) + { + BluetoothHelper.DisplayPassLabel("DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST"); + } }; _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; + await _avrcpControlProfile.ConnectAsync(); + await Task.Delay(3000); await _avrcpControlProfile.DisconnectAsync(); await ManualTest.WaitForConfirm(); _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; @@ -785,14 +683,6 @@ namespace Tizen.Network.Bluetooth.Tests { Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); } - finally - { - if (_audioProfile != null) - { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); - } - } } [Test] @@ -818,19 +708,13 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); } - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); PlayerState state = _avrcpControlProfile.GetPlayStatus(); bool result = Enum.IsDefined(typeof(PlayerState), state); Assert.True(result, "State value is not defined in enum"); @@ -842,10 +726,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -873,19 +756,13 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); } - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); uint state = _avrcpControlProfile.GetPosition(); Assert.IsInstanceOf(state, "State value is not of type uint"); } @@ -895,10 +772,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -926,23 +802,16 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); } - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); _avrcpControlProfile.EqualizerState = EqualizerState.On; EqualizerState state = _avrcpControlProfile.EqualizerState; Assert.IsInstanceOf(state, "State value is not of type EqualizerState"); - Assert.AreEqual(state, EqualizerState.On, "EqualizerState is not matching"); } catch (Exception ex) { @@ -950,10 +819,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -981,23 +849,16 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); } - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); _avrcpControlProfile.ShuffleMode = ShuffleMode.AllTrack; ShuffleMode state = _avrcpControlProfile.ShuffleMode; Assert.IsInstanceOf(state, "Mode value is not of type ShuffleMode"); - Assert.AreEqual(state, ShuffleMode.AllTrack, "ShuffleMode is not matching"); } catch (Exception ex) { @@ -1005,10 +866,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -1036,23 +896,16 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); } - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); _avrcpControlProfile.ScanMode = ScanMode.AllTrack; ScanMode state = _avrcpControlProfile.ScanMode; Assert.IsInstanceOf(state, "Mode value is not of type ScanMode"); - Assert.AreEqual(state, ScanMode.AllTrack, "ScanMode is not matching"); } catch (Exception ex) { @@ -1060,10 +913,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -1091,23 +943,16 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); } - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); _avrcpControlProfile.RepeatMode = RepeatMode.AllTrack; RepeatMode state = _avrcpControlProfile.RepeatMode; Assert.IsInstanceOf(state, "Mode value is not of type RepeatMode"); - Assert.AreEqual(state, RepeatMode.AllTrack, "RepeatMode is not matching"); } catch (Exception ex) { @@ -1115,10 +960,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -1146,19 +990,13 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); } - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); Track track = _avrcpControlProfile.GetTrackInfo(); Assert.IsInstanceOf(track, "track value is not of type Track"); } @@ -1168,10 +1006,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } } @@ -1199,19 +1036,13 @@ namespace Tizen.Network.Bluetooth.Tests return; } - if (_audioProfile == null) - { - _audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.AdvancedAudioDistributionSink); - Assert.IsNotNull(_audioProfile, "Precondtion failed: _audioProfile should not be null"); - } - if (_avrcpControlProfile == null) { _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: avrcpavrcpControlProfile Profile should not be null"); } - _audioProfile.Connect(BluetoothAudioProfileType.AdvancedAudioDistributionSink); + await _avrcpControlProfile.ConnectAsync(); _avrcpControlProfile.SendPlayerCommand(PlayerCommand.Next); //If there is no exception when method is called, the test is considered PASSED. } @@ -1221,10 +1052,9 @@ namespace Tizen.Network.Bluetooth.Tests } finally { - if (_audioProfile != null) + if (_avrcpControlProfile != null) { - _audioProfile.Disconnect(BluetoothAudioProfileType.All); - await Task.Delay(3000); + await _avrcpControlProfile.DisconnectAsync(); } } }