From 74bf6f29eb5869ead76289cdaaab894a926b144f Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Fri, 4 Jan 2019 14:54:07 +0900 Subject: [PATCH] [Bluetooth][TCSACR-207] Add new TC for SocketConnection property Change-Id: I8645498328a9a022897180f9865b4beee8b51c99 --- .../testcase/TSBluetoothServerSocket.cs | 5 +-- .../testcase/TSSocketConnection.cs | 51 ++++++++++++++++++++++ 2 files changed, 53 insertions(+), 3 deletions(-) mode change 100755 => 100644 tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothServerSocket.cs mode change 100755 => 100644 tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSSocketConnection.cs diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothServerSocket.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothServerSocket.cs old mode 100755 new mode 100644 index 01a977c..e638830 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothServerSocket.cs +++ b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothServerSocket.cs @@ -154,7 +154,7 @@ namespace Tizen.Network.Bluetooth.Tests [Precondition(2, "Run this only on test device which acts as server")] [Step(1, "Tap the Run button")] [Postcondition(1, "Close the terminal")] - public static async Task Dispose_CHECK_NO_EXCEPTION() + public async Task Dispose_CHECK_NO_EXCEPTION() { BluetoothServerSocket Server = null; string ServiceUuid = "00001101-0000-1000-8000-00805F9B7777"; @@ -163,7 +163,6 @@ namespace Tizen.Network.Bluetooth.Tests Server = BluetoothAdapter.CreateServerSocket(ServiceUuid); Assert.IsNotNull(Server, "PRECONDITION: Failed to get server socket for testing"); Server.Dispose(); - BluetoothAdapter.DestroyServerSocket(Server); } catch (NotSupportedException) { @@ -176,7 +175,7 @@ namespace Tizen.Network.Bluetooth.Tests catch (TypeInitializationException e) { if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) - { + { BluetoothHelper.DisplayLabel("AcceptStateChanged_EVENT"); await ManualTest.WaitForConfirm(); } diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSSocketConnection.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSSocketConnection.cs old mode 100755 new mode 100644 index 55244ee..aa3b224 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSSocketConnection.cs +++ b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSSocketConnection.cs @@ -190,5 +190,56 @@ namespace Tizen.Network.Bluetooth.Tests Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); } } + + [Test] + [Category("P1")] + [Description("Test Client. Check whether Client is valid")] + [Property("SPEC", "Tizen.Network.Bluetooth.SocketConnection.Client A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Adhavan, adhavan.m@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Run this only on test device which acts as client")] + [Precondition(3, "Test device(client) should be paired only with the server device")] + [Precondition(4, "Should run this only after the TC BluetoothServerSocketTests.Listen_ACCEPT_CLIENT_CONNECTION_TEST is started")] + [Step(1, "Tap the Run button")] + [Step(2, "When permission request popup appears, tap accept on server device.")] + [Postcondition(1, "Unpair the server device")] + public async Task Client_READ_ONLY() + { + try + { + await BluetoothSetup.CreateClientSocketUtil(); + await BluetoothSetup.ConnectSocketUtil(); + Assert.IsNotNull(BluetoothSetup.ClientConnection, "Connection data is null"); + Assert.IsNotNull(BluetoothSetup.ClientConnection.Client, "Client is null"); + Assert.IsInstanceOf(BluetoothSetup.ClientConnection.Client, "Client is not proper"); + + BluetoothHelper.DisplayPassLabel("Client_READ_ONLY"); + await ManualTest.WaitForConfirm(); + + await BluetoothSetup.DisconnectSocketUtil(); + } + catch (NotSupportedException) + { + if (isBluetoothSupported == false) + { + BluetoothHelper.DisplayLabel("Client_READ_ONLY"); + await ManualTest.WaitForConfirm(); + } + } + catch (TypeInitializationException e) + { + if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException)) + { + BluetoothHelper.DisplayLabel("Client_READ_ONLY"); + await ManualTest.WaitForConfirm(); + } + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } } } -- 2.7.4