--- /dev/null
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using BluetoothNetworkUtils;
+using Tizen.System;
+using System.IO;
+using Tizen.Applications;
+
+namespace Tizen.Network.Bluetooth.Tests
+{
+ [TestFixture]
+ [Description("BluetoothOppClient Tests")]
+ public class BluetoothOppClientTests
+ {
+ static bool flagDiscovery = false;
+ static bool flagBondCreated = false;
+ static bool flagCancel = false;
+ static BluetoothDevice oppDevice = null;
+ static BluetoothDevice foundDevice = null;
+ static string remoteAddress = PreconditionUtils.GetOppAddress();
+ static bool isBluetoothOppSupported = false;
+
+ /* PASS flag Variaibles for TCs */
+ static bool pass_AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE = false;
+ static bool pass_PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE = false;
+ static bool pass_ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILES = false;
+ static bool pass_PushResponded_CHECK_EVENT = false;
+ static bool pass_Address_PushRespondedEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_Result_PushRespondedEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_PushProgress_CHECK_EVENT = false;
+ static bool pass_File_PushProgressEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_Size_PushProgressEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_Percent_PushProgressEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_PushFinished_CHECK_EVENT = false;
+ static bool pass_Address_PushFinishedEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_Result_PushFinishedEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH = false;
+
+ [SetUp]
+ public static void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
+ Information.TryGetValue("tizen.org/feature/network.bluetooth.opp", out isBluetoothOppSupported);
+ }
+
+ [TearDown]
+ public static void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
+ }
+
+ public static async Task WaitForBondflag()
+ {
+ int count = 0;
+ while(true)
+ {
+ await Task.Delay(200);
+ count++;
+ if (flagBondCreated)
+ break;
+ if (count == 100)
+ break;
+ }
+ }
+
+ public static async Task WaitForDiscoveryflag()
+ {
+ int count = 0;
+ while(true)
+ {
+ await Task.Delay(200);
+ count++;
+ if (flagDiscovery)
+ break;
+ if (count == 40)
+ break;
+ }
+ }
+
+ public static async Task WaitForCancelflag()
+ {
+ int count = 0;
+ while(true)
+ {
+ await Task.Delay(200);
+ count++;
+ if (flagCancel)
+ break;
+ if (count == 100)
+ break;
+ }
+ }
+
+ public static void BondingSetupBondCreated(object sender, BondCreatedEventArgs e)
+ {
+ if (e.Device != null && e.Result == 0)
+ {
+ flagBondCreated = true;
+ oppDevice = e.Device;
+ }
+ }
+
+ public static void EventHandlerDiscoveryChanged(object sender, DiscoveryStateChangedEventArgs e)
+ {
+ if (e.DiscoveryState == BluetoothDeviceDiscoveryState.Found)
+ {
+ if (flagDiscovery == true)
+ return;
+
+ if (e.DeviceFound.Address.Equals(remoteAddress))
+ {
+ foundDevice = e.DeviceFound;
+
+ LogUtils.Write (LogUtils.DEBUG, LogUtils.TAG, "Found the matching device: " + foundDevice.Address);
+ flagDiscovery = true;
+ }
+ }
+ }
+
+ public static async Task DiscoverySetup()
+ {
+ BluetoothAdapter.DiscoveryStateChanged += EventHandlerDiscoveryChanged;
+
+ if (BluetoothAdapter.IsDiscoveryInProgress)
+ {
+ BluetoothAdapter.StopDiscovery();
+ await Task.Delay(1000);
+ }
+
+ BluetoothAdapter.StartDiscovery();
+ await WaitForDiscoveryflag();
+
+ if (BluetoothAdapter.IsDiscoveryInProgress)
+ {
+ BluetoothAdapter.StopDiscovery();
+ await Task.Delay(1000);
+ }
+ BluetoothAdapter.DiscoveryStateChanged -= EventHandlerDiscoveryChanged;
+ }
+
+ public static async Task BondingSetup()
+ {
+ foundDevice.BondCreated += BondingSetupBondCreated;
+ foundDevice.CreateBond();
+ await WaitForBondflag();
+
+ foundDevice.BondCreated -= BondingSetupBondCreated;
+ }
+
+ public async Task OppClientCombine_TEST()
+ {
+ try
+ {
+ oppDevice = BluetoothAdapter.GetBondedDevice(remoteAddress);
+ }
+ catch (Exception ex)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Device is not bonded : " + ex.ToString());
+ }
+
+ try
+ {
+ BluetoothOppClient oppClient = null;
+ string filePath = Path.Combine(Application.Current.DirectoryInfo.SharedResource, "test1.jpg");
+ string largeFilePath = Path.Combine(Application.Current.DirectoryInfo.SharedResource, "SampleMP3.mp3");
+
+ if (oppDevice == null)
+ {
+ await DiscoverySetup();
+ Assert.IsNotNull (foundDevice, "found device should not be null");
+
+ await BondingSetup();
+ flagBondCreated = false;
+
+ /* Wait for ACL disconnect */
+ await Task.Delay(6000);
+ }
+
+ Assert.IsNotNull (oppDevice, "oppDevice should not be null");
+
+ oppClient = oppDevice.GetProfile<BluetoothOppClient>();
+ Assert.IsNotNull (oppClient, "oppClient should not be null");
+
+ EventHandler<PushProgressEventArgs> EventHandlerPushProgress = null;
+
+ EventHandlerPushProgress = (sender, e) => {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "File : " + e.File + " Size : " + e.Size + " Percent : " + e.Percent + "%");
+
+ /* PASS condition for File_PushProgressEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsNotNull(e.File, "[OppClientCombine_TEST][PushProgressEventArgs][File] Failed");
+ Assert.IsInstanceOf<string>(e.File, "[OppClientCombine_TEST][PushProgressEventArgs][File] Failed");
+ Assert.True(String.Equals(e.File, largeFilePath), "[OppClientCombine_TEST][PushProgressEventArgs][File] Failed");
+ pass_File_PushProgressEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for Size_PushProgressEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsInstanceOf<long>(e.Size, "[OppClientCombine_TEST][PushProgressEventArgs][Size] Failed");
+ Assert.IsTrue(e.Size >= 0, "[OppClientCombine_TEST][PushProgressEventArgs][Size] Failed");
+ pass_Size_PushProgressEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for Percent_PushProgressEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsInstanceOf<int>(e.Percent, "[OppClientCombine_TEST][PushProgressEventArgs][Percent] Failed");
+ Assert.IsTrue(e.Percent >= 0, "[OppClientCombine_TEST][PushProgressEventArgs][Percent] Failed");
+ pass_Percent_PushProgressEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for PushProgress_CHECK_EVENT */
+ pass_PushProgress_CHECK_EVENT = true;
+
+ try
+ {
+ /* PASS condition for CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH */
+ oppClient.CancelPush();
+ flagCancel = true;
+ pass_CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH = true;
+ oppClient.PushProgress -= EventHandlerPushProgress;
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][OppClientCombine_TEST][CancelPush] FAIL " + ex.Message);
+ }
+ };
+
+ oppClient.PushProgress += EventHandlerPushProgress;
+
+ /* PASS condition for AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE */
+ oppClient.AddFile(largeFilePath);
+ pass_AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE = true;
+
+ /* PASS condition for PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE */
+ oppClient.PushFile(oppDevice.Address);
+ pass_PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE = true;
+
+ /* PASS condition for ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILES */
+ oppClient.ClearFiles();
+ pass_ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILES = true;
+
+ await WaitForCancelflag();
+
+ /* Wait for ACL disconnect */
+ await Task.Delay(5000);
+
+ EventHandler<PushRespondedEventArgs> EventHandlerPushResponsed = null;
+
+ EventHandlerPushResponsed = (sender, e) => {
+ /* PASS condition for Result_PushRespondedEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsTrue((int)e.Result == 0, "[OppClientCombine_TEST][PushRespondedEventArgs][Result] Failed");
+ pass_Result_PushRespondedEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for Address_PushRespondedEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsNotNull(e.Address, "[OppClientCombine_TEST][PushRespondedEventArgs][Address] Failed");
+ Assert.IsInstanceOf<string>(e.Address, "[OppClientCombine_TEST][PushRespondedEventArgs][Address] Failed");
+ Assert.True(String.Equals(e.Address, oppDevice.Address), "[OppClientCombine_TEST][PushRespondedEventArgs][Address] Failed");
+ pass_Address_PushRespondedEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for PushResponded_CHECK_EVENT */
+ pass_PushResponded_CHECK_EVENT = true;
+
+ oppClient.PushResponded -= EventHandlerPushResponsed;
+ };
+
+ EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
+
+ EventHandlerPushFinished = (sender, e) => {
+ /* PASS condition for Address_PushFinishedEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsNotNull(e.Address, "[OppClientCombine_TEST][PushFinishedEventArgs][Address] Failed");
+ Assert.IsInstanceOf<string>(e.Address, "[OppClientCombine_TEST][PushFinishedEventArgs][Address] Failed");
+ Assert.True(String.Equals(e.Address, oppDevice.Address), "[OppClientCombine_TEST][PushFinishedEventArgs][Address] Failed");
+ pass_Address_PushFinishedEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for Result_PushFinishedEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsTrue((int)e.Result == 0, "[OppClientCombine_TEST][PushFinishedEventArgs][Result] Failed");
+ pass_Result_PushFinishedEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for PushFinished_CHECK_EVENT */
+ pass_PushFinished_CHECK_EVENT = true;
+
+ oppClient.PushFinished -= EventHandlerPushFinished;
+
+ BluetoothHelper.DisplayPassLabel("OppClientCombine_TEST");
+ };
+
+ oppClient.PushResponded += EventHandlerPushResponsed;
+
+ oppClient.PushFinished += EventHandlerPushFinished;
+
+ oppClient.AddFile(filePath);
+
+ oppClient.PushFile(oppDevice.Address);
+
+ oppClient.ClearFiles();
+
+ await ManualTest.WaitForConfirm();
+ }
+ catch (Exception ex)
+ {
+ Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test AddFile, check if AddFile method works properly")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.AddFile M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE, "[TestCase][AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test PushFile, check if PushFile method works properly")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushFile M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE, "[TestCase][PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test CancelPush, check if CancelPush method works properly")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.CancelPush M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH, "[TestCase][CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ClearFiles, check if ClearFiles method works properly")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.ClearFiles M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILES()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILES");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILES == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILES, "[TestCase][ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILES] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test PushResponded, check if PushResponded event is proper")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushResponded E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task PushResponded_CHECK_EVENT()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("PushResponded_CHECK_EVENT");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_PushResponded_CHECK_EVENT == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_PushResponded_CHECK_EVENT, "[TestCase][PushResponded_CHECK_EVENT] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Address, check if Address has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.PushRespondedEventArgs.Address A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task Address_PushRespondedEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("Address_PushRespondedEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_Address_PushRespondedEventArgs_PROPERTY_READ_ONLY == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_Address_PushRespondedEventArgs_PROPERTY_READ_ONLY, "[TestCase][Address_PushRespondedEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Result, check if Result has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.PushRespondedEventArgs.Result A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task Result_PushRespondedEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("Result_PushRespondedEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_Result_PushRespondedEventArgs_PROPERTY_READ_ONLY == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_Result_PushRespondedEventArgs_PROPERTY_READ_ONLY, "[TestCase][Result_PushRespondedEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test PushProgress, check if PushProgress event is proper")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushProgress E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task PushProgress_CHECK_EVENT()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("PushProgress_CHECK_EVENT");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_PushProgress_CHECK_EVENT == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_PushProgress_CHECK_EVENT, "[TestCase][PushProgress_CHECK_EVENT] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test File, check if File has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.PushProgressEventArgs.File A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task File_PushProgressEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("File_PushProgressEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_File_PushProgressEventArgs_PROPERTY_READ_ONLY == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_File_PushProgressEventArgs_PROPERTY_READ_ONLY, "[TestCase][File_PushProgressEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Size, check if Size has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.PushProgressEventArgs.Size A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task Size_PushProgressEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("Size_PushProgressEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_Size_PushProgressEventArgs_PROPERTY_READ_ONLY == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_Size_PushProgressEventArgs_PROPERTY_READ_ONLY, "[TestCase][Size_PushProgressEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Percent, check if Percent has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.PushProgressEventArgs.Percent A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task Percent_PushProgressEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("Percent_PushProgressEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_Percent_PushProgressEventArgs_PROPERTY_READ_ONLY == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_Percent_PushProgressEventArgs_PROPERTY_READ_ONLY, "[TestCase][Percent_PushProgressEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test PushFinished, check if PushFinished event is proper")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushFinished E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task PushFinished_CHECK_EVENT()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("PushFinished_CHECK_EVENT");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_PushFinished_CHECK_EVENT == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_PushFinished_CHECK_EVENT, "[TestCase][PushFinished_CHECK_EVENT] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Address, check if Address has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.PushFinishedEventArgs.Address A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task Address_PushFinishedEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("Address_PushFinishedEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_Address_PushFinishedEventArgs_PROPERTY_READ_ONLY == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_Address_PushFinishedEventArgs_PROPERTY_READ_ONLY, "[TestCase][Address_PushFinishedEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Result, check if Result has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.PushFinishedEventArgs.Result A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Precondition(2, "Paired with the remote OPP server device")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task Result_PushFinishedEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("Result_PushFinishedEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_Result_PushFinishedEventArgs_PROPERTY_READ_ONLY == false)
+ await OppClientCombine_TEST();
+
+ Assert.True(pass_Result_PushFinishedEventArgs_PROPERTY_READ_ONLY, "[TestCase][Result_PushFinishedEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Threading.Tasks;
+using System.Linq;
+using BluetoothNetworkUtils;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System.Collections.Generic;
+using Tizen.System;
+
+namespace Tizen.Network.Bluetooth.Tests
+{
+ [TestFixture]
+ [Description("BluetoothOppServer Tests")]
+ public class BluetoothOppServerTests
+ {
+ static bool flagCancel = false;
+ static bool isBluetoothOppSupported = false;
+
+ /* PASS flag Variaibles for TCs */
+ static bool pass_RejectPush_CHECK_FOR_REJECT_PUSH = false;
+ static bool pass_CancelTransfer_CHECK_FOR_CANCEL_TRANSFER = false;
+ static bool pass_AcceptPush_CHECK_FOR_ACCEPT_PUSH = false;
+ static bool pass_ConnectionRequested_CHECK_EVENT = false;
+ static bool pass_Address_ConnectionRequestedEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_TransferProgress_CHECK_EVENT = false;
+ static bool pass_File_TransferProgressEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_Size_TransferProgressEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_Percent_TransferProgressEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_TransferFinished_CHECK_EVENT = false;
+ static bool pass_File_TransferFinishedEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_Size_TransferFinishedEventArgs_PROPERTY_READ_ONLY = false;
+ static bool pass_Result_TransferFinishedEventArgs_PROPERTY_READ_ONLY = false;
+
+ public enum TestState { Reject, Cancel, Normal }
+
+ [SetUp]
+ public static void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
+ Information.TryGetValue("tizen.org/feature/network.bluetooth.opp", out isBluetoothOppSupported);
+ }
+
+ [TearDown]
+ public static void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
+ }
+
+ public static async Task WaitForCancelflag()
+ {
+ int count = 0;
+ while(true)
+ {
+ await Task.Delay(200);
+ count++;
+ if (flagCancel)
+ break;
+ if (count == 150)
+ break;
+ }
+ }
+
+ public async Task OppServerCombine_TEST()
+ {
+ BluetoothOppServer oppServer = null;
+
+ try
+ {
+ string filePath = StorageManager.Storages.Where(s => s.StorageType == StorageArea.Internal).FirstOrDefault().RootDirectory + "/Downloads";
+ string fileName = "test1.jpg";
+ TestState state = TestState.Reject;
+ int transferId = 0;
+
+ oppServer = BluetoothOppServer.StartServer(filePath);
+ Assert.IsNotNull (oppServer, "oppServer should not be null");
+
+ /* 1. Reject Transfer */
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ /* PASS condition for ConnectionRequested_CHECK_EVENT */
+ pass_ConnectionRequested_CHECK_EVENT = true;
+
+ if (state == TestState.Reject)
+ {
+ /* PASS condition for RejectPush_CHECK_FOR_REJECT_PUSH */
+ oppServer.RejectPush();
+ pass_RejectPush_CHECK_FOR_REJECT_PUSH = true;
+ BluetoothHelper.DisplayCustomLabel("Reject [Success]. Please Retry to transfer from client.");
+ flagCancel = true;
+ }
+ else
+ {
+ /* PASS condition for Address_ConnectionRequestedEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsNotNull(e.Address, "[OppServerCombine_TEST][ConnectionRequestedEventArgs][Address] Failed");
+ Assert.IsInstanceOf<string>(e.Address, "[OppServerCombine_TEST][ConnectionRequestedEventArgs][Address] Failed");
+ pass_Address_ConnectionRequestedEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for AcceptPush_CHECK_FOR_ACCEPT_PUSH */
+ transferId = oppServer.AcceptPush(fileName);
+ pass_AcceptPush_CHECK_FOR_ACCEPT_PUSH = true;
+ }
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[OppServerCombine_TEST] Failed " + ex.Message);
+ }
+ };
+
+ EventHandler<TransferProgressEventArgs> EventHandlerTransferProgress = null;
+
+ EventHandlerTransferProgress = (sender, e) => {
+ oppServer.TransferProgress -= EventHandlerTransferProgress;
+
+ /* PASS condition for TransferProgress_CHECK_EVENT */
+ pass_TransferProgress_CHECK_EVENT = true;
+
+ /* PASS condition for File_TransferProgressEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsNotNull(e.File, "[OppServerCombine_TEST][TransferProgressEventArgs][File] Failed");
+ Assert.IsInstanceOf<string>(e.File, "[OppServerCombine_TEST][TransferProgressEventArgs][File] Failed");
+ pass_File_TransferProgressEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for Size_TransferProgressEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsInstanceOf<long>(e.Size, "[OppServerCombine_TEST][TransferProgressEventArgs][Size] Failed");
+ Assert.IsTrue(e.Size >= 0, "[OppServerCombine_TEST][TransferProgressEventArgs][Size] Failed");
+ pass_Size_TransferProgressEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for Percent_TransferProgressEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsInstanceOf<int>(e.Percent, "[OppServerCombine_TEST][TransferProgressEventArgs][Percent] Failed");
+ Assert.IsTrue(e.Percent >= 0, "[OppServerCombine_TEST][TransferProgressEventArgs][Percent] Failed");
+ pass_Percent_TransferProgressEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for CancelTransfer_CHECK_FOR_CANCEL_TRANSFER */
+ oppServer.CancelTransfer(transferId);
+ pass_CancelTransfer_CHECK_FOR_CANCEL_TRANSFER = true;
+
+ BluetoothHelper.DisplayCustomLabel("Cancel [Success]. Please Retry to transfer from client.");
+ flagCancel = true;
+ };
+
+ oppServer.ConnectionRequested += EventHandlerConnectionRequested;
+ await WaitForCancelflag();
+
+ /* Wait for ACL disconnect */
+ await Task.Delay(4000);
+
+ /* 2. Cancel Transfer */
+ state = TestState.Cancel;
+ flagCancel = false;
+ oppServer.TransferProgress += EventHandlerTransferProgress;
+
+ await WaitForCancelflag();
+
+ /* Wait for ACL disconnect */
+ await Task.Delay(4000);
+
+ /* 3. Accept Transfer */
+ state = TestState.Normal;
+
+ EventHandler<TransferFinishedEventArgs> EventHandlerTransferFinished = null;
+
+ EventHandlerTransferFinished = (sender, e) => {
+ oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+ oppServer.TransferFinished -= EventHandlerTransferFinished;
+
+ /* PASS condition for TransferFinished_CHECK_EVENT */
+ pass_TransferFinished_CHECK_EVENT = true;
+
+ /* PASS condition for File_TransferFinishedEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsNotNull(e.File, "[OppServerCombine_TEST][File_TransferFinishedEventArgs_PROPERTY_READ_ONLY][File] Failed");
+ Assert.IsInstanceOf<string>(e.File, "[OppServerCombine_TEST][File_TransferFinishedEventArgs_PROPERTY_READ_ONLY][File] Failed");
+ pass_File_TransferFinishedEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for Size_TransferFinishedEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsInstanceOf<long>(e.Size, "[OppServerCombine_TEST][File_TransferFinishedEventArgs_PROPERTY_READ_ONLY][Size] Failed");
+ Assert.IsTrue(e.Size >= 0, "[OppServerCombine_TEST][File_TransferFinishedEventArgs_PROPERTY_READ_ONLY][Size] Failed");
+ pass_Size_TransferFinishedEventArgs_PROPERTY_READ_ONLY = true;
+
+ /* PASS condition for Result_TransferFinishedEventArgs_PROPERTY_READ_ONLY */
+ Assert.IsTrue((int)e.Result == 0, "[OppServerCombine_TEST][File_TransferFinishedEventArgs_PROPERTY_READ_ONLY][Result] Failed");
+ pass_Result_TransferFinishedEventArgs_PROPERTY_READ_ONLY = true;
+
+ BluetoothHelper.DisplayPassLabel("OppServerCombine_TEST");
+ };
+
+ oppServer.TransferFinished += EventHandlerTransferFinished;
+
+ await ManualTest.WaitForConfirm();
+ }
+ catch (Exception ex)
+ {
+ Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+ }
+ finally
+ {
+ if (oppServer != null)
+ {
+ oppServer.StopServer();
+ oppServer = null;
+ }
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test RejectPush, check if RejectPush method works properly")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.RejectPush M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task RejectPush_CHECK_FOR_REJECT_PUSH()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("RejectPush_CHECK_FOR_REJECT_PUSH");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_RejectPush_CHECK_FOR_REJECT_PUSH == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_RejectPush_CHECK_FOR_REJECT_PUSH, "[TestCase][RejectPush_CHECK_FOR_REJECT_PUSH] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test CancelTransfer, check if CancelTransfer method works properly")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.CancelTransfer M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task CancelTransfer_CHECK_FOR_CANCEL_TRANSFER()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("CancelTransfer_CHECK_FOR_CANCEL_TRANSFER");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_CancelTransfer_CHECK_FOR_CANCEL_TRANSFER == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_CancelTransfer_CHECK_FOR_CANCEL_TRANSFER, "[TestCase][CancelTransfer_CHECK_FOR_CANCEL_TRANSFER] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test AcceptPush, check if AcceptPush method works properly")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.AcceptPush M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task AcceptPush_CHECK_FOR_ACCEPT_PUSH()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("AcceptPush_CHECK_FOR_ACCEPT_PUSH");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_AcceptPush_CHECK_FOR_ACCEPT_PUSH == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_AcceptPush_CHECK_FOR_ACCEPT_PUSH, "[TestCase][AcceptPush_CHECK_FOR_ACCEPT_PUSH] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ConnectionRequested, check if ConnectionRequested event is proper")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.ConnectionRequested E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task ConnectionRequested_CHECK_EVENT()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("ConnectionRequested_CHECK_EVENT");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_ConnectionRequested_CHECK_EVENT == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_ConnectionRequested_CHECK_EVENT, "[TestCase][ConnectionRequested_CHECK_EVENT] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Address, check if Address has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.ConnectionRequestedEventArgs.Address A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task Address_ConnectionRequestedEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("Address_ConnectionRequestedEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_Address_ConnectionRequestedEventArgs_PROPERTY_READ_ONLY == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_Address_ConnectionRequestedEventArgs_PROPERTY_READ_ONLY, "[TestCase][Address_ConnectionRequestedEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test TransferProgress, check if TransferProgressis proper")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.TransferProgress E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task TransferProgress_CHECK_EVENT()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("TransferProgress_CHECK_EVENT");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_TransferProgress_CHECK_EVENT == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_TransferProgress_CHECK_EVENT, "[TestCase][TransferProgress_CHECK_EVENT] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test File, check if File has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.TransferProgressEventArgs.File A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task File_TransferProgressEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("File_TransferProgressEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_File_TransferProgressEventArgs_PROPERTY_READ_ONLY == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_File_TransferProgressEventArgs_PROPERTY_READ_ONLY, "[TestCase][File_TransferProgressEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Size, check if Size has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.TransferProgressEventArgs.Size A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task Size_TransferProgressEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("Size_TransferProgressEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_Size_TransferProgressEventArgs_PROPERTY_READ_ONLY == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_Size_TransferProgressEventArgs_PROPERTY_READ_ONLY, "[TestCase][Size_TransferProgressEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Percent, check if Percent has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.TransferProgressEventArgs.Percent A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task Percent_TransferProgressEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("Percent_TransferProgressEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_Percent_TransferProgressEventArgs_PROPERTY_READ_ONLY == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_Percent_TransferProgressEventArgs_PROPERTY_READ_ONLY, "[TestCase][Percent_TransferProgressEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test TransferFinished, check if TransferFinished event is proper")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.TransferFinished E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task TransferFinished_CHECK_EVENT()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("TransferFinished_CHECK_EVENT");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_TransferFinished_CHECK_EVENT == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_TransferFinished_CHECK_EVENT, "[TestCase][TransferFinished_CHECK_EVENT] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test File, check if File has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.TransferFinishedEventArgs.File A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task File_TransferFinishedEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("File_TransferFinishedEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_File_TransferFinishedEventArgs_PROPERTY_READ_ONLY == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_File_TransferFinishedEventArgs_PROPERTY_READ_ONLY, "[TestCase][File_TransferFinishedEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Size, check if Size has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.TransferFinishedEventArgs.Size A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task Size_TransferFinishedEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("Size_TransferFinishedEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_Size_TransferFinishedEventArgs_PROPERTY_READ_ONLY == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_Size_TransferFinishedEventArgs_PROPERTY_READ_ONLY, "[TestCase][Size_TransferFinishedEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Result, check if Result has proper value")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.TransferFinishedEventArgs.Result A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
+ [Precondition(1, "Turn on the bluetooth")]
+ [Step(1, "Tap the Run button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
+ [Postcondition(1, "NA")]
+ public async Task Result_TransferFinishedEventArgs_PROPERTY_READ_ONLY()
+ {
+ /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
+ if (isBluetoothOppSupported == false)
+ {
+ BluetoothHelper.DisplayLabel("Result_TransferFinishedEventArgs_PROPERTY_READ_ONLY");
+ await ManualTest.WaitForConfirm();
+ return;
+ }
+
+ if (pass_Result_TransferFinishedEventArgs_PROPERTY_READ_ONLY == false)
+ await OppServerCombine_TEST();
+
+ Assert.True(pass_Result_TransferFinishedEventArgs_PROPERTY_READ_ONLY, "[TestCase][Result_TransferFinishedEventArgs_PROPERTY_READ_ONLY] Fail");
+ }
+ }
+}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using BluetoothNetworkUtils;
-using Tizen.System;
-using System.IO;
-using Tizen.Applications;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("BluetoothOppClient Tests")]
- public class BluetoothOppClientTests
- {
- static BluetoothDevice _device = null;
- static BluetoothOppClient _oppClient = null;
- private static string filePath = Path.Combine(Application.Current.DirectoryInfo.SharedResource, "test1.jpg");
- private static string largeFilePath = Path.Combine(Application.Current.DirectoryInfo.SharedResource, "SampleMP3.mp3");
- static bool isBluetoothOppSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("tizen.org/feature/network.bluetooth.opp", out isBluetoothOppSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test PushFile, check if PushFile method works properly")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushFile M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
-
- EventHandlerPushFinished = (sender, e) => {
- if (e.Result == 0)
- {
- BluetoothHelper.DisplayPassLabel("PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE");
- _oppClient.PushFinished -= EventHandlerPushFinished;
- }
- };
-
- _oppClient.PushFinished += EventHandlerPushFinished;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("PushFile_CHECK_FOR_OPPCLIENT_PUSH_FILE");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AddFile, check if AddFile method works properly")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.AddFile M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
-
- EventHandlerPushFinished = (sender, e) => {
- if (e.Result == 0)
- {
- BluetoothHelper.DisplayPassLabel("AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE");
- _oppClient.PushFinished -= EventHandlerPushFinished;
- }
- };
-
- _oppClient.PushFinished += EventHandlerPushFinished;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("AddFile_CHECK_FOR_OPPCLIENT_ADD_FILE");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ClearFiles, check if ClearFiles method works properly")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.ClearFiles M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILES()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILESAsync");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
-
- EventHandlerPushFinished = (sender, e) => {
- if (e.Result == 0)
- {
- BluetoothHelper.DisplayPassLabel("ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILESAsync");
- _oppClient.PushFinished -= EventHandlerPushFinished;
- }
- };
-
- _oppClient.PushFinished += EventHandlerPushFinished;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILESAsync");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("ClearFiles_CHECK_FOR_OPPCLIENT_CLEAR_FILESAsync");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CancelPush, check if CancelPush method works properly")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.CancelPush M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushProgressEventArgs> EventHandlerPushProgress = null;
-
- EventHandlerPushProgress = (sender, e) => {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "File : " + e.File + " Size : " + e.Size + " Percent : " + e.Percent + "%");
- try
- {
- _oppClient.CancelPush();
- BluetoothHelper.DisplayPassLabel("CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH");
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][BluetoothOppClient][CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH] FAIL " + ex.Message);
- }
- };
-
- _oppClient.PushProgress += EventHandlerPushProgress;
-
- _oppClient.AddFile(largeFilePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("CancelPush_CHECK_FOR_OPPCLIENT_CANCEL_PUSH");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test PushResponded, check if PushResponded event is proper")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushResponded E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task PushResponded_CHECK_EVENT()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("PushResponded_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushRespondedEventArgs> EventHandlerPushResponsed = null;
-
- EventHandlerPushResponsed = (sender, e) => {
- if (e.Result == 0)
- {
- BluetoothHelper.DisplayPassLabel("PushResponded_CHECK_EVENT");
- _oppClient.PushResponded -= EventHandlerPushResponsed;
- }
- };
-
- _oppClient.PushResponded += EventHandlerPushResponsed;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("PushResponded_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("PushResponded_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test PushProgress, check if PushProgress event is proper")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushProgress E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task PushProgress_CHECK_EVENT()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("PushProgress_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushProgressEventArgs> EventHandlerPushProgress = null;
-
- EventHandlerPushProgress = (sender, e) => {
- if (e.Percent >= 0)
- {
- BluetoothHelper.DisplayPassLabel("PushProgress_CHECK_EVENT");
- _oppClient.PushProgress -= EventHandlerPushProgress;
- }
- };
-
- _oppClient.PushProgress += EventHandlerPushProgress;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("PushProgress_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("PushProgress_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test PushFinished, check if PushFinished event is proper")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppClient.PushFinished E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task PushFinished_CHECK_EVENT()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("PushProgress_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
-
- EventHandlerPushFinished = (sender, e) => {
- if (e.Result == 0)
- {
- BluetoothHelper.DisplayPassLabel("PushProgress_CHECK_EVENT");
- _oppClient.PushFinished -= EventHandlerPushFinished;
- }
- };
-
- _oppClient.PushFinished += EventHandlerPushFinished;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("PushFinished_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("PushFinished_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using System.Linq;
-using BluetoothNetworkUtils;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System.Collections.Generic;
-using Tizen.System;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("BluetoothOppServer Tests")]
- public class BluetoothOppServerTests
- {
- static BluetoothOppServer _oppServer = null;
- static string filePath = StorageManager.Storages.Where(s => s.StorageType == StorageArea.Internal).FirstOrDefault().RootDirectory + "/Downloads";
- static string fileName = "test1.jpg";
- static int _transferId;
- static bool isBluetoothOppSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("tizen.org/feature/network.bluetooth.opp", out isBluetoothOppSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- if (_oppServer != null)
- {
- _oppServer.StopServer();
- _oppServer = null;
- }
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AcceptPush, check if AcceptPush method works properly")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.AcceptPush M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task AcceptPush_CHECK_FOR_ACCEPT_PUSH()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- BluetoothHelper.DisplayPassLabel("AcceptPush_CHECK_FOR_ACCEPT_PUSH");
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][AcceptPush_CHECK_FOR_ACCEPT_PUSH] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("AcceptPush_CHECK_FOR_ACCEPT_PUSH");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("AcceptPush_CHECK_FOR_ACCEPT_PUSH");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RejectPush, check if RejectPush method works properly")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.RejectPush M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task RejectPush_CHECK_FOR_REJECT_PUSH()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _oppServer.RejectPush();
-
- BluetoothHelper.DisplayPassLabel("RejectPush_CHECK_FOR_REJECT_PUSH");
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][RejectPush_CHECK_FOR_REJECT_PUSH] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("RejectPush_CHECK_FOR_REJECT_PUSH");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("RejectPush_CHECK_FOR_REJECT_PUSH");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CancelTransfer, check if CancelTransfer method works properly")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.CancelTransfer M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task CancelTransfer_CHECK_FOR_CANCEL_TRANSFER()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- /* Wait to start the current transfer */
- Task.Delay(100).Wait();
-
- _oppServer.CancelTransfer(_transferId);
-
- BluetoothHelper.DisplayPassLabel("CancelTransfer_CHECK_FOR_CANCEL_TRANSFER");
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][CancelTransfer_CHECK_FOR_CANCEL_TRANSFER] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("CancelTransfer_CHECK_FOR_CANCEL_TRANSFER");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("CancelTransfer_CHECK_FOR_CANCEL_TRANSFER");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ConnectionRequested, check if ConnectionRequested event is proper")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.ConnectionRequested E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task ConnectionRequested_CHECK_EVENT()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- BluetoothHelper.DisplayPassLabel("ConnectionRequested_CHECK_EVENT");
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][ConnectionRequested_CHECK_EVENT] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("ConnectionRequested_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("ConnectionRequested_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test TransferProgress, check if TransferProgressis proper")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.TransferProgress E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task TransferProgress_CHECK_EVENT()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
- EventHandler<TransferProgressEventArgs> EventHandlerTransferProgress = null;
-
- EventHandlerTransferProgress = (sender, e) => {
- if (e.Percent >= 0)
- {
- _oppServer.TransferProgress -= EventHandlerTransferProgress;
- BluetoothHelper.DisplayPassLabel("TransferProgress_CHECK_EVENT");
- }
- };
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- _oppServer.TransferProgress += EventHandlerTransferProgress;
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][TransferProgress_CHECK_EVENT] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("TransferProgress_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("TransferProgress_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test TransferFinished, check if TransferFinished event is proper")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.TransferFinished E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task TransferFinished_CHECK_EVENT()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
- EventHandler<TransferFinishedEventArgs> EventHandlerTransferFinished = null;
-
- EventHandlerTransferFinished = (sender, e) => {
- if (e.Result == 0)
- {
- _oppServer.TransferFinished -= EventHandlerTransferFinished;
-
- BluetoothHelper.DisplayPassLabel("TransferFinished_CHECK_EVENT");
- }
- };
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- _oppServer.TransferFinished += EventHandlerTransferFinished;
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][TransferFinished_CHECK_EVENT] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("TransferFinished_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("TransferFinished_CHECK_EVENT");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using System.Linq;
-using BluetoothNetworkUtils;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System.Collections.Generic;
-using Tizen.System;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("ConnectionRequestedEventArgs Tests")]
- public class ConnectionRequestedEventArgsTests
- {
- static BluetoothOppServer _oppServer = null;
- static string filePath = StorageManager.Storages.Where(s => s.StorageType == StorageArea.Internal).FirstOrDefault().RootDirectory + "/Downloads";
- const string fileName = "test1.jpg";
- static int _transferId;
- static bool isBluetoothOppSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("tizen.org/feature/network.bluetooth.opp", out isBluetoothOppSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- if (_oppServer != null)
- {
- _oppServer.StopServer();
- _oppServer = null;
- }
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Address, check if Address has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.ConnectionRequestedEventArgs.Address A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task Address_PROPERTY_READ_ONLY()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- Assert.IsNotNull(e.Address, "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
- Assert.IsInstanceOf<string>(e.Address, "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- BluetoothHelper.DisplayPassLabel("Address_PROPERTY_READ_ONLY");
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][Address_PROPERTY_READ_ONLY] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using BluetoothNetworkUtils;
-using Tizen.System;
-using System.IO;
-using Tizen.Applications;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("PushFinishedEventArgs Tests")]
- public class PushFinishedEventArgsTests
- {
- static BluetoothDevice _device = null;
- static BluetoothOppClient _oppClient = null;
- private static string filePath = Path.Combine(Application.Current.DirectoryInfo.SharedResource, "test1.jpg");
- static bool isBluetoothOppSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("tizen.org/feature/network.bluetooth.opp", out isBluetoothOppSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Address, check if Address has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.PushFinishedEventArgs.Address A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task Address_PROPERTY_READ_ONLY()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
-
- EventHandlerPushFinished = (sender, e) => {
- _oppClient.PushFinished -= EventHandlerPushFinished;
- Assert.IsNotNull(e.Address, "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
- Assert.IsInstanceOf<string>(e.Address, "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
- Assert.True(String.Equals(e.Address, _device.Address), "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
- BluetoothHelper.DisplayPassLabel("Address_PROPERTY_READ_ONLY");
- };
-
- _oppClient.PushFinished += EventHandlerPushFinished;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Result, check if Result has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.PushFinishedEventArgs.Result A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task Result_PROPERTY_READ_ONLY()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushFinishedEventArgs> EventHandlerPushFinished = null;
-
- EventHandlerPushFinished = (sender, e) => {
- _oppClient.PushFinished -= EventHandlerPushFinished;
- Assert.IsTrue((int)e.Result == 0, "[TestCase][Result_PROPERTY_READ_ONLY] Failed");
- BluetoothHelper.DisplayPassLabel("Result_PROPERTY_READ_ONLY");
- };
-
- _oppClient.PushFinished += EventHandlerPushFinished;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using BluetoothNetworkUtils;
-using Tizen.System;
-using System.IO;
-using Tizen.Applications;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("PushProgressEventArgs Tests")]
- public class PushProgressEventArgsTests
- {
- static BluetoothDevice _device = null;
- static BluetoothOppClient _oppClient = null;
- private static string filePath = Path.Combine(Application.Current.DirectoryInfo.SharedResource, "test1.jpg");
- public static string _remoteAddress = PreconditionUtils.GetOppAddress();
- static bool isBluetoothOppSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("tizen.org/feature/network.bluetooth.opp", out isBluetoothOppSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test File, check if File has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.PushProgressEventArgs.File A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task File_PROPERTY_READ_ONLY()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushProgressEventArgs> EventHandlerPushProgress = null;
-
- EventHandlerPushProgress = (sender, e) => {
- Assert.IsNotNull(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
- Assert.IsInstanceOf<string>(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
- Assert.True(String.Equals(e.File, filePath), "[TestCase][File_PROPERTY_READ_ONLY] Failed");
- BluetoothHelper.DisplayPassLabel("File_PROPERTY_READ_ONLY");
- _oppClient.PushProgress -= EventHandlerPushProgress;
- };
-
- _oppClient.PushProgress += EventHandlerPushProgress;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Size, check if Size has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.PushProgressEventArgs.Size A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task Size_PROPERTY_READ_ONLY()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Size_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushProgressEventArgs> EventHandlerPushProgress = null;
-
- EventHandlerPushProgress = (sender, e) => {
- _oppClient.PushProgress -= EventHandlerPushProgress;
- Assert.IsInstanceOf<long>(e.Size, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
- Assert.IsTrue(e.Size >= 0, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
- BluetoothHelper.DisplayPassLabel("Size_PROPERTY_READ_ONLY");
- };
-
- _oppClient.PushProgress += EventHandlerPushProgress;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Size_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Size_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Percent, check if Percent has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.PushProgressEventArgs.Percent A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task Percent_PROPERTY_READ_ONLY()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Percent_PushProgressEventArgs_READ_ONLY");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushProgressEventArgs> EventHandlerPushProgress = null;
-
- EventHandlerPushProgress = (sender, e) => {
- _oppClient.PushProgress -= EventHandlerPushProgress;
- Assert.IsInstanceOf<int>(e.Percent, "[TestCase][Percent_PROPERTY_READ_ONLY] Failed");
- Assert.IsTrue(e.Percent >= 0, "[TestCase][Percent_PROPERTY_READ_ONLY] Failed");
- BluetoothHelper.DisplayPassLabel("Percent_PROPERTY_READ_ONLY");
- };
-
- _oppClient.PushProgress += EventHandlerPushProgress;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Percent_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Percent_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using BluetoothNetworkUtils;
-using Tizen.System;
-using System.IO;
-using Tizen.Applications;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("PushRespondedEventArgs Tests")]
- public class PushRespondedEventArgsTests
- {
- static BluetoothDevice _device = null;
- static BluetoothOppClient _oppClient = null;
- private static string filePath = Path.Combine(Application.Current.DirectoryInfo.SharedResource, "test1.jpg");
- public static string _remoteAddress = PreconditionUtils.GetOppAddress();
- static bool isBluetoothOppSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("tizen.org/feature/network.bluetooth.opp", out isBluetoothOppSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Address, check if Address has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.PushRespondedEventArgs.Address A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task Address_PROPERTY_READ_ONLY()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushRespondedEventArgs> EventHandlerPushResponsed = null;
-
- EventHandlerPushResponsed = (sender, e) => {
- _oppClient.PushResponded -= EventHandlerPushResponsed;
- Assert.IsNotNull(e.Address, "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
- Assert.IsInstanceOf<string>(e.Address, "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
- Assert.True(String.Equals(e.Address, _device.Address), "[TestCase][Address_PROPERTY_READ_ONLY] Failed");
- BluetoothHelper.DisplayPassLabel("Address_PROPERTY_READ_ONLY");
- };
-
- _oppClient.PushResponded += EventHandlerPushResponsed;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Address_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Result, check if Result has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.PushRespondedEventArgs.Result A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Paired with the remote OPP server device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task Result_PROPERTY_READ_ONLY()
- {
- try
- {
- /* We can't occupy the precondition, if OPP feature is not supported in Manual TC */
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- return;
- }
-
- _oppClient = BluetoothSetup.GetBluetoothOppClientUtil();
-
- Assert.IsNotNull(_oppClient, "_oppClient shold not be null");
-
- _device = BluetoothSetup.GetPairedDevice();
-
- EventHandler<PushRespondedEventArgs> EventHandlerPushResponsed = null;
-
- EventHandlerPushResponsed = (sender, e) => {
- _oppClient.PushResponded -= EventHandlerPushResponsed;
- Assert.IsTrue((int)e.Result == 0, "[TestCase][Result_PROPERTY_READ_ONLY] Failed");
- BluetoothHelper.DisplayPassLabel("Result_PROPERTY_READ_ONLY");
- };
-
- _oppClient.PushResponded += EventHandlerPushResponsed;
-
- _oppClient.AddFile(filePath);
-
- _oppClient.PushFile(_device.Address);
-
- _oppClient.ClearFiles();
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System.Threading.Tasks;
-using BluetoothNetworkUtils;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using Tizen.System;
-using System.Linq;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("TransferFinishedEventArgs Tests")]
- public class TransferFinishedEventArgsTests
- {
- static BluetoothOppServer _oppServer = null;
- static string filePath = StorageManager.Storages.Where(s => s.StorageType == StorageArea.Internal).FirstOrDefault().RootDirectory + "/Downloads";
- const string fileName = "test1.jpg";
- static int _transferId;
- static bool isBluetoothOppSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("tizen.org/feature/network.bluetooth.opp", out isBluetoothOppSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- if (_oppServer != null)
- {
- _oppServer.StopServer();
- _oppServer = null;
- }
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test File, check if File has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.TransferFinishedEventArgs.File A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task File_PROPERTY_READ_ONLY()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
- EventHandler<TransferFinishedEventArgs> EventHandlerTransferFinished = null;
-
- EventHandlerTransferFinished = (sender, e) => {
- _oppServer.TransferFinished -= EventHandlerTransferFinished;
-
- Assert.IsNotNull(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
- Assert.IsInstanceOf<string>(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
- Assert.True(String.Equals(e.File, fileName), "[TestCase][File_PROPERTY_READ_ONLY] Failed");
-
- BluetoothHelper.DisplayPassLabel("File_PROPERTY_READ_ONLY");
- };
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- _oppServer.TransferFinished += EventHandlerTransferFinished;
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][File_PROPERTY_READ_ONLY] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Size, check if Size has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.TransferFinishedEventArgs.Size A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task Size_PROPERTY_READ_ONLY()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
- EventHandler<TransferFinishedEventArgs> EventHandlerTransferFinished = null;
-
- EventHandlerTransferFinished = (sender, e) => {
- _oppServer.TransferFinished -= EventHandlerTransferFinished;
-
- Assert.IsInstanceOf<long>(e.Size, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
- Assert.IsTrue(e.Size >= 0, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
-
- BluetoothHelper.DisplayPassLabel("File_PROPERTY_READ_ONLY");
- };
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- _oppServer.TransferFinished += EventHandlerTransferFinished;
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][File_PROPERTY_READ_ONLY] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Result, check if Result has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.TransferFinishedEventArgs.Result A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task Result_PROPERTY_READ_ONLY()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
- EventHandler<TransferFinishedEventArgs> EventHandlerTransferFinished = null;
-
- EventHandlerTransferFinished = (sender, e) => {
- _oppServer.TransferFinished -= EventHandlerTransferFinished;
-
- Assert.IsTrue((int)e.Result == 0, "[TestCase][Result_PROPERTY_READ_ONLY] Failed");
-
- BluetoothHelper.DisplayPassLabel("Result_PROPERTY_READ_ONLY");
- };
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- _oppServer.TransferFinished += EventHandlerTransferFinished;
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][Result_PROPERTY_READ_ONLY] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System.Threading.Tasks;
-using BluetoothNetworkUtils;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using Tizen.System;
-using System.Linq;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("TransferProgressEventArgs Tests")]
- public class TransferProgressEventArgsTests
- {
- static BluetoothOppServer _oppServer = null;
- static string filePath = StorageManager.Storages.Where(s => s.StorageType == StorageArea.Internal).FirstOrDefault().RootDirectory + "/Downloads";
- const string fileName = "test1.jpg";
- static int _transferId;
- static bool isBluetoothOppSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("tizen.org/feature/network.bluetooth.opp", out isBluetoothOppSupported);
- }
- [TearDown]
- public static void Destroy()
- {
- if (_oppServer != null)
- {
- _oppServer.StopServer();
- _oppServer = null;
- }
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test File, check if File has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.TransferProgressEventArgs.File A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task File_PROPERTY_READ_ONLY()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
- EventHandler<TransferProgressEventArgs> EventHandlerTransferProgress = null;
-
- EventHandlerTransferProgress = (sender, e) => {
- _oppServer.TransferProgress -= EventHandlerTransferProgress;
-
- Assert.IsNotNull(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
- Assert.IsInstanceOf<string>(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
- Assert.True(String.Equals(e.File, fileName), "[TestCase][File_PROPERTY_READ_ONLY] Failed");
-
- BluetoothHelper.DisplayPassLabel("File_PROPERTY_READ_ONLY");
- };
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- _oppServer.TransferProgress += EventHandlerTransferProgress;
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][File_PROPERTY_READ_ONLY] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Size, check if Size has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.TransferProgressEventArgs.Size A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task Size_PROPERTY_READ_ONLY()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
- EventHandler<TransferProgressEventArgs> EventHandlerTransferProgress = null;
-
- EventHandlerTransferProgress = (sender, e) => {
- _oppServer.TransferProgress -= EventHandlerTransferProgress;
-
- Assert.IsInstanceOf<long>(e.Size, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
- Assert.IsTrue(e.Size >= 0, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
-
- BluetoothHelper.DisplayPassLabel("Size_PROPERTY_READ_ONLY");
- };
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- _oppServer.TransferProgress += EventHandlerTransferProgress;
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][Size_PROPERTY_READ_ONLY] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Size_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Size_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Percent, check if Percent has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.TransferProgressEventArgs.Percent A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Share a file from Opp Client device over bluetooth")]
- [Step(3, "When permission request popup appears, tap accept on server device.")]
- [Postcondition(1, "NA")]
- public static async Task Percent_PROPERTY_READ_ONLY()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
-
- EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
- EventHandler<TransferProgressEventArgs> EventHandlerTransferProgress = null;
-
- EventHandlerTransferProgress = (sender, e) => {
- _oppServer.TransferProgress -= EventHandlerTransferProgress;
-
- Assert.IsInstanceOf<int>(e.Percent, "[TestCase][Percent_PROPERTY_READ_ONLY] Failed");
- Assert.IsTrue(e.Percent >= 0, "[TestCase][Percent_PROPERTY_READ_ONLY] Failed");
-
- BluetoothHelper.DisplayPassLabel("Percent_PROPERTY_READ_ONLY");
- };
-
- EventHandlerConnectionRequested = (sender, e) => {
- try
- {
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
-
- _transferId = _oppServer.AcceptPush(fileName);
-
- _oppServer.TransferProgress += EventHandlerTransferProgress;
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][Percent_PROPERTY_READ_ONLY] FAIL " + ex.Message);
- }
- };
-
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
-
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("Percent_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Percent_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}