--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 15\r
+VisualStudioVersion = 15.0.26730.10\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MsgPortApp.Tizen", "MsgPortApp.Tizen\MsgPortApp.Tizen.csproj", "{7578B31D-7987-42F2-9B10-FDC30CBA8401}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Release|Any CPU = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {7578B31D-7987-42F2-9B10-FDC30CBA8401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {7578B31D-7987-42F2-9B10-FDC30CBA8401}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {7578B31D-7987-42F2-9B10-FDC30CBA8401}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {7578B31D-7987-42F2-9B10-FDC30CBA8401}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {03C02E20-0C77-4660-A92A-A02CA346C8E8}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<Project>\r
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
+\r
+ <!-- Setting Tizen Extension Path -->\r
+ <PropertyGroup Label="Globals">\r
+ <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
+ </PropertyGroup>\r
+\r
+ <!-- Import Tizen property in Tizen.NET SDK -->\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
+\r
+ <!-- Property Group for .NET Core Project -->\r
+ <PropertyGroup>\r
+ <OutputType>Exe</OutputType>\r
+ <TargetFramework>netcoreapp2.0</TargetFramework>\r
+ </PropertyGroup>\r
+\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+ <DebugType>portable</DebugType>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+ <DebugType>None</DebugType>\r
+ </PropertyGroup>\r
+\r
+ <ItemGroup>\r
+ <Folder Include="lib\"/>\r
+ <Folder Include="res\"/>\r
+ </ItemGroup>\r
+\r
+ <!-- Include Nuget Package for Tizen Project building -->\r
+ <ItemGroup>\r
+ <PackageReference Include="Tizen.NET" Version="4.0.0-preview1-00100" />\r
+ <PackageReference Include="Tizen.NET.Sdk" Version="0.9.18-pre1" />\r
+ </ItemGroup>\r
+\r
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
+\r
+ <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
+ <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ </Target>\r
+</Project>\r
--- /dev/null
+using Tizen.Applications;\r
+using ElmSharp;\r
+using Tizen.Applications.Messages;\r
+using Tizen;\r
+\r
+namespace MsgPortApp.Tizen\r
+{\r
+ class App : CoreUIApplication\r
+ {\r
+ private static MessagePort _remotePort;\r
+ private static MessagePort _remotePort1;\r
+ private static MessagePort _testRemotePort;\r
+ private static MessagePort _controlRemotePort;\r
+ private Bundle _confirmMsg;\r
+ private static bool _flag;\r
+\r
+ private string TAG;\r
+ protected override void OnCreate()\r
+ {\r
+ base.OnCreate();\r
+ Initialize();\r
+\r
+ _confirmMsg = new Bundle();\r
+ _confirmMsg.AddItem("ConfirmMessage", "Message is received");\r
+ TAG = "MSGPORTAPP";\r
+\r
+ Log.Debug(TAG, "@@@@@@@ Create");\r
+ _remotePort = new MessagePort("RemotePort", false);\r
+ Log.Debug(TAG, "@@@@@@@ MessagePort Create : " + _remotePort.PortName + "Trusted : " + _remotePort.Trusted);\r
+\r
+ _remotePort.MessageReceived += MessageReceived_Callback;\r
+ _remotePort.Listen();\r
+\r
+ _remotePort1 = new MessagePort("RemotePort1", true);\r
+ _remotePort1.MessageReceived += TrustedMessageReceived_Callback;\r
+ _remotePort1.Listen();\r
+\r
+ Log.Debug(TAG, "@@### RemotePort Test MessagePort Create");\r
+\r
+ _testRemotePort = new MessagePort("TestRemotePort", false);\r
+ _testRemotePort.MessageReceived += RemotePortMessageReceived_Callback;\r
+ _testRemotePort.Listen();\r
+\r
+ _flag = true;\r
+ _controlRemotePort = new MessagePort("ControlRemotePort", false);\r
+ _controlRemotePort.MessageReceived += ControlRemotePortMessageReceived_Callback;\r
+ _controlRemotePort.Listen();\r
+ }\r
+\r
+ void Initialize()\r
+ {\r
+ Window window = new Window("ElmSharpApp")\r
+ {\r
+ AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270 | DisplayRotation.Degree_90\r
+ };\r
+ window.BackButtonPressed += (s, e) =>\r
+ {\r
+ Exit();\r
+ };\r
+ window.Show();\r
+\r
+ var box = new Box(window)\r
+ {\r
+ AlignmentX = -1,\r
+ AlignmentY = -1,\r
+ WeightX = 1,\r
+ WeightY = 1,\r
+ };\r
+ box.Show();\r
+\r
+ var bg = new Background(window)\r
+ {\r
+ Color = Color.White\r
+ };\r
+ bg.SetContent(box);\r
+\r
+ var conformant = new Conformant(window);\r
+ conformant.Show();\r
+ conformant.SetContent(bg);\r
+\r
+ var label = new Label(window)\r
+ {\r
+ Text = "Hello, Tizen",\r
+ };\r
+ label.Show();\r
+ box.PackEnd(label);\r
+ }\r
+\r
+ private void MessageReceived_Callback(object sender, MessageReceivedEventArgs e)\r
+ {\r
+ Log.Debug(TAG, "@@@@@@@ Message Received");\r
+ Log.Debug(TAG, "@@@@@@@ App ID : " + e.Remote.AppId);\r
+ Log.Debug(TAG, "@@@@@@@ PortName : " + e.Remote.PortName);\r
+ Log.Debug(TAG, "@@@@@@@ Trusted : " + e.Remote.Trusted);\r
+ Log.Debug(TAG, "@@@@@@@ message: " + e.Message.GetItem<string>("message"));\r
+\r
+ _remotePort.Send(_confirmMsg, "Tizen.Applications.MessagePort.Tests", "LocalPort");\r
+ }\r
+\r
+ private void TrustedMessageReceived_Callback(object sender, MessageReceivedEventArgs e)\r
+ {\r
+ Log.Debug(TAG, "@@@@@@@ Message Received");\r
+ Log.Debug(TAG, "@@@@@@@ App ID : " + e.Remote.AppId);\r
+ Log.Debug(TAG, "@@@@@@@ PortName : " + e.Remote.PortName);\r
+ Log.Debug(TAG, "@@@@@@@ Trusted : " + e.Remote.Trusted);\r
+ Log.Debug(TAG, "@@@@@@@ message: " + e.Message.GetItem<string>("message"));\r
+\r
+ _remotePort1.Send(_confirmMsg, "Tizen.Applications.MessagePort.Tests", "LocalPort", true);\r
+ }\r
+\r
+ private void RemotePortMessageReceived_Callback(object sender, MessageReceivedEventArgs e)\r
+ {\r
+ Log.Debug(TAG, "@@@### RemotePortMessageReceived_Callback Received");\r
+ }\r
+\r
+ private void ControlRemotePortMessageReceived_Callback(object sender, MessageReceivedEventArgs e)\r
+ {\r
+ Log.Debug(TAG, "@@@@@@@ ControlRemotePortMessageReceived_Callback Received");\r
+\r
+ if (_flag == true)\r
+ {\r
+ Log.Debug(TAG, "@@@### Stop TestRemotePort");\r
+ _flag = false;\r
+ _testRemotePort.StopListening();\r
+ }\r
+ else\r
+ {\r
+ Log.Debug(TAG, "@@@### Listen TestRemotePort");\r
+ _flag = true;\r
+ _testRemotePort.Listen();\r
+ }\r
+ }\r
+\r
+ static void Main(string[] args)\r
+ {\r
+ Elementary.Initialize();\r
+ Elementary.ThemeOverlay();\r
+ App app = new App();\r
+ app.Run(args);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<manifest package="org.tizen.MsgPortApp.Tizen" version="1.0.0" api-version="5" xmlns="http://tizen.org/ns/packages">\r
+ <profile name="common" />\r
+ <ui-application appid="org.tizen.MsgPortApp.Tizen" exec="MsgPortApp.Tizen.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">\r
+ <label>MsgPortApp.Tizen</label>\r
+ <icon>MsgPortApp.Tizen.png</icon>\r
+ <background-category value="background-network" />\r
+ <background-category value="iot-communication" />\r
+ <background-category value="location" />\r
+ <background-category value="media" />\r
+ <background-category value="sensor" />\r
+ <splash-screens />\r
+ </ui-application>\r
+ <shortcut-list />\r
+ <provides-appdefined-privileges />\r
+</manifest>\r
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 15\r
+VisualStudioVersion = 15.0.26730.10\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MsgPortApp1.Tizen", "MsgPortApp1.Tizen\MsgPortApp1.Tizen.csproj", "{1A3B63B0-6674-4FF1-AA59-A4CFD65E0A94}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Release|Any CPU = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {1A3B63B0-6674-4FF1-AA59-A4CFD65E0A94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {1A3B63B0-6674-4FF1-AA59-A4CFD65E0A94}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {1A3B63B0-6674-4FF1-AA59-A4CFD65E0A94}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {1A3B63B0-6674-4FF1-AA59-A4CFD65E0A94}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {B71F68E2-8F43-4D76-A935-77EFB31BA1E3}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<Project>\r
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
+\r
+ <!-- Setting Tizen Extension Path -->\r
+ <PropertyGroup Label="Globals">\r
+ <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
+ </PropertyGroup>\r
+\r
+ <!-- Import Tizen property in Tizen.NET SDK -->\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
+\r
+ <!-- Property Group for .NET Core Project -->\r
+ <PropertyGroup>\r
+ <OutputType>Exe</OutputType>\r
+ <TargetFramework>netcoreapp2.0</TargetFramework>\r
+ </PropertyGroup>\r
+\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+ <DebugType>portable</DebugType>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+ <DebugType>None</DebugType>\r
+ </PropertyGroup>\r
+\r
+ <ItemGroup>\r
+ <Folder Include="lib\"/>\r
+ <Folder Include="res\"/>\r
+ </ItemGroup>\r
+\r
+ <!-- Include Nuget Package for Tizen Project building -->\r
+ <ItemGroup>\r
+ <PackageReference Include="Tizen.NET" Version="4.0.0-preview1-00100" />\r
+ <PackageReference Include="Tizen.NET.Sdk" Version="0.9.18-pre1" />\r
+ </ItemGroup>\r
+\r
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
+\r
+ <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
+ <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ </Target>\r
+</Project>\r
--- /dev/null
+using Tizen.Applications;\r
+using ElmSharp;\r
+using Tizen;\r
+using Tizen.Applications.Messages;\r
+\r
+namespace MsgPortApp1.Tizen\r
+{\r
+ class App : CoreUIApplication\r
+ {\r
+ private static MessagePort _remotePort;\r
+ private Bundle _confirmMsg;\r
+ private static string TAG;\r
+ protected override void OnCreate()\r
+ {\r
+ base.OnCreate();\r
+ Initialize();\r
+\r
+ _confirmMsg = new Bundle();\r
+ _confirmMsg.AddItem("ConfirmMessage", "Message is received");\r
+ TAG = "MSGPORTAPP1";\r
+\r
+ Log.Debug(TAG, "@@@@@@@ Create");\r
+ _remotePort = new MessagePort("RemotePort", false);\r
+ Log.Debug(TAG, "@@@@@@@ MessagePort-MsgPortApp1 Create : " + _remotePort.PortName + "Trusted : " + _remotePort.Trusted);\r
+\r
+ _remotePort.MessageReceived += MessageReceived_Callback;\r
+ _remotePort.Listen();\r
+ }\r
+\r
+ void Initialize()\r
+ {\r
+ Window window = new Window("ElmSharpApp")\r
+ {\r
+ AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270 | DisplayRotation.Degree_90\r
+ };\r
+ window.BackButtonPressed += (s, e) =>\r
+ {\r
+ Exit();\r
+ };\r
+ window.Show();\r
+\r
+ var box = new Box(window)\r
+ {\r
+ AlignmentX = -1,\r
+ AlignmentY = -1,\r
+ WeightX = 1,\r
+ WeightY = 1,\r
+ };\r
+ box.Show();\r
+\r
+ var bg = new Background(window)\r
+ {\r
+ Color = Color.White\r
+ };\r
+ bg.SetContent(box);\r
+\r
+ var conformant = new Conformant(window);\r
+ conformant.Show();\r
+ conformant.SetContent(bg);\r
+\r
+ var label = new Label(window)\r
+ {\r
+ Text = "Hello, Tizen",\r
+ };\r
+ label.Show();\r
+ box.PackEnd(label);\r
+ }\r
+\r
+ private void MessageReceived_Callback(object sender, MessageReceivedEventArgs e)\r
+ {\r
+ Log.Debug(TAG, "@@@@@@@ Message Received");\r
+ Log.Debug(TAG, "@@@@@@@ App ID : " + e.Remote.AppId);\r
+ Log.Debug(TAG, "@@@@@@@ PortName : " + e.Remote.PortName);\r
+ Log.Debug(TAG, "@@@@@@@ Trusted : " + e.Remote.Trusted);\r
+ Log.Debug(TAG, "@@@@@@@ message: " + e.Message.GetItem<string>("message"));\r
+\r
+ _remotePort.Send(_confirmMsg, "Tizen.Applications.MessagePort.Tests", "LocalPort");\r
+ }\r
+\r
+ static void Main(string[] args)\r
+ {\r
+ Elementary.Initialize();\r
+ Elementary.ThemeOverlay();\r
+ App app = new App();\r
+ app.Run(args);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<manifest package="org.tizen.MsgPortApp1.Tizen" version="1.0.0" api-version="5" xmlns="http://tizen.org/ns/packages">\r
+ <profile name="common" />\r
+ <ui-application appid="org.tizen.MsgPortApp1.Tizen" exec="MsgPortApp1.Tizen.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">\r
+ <label>MsgPortApp1.Tizen</label>\r
+ <icon>MsgPortApp1.Tizen.png</icon>\r
+ <background-category value="background-network" />\r
+ <background-category value="iot-communication" />\r
+ <background-category value="location" />\r
+ <background-category value="media" />\r
+ <background-category value="sensor" />\r
+ <splash-screens />\r
+ </ui-application>\r
+ <shortcut-list />\r
+ <provides-appdefined-privileges />\r
+</manifest>\r
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 15\r
+VisualStudioVersion = 15.0.27703.2035\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortProxy", "RpcPortProxy\RpcPortProxy.csproj", "{B4C8261C-D74F-43D1-A075-B9E242851D31}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Release|Any CPU = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {B4C8261C-D74F-43D1-A075-B9E242851D31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B4C8261C-D74F-43D1-A075-B9E242851D31}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B4C8261C-D74F-43D1-A075-B9E242851D31}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B4C8261C-D74F-43D1-A075-B9E242851D31}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {3E5007AD-1998-4272-8437-26CDC3729698}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<Project>\r
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
+\r
+ <!-- Setting Tizen Extension Path -->\r
+ <PropertyGroup Label="Globals">\r
+ <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
+ </PropertyGroup>\r
+\r
+ <!-- Import Tizen property in Tizen.NET SDK -->\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
+\r
+ <!-- Property Group for .NET Core Project -->\r
+ <PropertyGroup>\r
+ <OutputType>Exe</OutputType>\r
+ <TargetFramework>netcoreapp2.0</TargetFramework>\r
+ </PropertyGroup>\r
+\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+ <DebugType>portable</DebugType>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+ <DebugType>None</DebugType>\r
+ </PropertyGroup>\r
+\r
+ <ItemGroup>\r
+ <Folder Include="lib\" />\r
+ <Folder Include="res\" />\r
+ </ItemGroup>\r
+\r
+ <!-- Include Nuget Package for Tizen Project building -->\r
+ <ItemGroup>\r
+ <PackageReference Include="Tizen.NET.API5" Version="5.0.0.14439" />\r
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />\r
+ </ItemGroup>\r
+\r
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
+\r
+ <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
+ <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ </Target>\r
+</Project>\r
--- /dev/null
+using System.Threading;\r
+using Tizen;\r
+using Tizen.Applications;\r
+using Tizen.Applications.RPCPort;\r
+\r
+namespace RpcPortProxy\r
+{\r
+ class App : ServiceApplication\r
+ {\r
+ private Proxy _proxy;\r
+\r
+ class Proxy : ProxyBase\r
+ {\r
+ private Timer _timer;\r
+ private bool _send;\r
+\r
+ public Proxy(bool send)\r
+ {\r
+ _timer = new Timer(new TimerCallback(OnTimeout));\r
+ _timer.Change(100, 0);\r
+ _send = send;\r
+ }\r
+\r
+ private void OnTimeout(object state)\r
+ {\r
+ Connect("Tizen.Applications.RPCPort.Tests", "Test");\r
+ _timer.Dispose();\r
+ _timer = null;\r
+ }\r
+\r
+ protected override void OnConnectedEvent(string endPoint, string portName, Port port)\r
+ {\r
+ Log.Debug("RPCPortProxy", "OnConnectedEvent: endPoint:" + endPoint + " port:" + portName);\r
+ if (_send)\r
+ {\r
+ using (var p = new Parcel())\r
+ {\r
+ p.WriteString("hello");\r
+ p.Send(port);\r
+ }\r
+ }\r
+ }\r
+\r
+ protected override void OnDisconnectedEvent(string endPoint, string portName)\r
+ {\r
+ Log.Debug("RPCPortProxy", "OnDisconnectedEvent: endPoint:" + endPoint + " port:" + portName);\r
+ }\r
+\r
+ protected override void OnReceivedEvent(string endPoint, string portName)\r
+ {\r
+ Log.Debug("RPCPortProxy", "OnReceivedEvent: endPoint:" + endPoint + " port:" + portName);\r
+ }\r
+\r
+ protected override void OnRejectedEvent(string endPoint, string portName)\r
+ {\r
+ Log.Debug("RPCPortProxy", "OnRejectedEvent: endPoint:" + endPoint + " port:" + portName);\r
+ }\r
+ }\r
+\r
+ protected override void OnCreate()\r
+ {\r
+ base.OnCreate();\r
+ }\r
+\r
+ protected override void OnAppControlReceived(AppControlReceivedEventArgs e)\r
+ {\r
+ base.OnAppControlReceived(e);\r
+ if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val))\r
+ {\r
+ if (val.Equals("finish"))\r
+ {\r
+ Log.Debug("RPCPortProxy", "Finish");\r
+ Exit();\r
+ }\r
+ }\r
+ else\r
+ {\r
+ Log.Debug("RPCPortProxy", "Connecting");\r
+ _proxy?.Dispose();\r
+ if (e.ReceivedAppControl.ExtraData.TryGet("send", out string v))\r
+ _proxy = new Proxy(true);\r
+ else\r
+ _proxy = new Proxy(false);\r
+ }\r
+ }\r
+\r
+ protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)\r
+ {\r
+ base.OnDeviceOrientationChanged(e);\r
+ }\r
+\r
+ protected override void OnLocaleChanged(LocaleChangedEventArgs e)\r
+ {\r
+ base.OnLocaleChanged(e);\r
+ }\r
+\r
+ protected override void OnLowBattery(LowBatteryEventArgs e)\r
+ {\r
+ base.OnLowBattery(e);\r
+ }\r
+\r
+ protected override void OnLowMemory(LowMemoryEventArgs e)\r
+ {\r
+ base.OnLowMemory(e);\r
+ }\r
+\r
+ protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)\r
+ {\r
+ base.OnRegionFormatChanged(e);\r
+ }\r
+\r
+ protected override void OnTerminate()\r
+ {\r
+ _proxy?.Dispose();\r
+ _proxy = null;\r
+ base.OnTerminate();\r
+ }\r
+\r
+ static void Main(string[] args)\r
+ {\r
+ App app = new App();\r
+ app.Run(args);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<manifest package="org.tizen.example.RpcPortProxy" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">\r
+ <profile name="common" />\r
+ <service-application appid="org.tizen.example.RpcPortProxy" exec="RpcPortProxy.dll" multiple="false" nodisplay="true" taskmanage="false" type="dotnet" splash-screen-display="true">\r
+ <label>RpcPortProxy</label>\r
+ <icon>RpcPortProxy.png</icon>\r
+ <metadata key="http://tizen.org/metadata/allowedappid" value="Tizen.Applications.RPCPort.Tests" />\r
+ <splash-screens />\r
+ </service-application>\r
+ <shortcut-list />\r
+ <privileges>\r
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>\r
+ <privilege>http://tizen.org/privilege/datasharing</privilege>\r
+ </privileges>\r
+ <dependencies />\r
+ <provides-appdefined-privileges />\r
+</manifest>\r
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 15\r
+VisualStudioVersion = 15.0.27703.2035\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortProxy2", "RpcPortProxy2\RpcPortProxy2.csproj", "{E877EB41-209D-417B-9E72-7095BBBF7604}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Release|Any CPU = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {E877EB41-209D-417B-9E72-7095BBBF7604}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {E877EB41-209D-417B-9E72-7095BBBF7604}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {E877EB41-209D-417B-9E72-7095BBBF7604}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {E877EB41-209D-417B-9E72-7095BBBF7604}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {E8C497F1-5425-439D-8021-3A6D9BF04ED4}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<Project>\r
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
+\r
+ <!-- Setting Tizen Extension Path -->\r
+ <PropertyGroup Label="Globals">\r
+ <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
+ </PropertyGroup>\r
+\r
+ <!-- Import Tizen property in Tizen.NET SDK -->\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
+\r
+ <!-- Property Group for .NET Core Project -->\r
+ <PropertyGroup>\r
+ <OutputType>Exe</OutputType>\r
+ <TargetFramework>netcoreapp2.0</TargetFramework>\r
+ </PropertyGroup>\r
+\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+ <DebugType>portable</DebugType>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+ <DebugType>None</DebugType>\r
+ </PropertyGroup>\r
+\r
+ <ItemGroup>\r
+ <Folder Include="lib\" />\r
+ <Folder Include="res\" />\r
+ </ItemGroup>\r
+\r
+ <!-- Include Nuget Package for Tizen Project building -->\r
+ <ItemGroup>\r
+ <PackageReference Include="Tizen.NET.API5" Version="5.0.0.14450" />\r
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />\r
+ </ItemGroup>\r
+\r
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
+\r
+ <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
+ <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ </Target>\r
+</Project>\r
--- /dev/null
+using System;\r
+using System.Threading;\r
+using Tizen;\r
+using Tizen.Applications;\r
+using Tizen.Applications.RPCPort;\r
+\r
+namespace RpcPortProxy\r
+{\r
+ class App : ServiceApplication\r
+ {\r
+ private Proxy _proxy;\r
+\r
+ class Proxy : ProxyBase\r
+ {\r
+ public Proxy()\r
+ {\r
+ Connect("org.tizen.example.RpcPortStub", "Test");\r
+ }\r
+\r
+ protected override void OnConnectedEvent(string endPoint, string portName, Port port)\r
+ {\r
+ Log.Debug("RPCPortProxy", "OnConnectedEvent: endPoint:" + endPoint + " port:" + portName);\r
+ }\r
+\r
+ protected override void OnDisconnectedEvent(string endPoint, string portName)\r
+ {\r
+ Log.Debug("RPCPortProxy", "OnDisconnectedEvent: endPoint:" + endPoint + " port:" + portName);\r
+ }\r
+\r
+ protected override void OnReceivedEvent(string endPoint, string portName)\r
+ {\r
+ Log.Debug("RPCPortProxy", "OnReceivedEvent: endPoint:" + endPoint + " port:" + portName);\r
+ }\r
+\r
+ protected override void OnRejectedEvent(string endPoint, string portName)\r
+ {\r
+ Log.Debug("RPCPortProxy", "OnRejectedEvent: endPoint:" + endPoint + " port:" + portName);\r
+ }\r
+ }\r
+\r
+ protected override void OnCreate()\r
+ {\r
+ base.OnCreate();\r
+ }\r
+\r
+ protected override void OnAppControlReceived(AppControlReceivedEventArgs e)\r
+ {\r
+ base.OnAppControlReceived(e);\r
+ if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val))\r
+ {\r
+ if (val.Equals("finish"))\r
+ {\r
+ Log.Debug("RPCPortProxy", "Finish");\r
+ Exit();\r
+ }\r
+ }\r
+ else\r
+ {\r
+ Log.Debug("RPCPortProxy", "Connecting");\r
+ _proxy?.Dispose();\r
+\r
+ try\r
+ {\r
+ _proxy = new Proxy();\r
+ }\r
+ catch (PermissionDeniedException)\r
+ {\r
+ Log.Debug("RPCPortProxy", "PermissionDeniedException happened");\r
+ e.ReceivedAppControl.ReplyToLaunchRequest(new AppControl(), AppControlReplyResult.Succeeded);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ Log.Debug("RPCPortProxy", "Uncatched exception " + ex.ToString());\r
+ }\r
+ }\r
+ }\r
+\r
+ protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)\r
+ {\r
+ base.OnDeviceOrientationChanged(e);\r
+ }\r
+\r
+ protected override void OnLocaleChanged(LocaleChangedEventArgs e)\r
+ {\r
+ base.OnLocaleChanged(e);\r
+ }\r
+\r
+ protected override void OnLowBattery(LowBatteryEventArgs e)\r
+ {\r
+ base.OnLowBattery(e);\r
+ }\r
+\r
+ protected override void OnLowMemory(LowMemoryEventArgs e)\r
+ {\r
+ base.OnLowMemory(e);\r
+ }\r
+\r
+ protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)\r
+ {\r
+ base.OnRegionFormatChanged(e);\r
+ }\r
+\r
+ protected override void OnTerminate()\r
+ {\r
+ _proxy?.Dispose();\r
+ _proxy = null;\r
+ base.OnTerminate();\r
+ }\r
+\r
+ static void Main(string[] args)\r
+ {\r
+ App app = new App();\r
+ app.Run(args);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<manifest package="org.tizen.example.RpcPortProxy2" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">\r
+ <profile name="common" />\r
+ <service-application appid="org.tizen.example.RpcPortProxy2" exec="RpcPortProxy2.dll" multiple="false" nodisplay="true" taskmanage="false" splash-screen-display="true" type="dotnet">\r
+ <label>RpcPortProxy2</label>\r
+ <icon>RpcPortProxy2.png</icon>\r
+ <metadata key="http://tizen.org/metadata/allowedappid" value="Tizen.Applications.RPCPort.Tests" />\r
+ <splash-screens />\r
+ </service-application>\r
+ <shortcut-list />\r
+ <privileges>\r
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>\r
+ </privileges>\r
+ <provides-appdefined-privileges />\r
+</manifest>\r
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 15\r
+VisualStudioVersion = 15.0.27703.2035\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortStub", "RpcPortStub\RpcPortStub.csproj", "{FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Release|Any CPU = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {C6927ABD-FBB9-450E-BD87-9152B5AD5C22}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<Project>\r
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
+\r
+ <!-- Setting Tizen Extension Path -->\r
+ <PropertyGroup Label="Globals">\r
+ <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
+ </PropertyGroup>\r
+\r
+ <!-- Import Tizen property in Tizen.NET SDK -->\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
+\r
+ <!-- Property Group for .NET Core Project -->\r
+ <PropertyGroup>\r
+ <OutputType>Exe</OutputType>\r
+ <TargetFramework>netcoreapp2.0</TargetFramework>\r
+ </PropertyGroup>\r
+\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+ <DebugType>portable</DebugType>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+ <DebugType>None</DebugType>\r
+ </PropertyGroup>\r
+\r
+ <ItemGroup>\r
+ <Folder Include="lib\" />\r
+ <Folder Include="res\" />\r
+ </ItemGroup>\r
+\r
+ <!-- Include Nuget Package for Tizen Project building -->\r
+ <ItemGroup>\r
+ <PackageReference Include="Tizen.NET.API5" Version="5.0.0.14439" />\r
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />\r
+ </ItemGroup>\r
+\r
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
+\r
+ <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
+ <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ </Target>\r
+</Project>\r
--- /dev/null
+using System;\r
+using Tizen;\r
+using Tizen.Applications;\r
+using Tizen.Applications.RPCPort;\r
+\r
+namespace RpcPortStub\r
+{\r
+ class App : ServiceApplication\r
+ {\r
+ private Stub _stub;\r
+\r
+ private class Stub : StubBase\r
+ {\r
+ public Stub(string portName) : base(portName)\r
+ {\r
+ Listen();\r
+ }\r
+\r
+ protected override void OnConnectedEvent(string sender, string instance)\r
+ {\r
+ Log.Debug("RPCPortStub", "OnConnectedEvent: sender::" + sender + " instance::" + instance);\r
+ }\r
+\r
+ protected override void OnDisconnectedEvent(string sender, string instance)\r
+ {\r
+ Log.Debug("RPCPortStub", "OnDisconnectedEvent: sender::" + sender + " instance::" + instance);\r
+ }\r
+\r
+ protected override bool OnReceivedEvent(string sender, string instance, Port port)\r
+ {\r
+ Log.Debug("RPCPortStub", "OnReceivedEvent: sender::" + sender + " instance::" + instance);\r
+ try\r
+ {\r
+ using (Parcel p = new Parcel(port))\r
+ {\r
+ string str = p.ReadString();\r
+ using (Parcel ret = new Parcel())\r
+ {\r
+ ret.WriteString(str);\r
+ ret.Send(GetPort(Port.Type.Callback, instance));\r
+ }\r
+ }\r
+ }\r
+ catch (Exception)\r
+ {\r
+ Log.Error("RPCPortStub", "Exception happens");\r
+ return false;\r
+ }\r
+\r
+ return true;\r
+ }\r
+\r
+ protected override void OnTerminatedEvent()\r
+ {\r
+ Log.Debug("RPCPortStub", "OnTerminatedEvent");\r
+ }\r
+ }\r
+\r
+ protected override void OnCreate()\r
+ {\r
+ base.OnCreate();\r
+ _stub = new Stub("Test");\r
+ }\r
+\r
+ protected override void OnAppControlReceived(AppControlReceivedEventArgs e)\r
+ {\r
+ base.OnAppControlReceived(e);\r
+ if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val))\r
+ {\r
+ if (val.Equals("finish")) {\r
+ Log.Debug("RPCPortStub", "Finish");\r
+ Exit();\r
+ }\r
+ }\r
+ }\r
+\r
+ protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)\r
+ {\r
+ base.OnDeviceOrientationChanged(e);\r
+ }\r
+\r
+ protected override void OnLocaleChanged(LocaleChangedEventArgs e)\r
+ {\r
+ base.OnLocaleChanged(e);\r
+ }\r
+\r
+ protected override void OnLowBattery(LowBatteryEventArgs e)\r
+ {\r
+ base.OnLowBattery(e);\r
+ }\r
+\r
+ protected override void OnLowMemory(LowMemoryEventArgs e)\r
+ {\r
+ base.OnLowMemory(e);\r
+ }\r
+\r
+ protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)\r
+ {\r
+ base.OnRegionFormatChanged(e);\r
+ }\r
+\r
+ protected override void OnTerminate()\r
+ {\r
+ base.OnTerminate();\r
+ _stub?.Dispose();\r
+ }\r
+\r
+ static void Main(string[] args)\r
+ {\r
+ App app = new App();\r
+ app.Run(args);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<manifest package="org.tizen.example.RpcPortStub" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">\r
+ <profile name="common" />\r
+ <service-application appid="org.tizen.example.RpcPortStub" exec="RpcPortStub.dll" multiple="false" nodisplay="true" taskmanage="false" type="dotnet" splash-screen-display="true">\r
+ <label>RpcPortStub</label>\r
+ <icon>RpcPortStub.png</icon>\r
+ <metadata key="http://tizen.org/metadata/allowedappid" value="Tizen.Applications.RPCPort.Tests" />\r
+ <splash-screens />\r
+ </service-application>\r
+ <shortcut-list />\r
+ <dependencies />\r
+ <provides-appdefined-privileges />\r
+</manifest>\r
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 15\r
+VisualStudioVersion = 15.0.27703.2035\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortStub2", "RpcPortStub2\RpcPortStub2.csproj", "{D84E03B5-7EFF-40B6-981A-BC0316180DAE}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Release|Any CPU = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {934AC992-DE63-472C-AD51-4386E224BCD4}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<Project>\r
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
+\r
+ <!-- Setting Tizen Extension Path -->\r
+ <PropertyGroup Label="Globals">\r
+ <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
+ </PropertyGroup>\r
+\r
+ <!-- Import Tizen property in Tizen.NET SDK -->\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
+\r
+ <!-- Property Group for .NET Core Project -->\r
+ <PropertyGroup>\r
+ <OutputType>Exe</OutputType>\r
+ <TargetFramework>netcoreapp2.0</TargetFramework>\r
+ </PropertyGroup>\r
+\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+ <DebugType>portable</DebugType>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+ <DebugType>None</DebugType>\r
+ </PropertyGroup>\r
+\r
+ <ItemGroup>\r
+ <Folder Include="lib\" />\r
+ <Folder Include="res\" />\r
+ </ItemGroup>\r
+\r
+ <!-- Include Nuget Package for Tizen Project building -->\r
+ <ItemGroup>\r
+ <PackageReference Include="Tizen.NET.API5" Version="5.0.0.14444" />\r
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />\r
+ </ItemGroup>\r
+\r
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
+ <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
+\r
+ <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
+ <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
+ </Target>\r
+</Project>\r
--- /dev/null
+using Tizen;\r
+using Tizen.Applications;\r
+using Tizen.Applications.RPCPort;\r
+\r
+namespace RpcPortStub\r
+{\r
+ class App : ServiceApplication\r
+ {\r
+ private Stub _stub;\r
+\r
+ private class Stub : StubBase\r
+ {\r
+ public Stub(string portName) : base(portName)\r
+ {\r
+ AddPrivilege("my.privilege");\r
+ Listen();\r
+ }\r
+\r
+ protected override void OnConnectedEvent(string sender, string instance)\r
+ {\r
+ Log.Debug("RPCPortStub2", "OnConnectedEvent: sender::" + sender + " instance::" + instance);\r
+ }\r
+\r
+ protected override void OnDisconnectedEvent(string sender, string instance)\r
+ {\r
+ Log.Debug("RPCPortStub2", "OnDisconnectedEvent: sender::" + sender + " instance::" + instance);\r
+ }\r
+\r
+ protected override bool OnReceivedEvent(string sender, string instance, Port port)\r
+ {\r
+ Log.Debug("RPCPortStub2", "OnReceivedEvent: sender::" + sender + " instance::" + instance);\r
+ using (Parcel p = new Parcel(port))\r
+ {\r
+ }\r
+\r
+ return true;\r
+ }\r
+\r
+ protected override void OnTerminatedEvent()\r
+ {\r
+ Log.Debug("RPCPortStub2", "OnTerminatedEvent");\r
+ }\r
+ }\r
+\r
+ protected override void OnCreate()\r
+ {\r
+ base.OnCreate();\r
+ _stub = new Stub("Test");\r
+ }\r
+\r
+ protected override void OnAppControlReceived(AppControlReceivedEventArgs e)\r
+ {\r
+ base.OnAppControlReceived(e);\r
+ if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val))\r
+ {\r
+ if (val.Equals("finish"))\r
+ {\r
+ Log.Debug("RPCPortStub2", "Finish");\r
+ Exit();\r
+ }\r
+ }\r
+ }\r
+\r
+ protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)\r
+ {\r
+ base.OnDeviceOrientationChanged(e);\r
+ }\r
+\r
+ protected override void OnLocaleChanged(LocaleChangedEventArgs e)\r
+ {\r
+ base.OnLocaleChanged(e);\r
+ }\r
+\r
+ protected override void OnLowBattery(LowBatteryEventArgs e)\r
+ {\r
+ base.OnLowBattery(e);\r
+ }\r
+\r
+ protected override void OnLowMemory(LowMemoryEventArgs e)\r
+ {\r
+ base.OnLowMemory(e);\r
+ }\r
+\r
+ protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)\r
+ {\r
+ base.OnRegionFormatChanged(e);\r
+ }\r
+\r
+ protected override void OnTerminate()\r
+ {\r
+ base.OnTerminate();\r
+ _stub?.Dispose();\r
+ }\r
+\r
+ static void Main(string[] args)\r
+ {\r
+ App app = new App();\r
+ app.Run(args);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<manifest package="org.tizen.example.RpcPortStub2" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">\r
+ <profile name="common" />\r
+ <service-application appid="org.tizen.example.RpcPortStub2" exec="RpcPortStub2.dll" multiple="false" nodisplay="true" taskmanage="false" type="dotnet" splash-screen-display="true">\r
+ <label>RpcPortStub2</label>\r
+ <icon>RpcPortStub2.png</icon>\r
+ <metadata key="http://tizen.org/metadata/allowedappid" value="Tizen.Applications.RPCPort.Tests" />\r
+ <splash-screens />\r
+ </service-application>\r
+ <shortcut-list />\r
+ <dependencies />\r
+ <provides-appdefined-privileges />\r
+</manifest>\r
+++ /dev/null
-\r
-Microsoft Visual Studio Solution File, Format Version 12.00\r
-# Visual Studio 15\r
-VisualStudioVersion = 15.0.26730.10\r
-MinimumVisualStudioVersion = 10.0.40219.1\r
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MsgPortApp.Tizen", "MsgPortApp.Tizen\MsgPortApp.Tizen.csproj", "{7578B31D-7987-42F2-9B10-FDC30CBA8401}"\r
-EndProject\r
-Global\r
- GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
- Debug|Any CPU = Debug|Any CPU\r
- Release|Any CPU = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
- {7578B31D-7987-42F2-9B10-FDC30CBA8401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
- {7578B31D-7987-42F2-9B10-FDC30CBA8401}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
- {7578B31D-7987-42F2-9B10-FDC30CBA8401}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
- {7578B31D-7987-42F2-9B10-FDC30CBA8401}.Release|Any CPU.Build.0 = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(SolutionProperties) = preSolution\r
- HideSolutionNode = FALSE\r
- EndGlobalSection\r
- GlobalSection(ExtensibilityGlobals) = postSolution\r
- SolutionGuid = {03C02E20-0C77-4660-A92A-A02CA346C8E8}\r
- EndGlobalSection\r
-EndGlobal\r
+++ /dev/null
-<Project>\r
- <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
-\r
- <!-- Setting Tizen Extension Path -->\r
- <PropertyGroup Label="Globals">\r
- <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
- </PropertyGroup>\r
-\r
- <!-- Import Tizen property in Tizen.NET SDK -->\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
-\r
- <!-- Property Group for .NET Core Project -->\r
- <PropertyGroup>\r
- <OutputType>Exe</OutputType>\r
- <TargetFramework>netcoreapp2.0</TargetFramework>\r
- </PropertyGroup>\r
-\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugType>portable</DebugType>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>None</DebugType>\r
- </PropertyGroup>\r
-\r
- <ItemGroup>\r
- <Folder Include="lib\"/>\r
- <Folder Include="res\"/>\r
- </ItemGroup>\r
-\r
- <!-- Include Nuget Package for Tizen Project building -->\r
- <ItemGroup>\r
- <PackageReference Include="Tizen.NET" Version="4.0.0-preview1-00100" />\r
- <PackageReference Include="Tizen.NET.Sdk" Version="0.9.18-pre1" />\r
- </ItemGroup>\r
-\r
- <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
-\r
- <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
- <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- </Target>\r
-</Project>\r
+++ /dev/null
-using Tizen.Applications;\r
-using ElmSharp;\r
-using Tizen.Applications.Messages;\r
-using Tizen;\r
-\r
-namespace MsgPortApp.Tizen\r
-{\r
- class App : CoreUIApplication\r
- {\r
- private static MessagePort _remotePort;\r
- private static MessagePort _remotePort1;\r
- private static MessagePort _testRemotePort;\r
- private static MessagePort _controlRemotePort;\r
- private Bundle _confirmMsg;\r
- private static bool _flag;\r
-\r
- private string TAG;\r
- protected override void OnCreate()\r
- {\r
- base.OnCreate();\r
- Initialize();\r
-\r
- _confirmMsg = new Bundle();\r
- _confirmMsg.AddItem("ConfirmMessage", "Message is received");\r
- TAG = "MSGPORTAPP";\r
-\r
- Log.Debug(TAG, "@@@@@@@ Create");\r
- _remotePort = new MessagePort("RemotePort", false);\r
- Log.Debug(TAG, "@@@@@@@ MessagePort Create : " + _remotePort.PortName + "Trusted : " + _remotePort.Trusted);\r
-\r
- _remotePort.MessageReceived += MessageReceived_Callback;\r
- _remotePort.Listen();\r
-\r
- _remotePort1 = new MessagePort("RemotePort1", true);\r
- _remotePort1.MessageReceived += TrustedMessageReceived_Callback;\r
- _remotePort1.Listen();\r
-\r
- Log.Debug(TAG, "@@### RemotePort Test MessagePort Create");\r
-\r
- _testRemotePort = new MessagePort("TestRemotePort", false);\r
- _testRemotePort.MessageReceived += RemotePortMessageReceived_Callback;\r
- _testRemotePort.Listen();\r
-\r
- _flag = true;\r
- _controlRemotePort = new MessagePort("ControlRemotePort", false);\r
- _controlRemotePort.MessageReceived += ControlRemotePortMessageReceived_Callback;\r
- _controlRemotePort.Listen();\r
- }\r
-\r
- void Initialize()\r
- {\r
- Window window = new Window("ElmSharpApp")\r
- {\r
- AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270 | DisplayRotation.Degree_90\r
- };\r
- window.BackButtonPressed += (s, e) =>\r
- {\r
- Exit();\r
- };\r
- window.Show();\r
-\r
- var box = new Box(window)\r
- {\r
- AlignmentX = -1,\r
- AlignmentY = -1,\r
- WeightX = 1,\r
- WeightY = 1,\r
- };\r
- box.Show();\r
-\r
- var bg = new Background(window)\r
- {\r
- Color = Color.White\r
- };\r
- bg.SetContent(box);\r
-\r
- var conformant = new Conformant(window);\r
- conformant.Show();\r
- conformant.SetContent(bg);\r
-\r
- var label = new Label(window)\r
- {\r
- Text = "Hello, Tizen",\r
- };\r
- label.Show();\r
- box.PackEnd(label);\r
- }\r
-\r
- private void MessageReceived_Callback(object sender, MessageReceivedEventArgs e)\r
- {\r
- Log.Debug(TAG, "@@@@@@@ Message Received");\r
- Log.Debug(TAG, "@@@@@@@ App ID : " + e.Remote.AppId);\r
- Log.Debug(TAG, "@@@@@@@ PortName : " + e.Remote.PortName);\r
- Log.Debug(TAG, "@@@@@@@ Trusted : " + e.Remote.Trusted);\r
- Log.Debug(TAG, "@@@@@@@ message: " + e.Message.GetItem<string>("message"));\r
-\r
- _remotePort.Send(_confirmMsg, "Tizen.Applications.Tests", "LocalPort");\r
- }\r
-\r
- private void TrustedMessageReceived_Callback(object sender, MessageReceivedEventArgs e)\r
- {\r
- Log.Debug(TAG, "@@@@@@@ Message Received");\r
- Log.Debug(TAG, "@@@@@@@ App ID : " + e.Remote.AppId);\r
- Log.Debug(TAG, "@@@@@@@ PortName : " + e.Remote.PortName);\r
- Log.Debug(TAG, "@@@@@@@ Trusted : " + e.Remote.Trusted);\r
- Log.Debug(TAG, "@@@@@@@ message: " + e.Message.GetItem<string>("message"));\r
-\r
- _remotePort1.Send(_confirmMsg, "Tizen.Applications.Tests", "LocalPort", true);\r
- }\r
-\r
- private void RemotePortMessageReceived_Callback(object sender, MessageReceivedEventArgs e)\r
- {\r
- Log.Debug(TAG, "@@@### RemotePortMessageReceived_Callback Received");\r
- }\r
-\r
- private void ControlRemotePortMessageReceived_Callback(object sender, MessageReceivedEventArgs e)\r
- {\r
- Log.Debug(TAG, "@@@@@@@ ControlRemotePortMessageReceived_Callback Received");\r
-\r
- if (_flag == true)\r
- {\r
- Log.Debug(TAG, "@@@### Stop TestRemotePort");\r
- _flag = false;\r
- _testRemotePort.StopListening();\r
- }\r
- else\r
- {\r
- Log.Debug(TAG, "@@@### Listen TestRemotePort");\r
- _flag = true;\r
- _testRemotePort.Listen();\r
- }\r
- }\r
-\r
- static void Main(string[] args)\r
- {\r
- Elementary.Initialize();\r
- Elementary.ThemeOverlay();\r
- App app = new App();\r
- app.Run(args);\r
- }\r
- }\r
-}\r
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<manifest package="org.tizen.MsgPortApp.Tizen" version="1.0.0" api-version="5" xmlns="http://tizen.org/ns/packages">\r
- <profile name="common" />\r
- <ui-application appid="org.tizen.MsgPortApp.Tizen" exec="MsgPortApp.Tizen.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">\r
- <label>MsgPortApp.Tizen</label>\r
- <icon>MsgPortApp.Tizen.png</icon>\r
- <background-category value="background-network" />\r
- <background-category value="iot-communication" />\r
- <background-category value="location" />\r
- <background-category value="media" />\r
- <background-category value="sensor" />\r
- <splash-screens />\r
- </ui-application>\r
- <shortcut-list />\r
- <provides-appdefined-privileges />\r
-</manifest>\r
+++ /dev/null
-\r
-Microsoft Visual Studio Solution File, Format Version 12.00\r
-# Visual Studio 15\r
-VisualStudioVersion = 15.0.26730.10\r
-MinimumVisualStudioVersion = 10.0.40219.1\r
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MsgPortApp1.Tizen", "MsgPortApp1.Tizen\MsgPortApp1.Tizen.csproj", "{1A3B63B0-6674-4FF1-AA59-A4CFD65E0A94}"\r
-EndProject\r
-Global\r
- GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
- Debug|Any CPU = Debug|Any CPU\r
- Release|Any CPU = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
- {1A3B63B0-6674-4FF1-AA59-A4CFD65E0A94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
- {1A3B63B0-6674-4FF1-AA59-A4CFD65E0A94}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
- {1A3B63B0-6674-4FF1-AA59-A4CFD65E0A94}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
- {1A3B63B0-6674-4FF1-AA59-A4CFD65E0A94}.Release|Any CPU.Build.0 = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(SolutionProperties) = preSolution\r
- HideSolutionNode = FALSE\r
- EndGlobalSection\r
- GlobalSection(ExtensibilityGlobals) = postSolution\r
- SolutionGuid = {B71F68E2-8F43-4D76-A935-77EFB31BA1E3}\r
- EndGlobalSection\r
-EndGlobal\r
+++ /dev/null
-<Project>\r
- <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
-\r
- <!-- Setting Tizen Extension Path -->\r
- <PropertyGroup Label="Globals">\r
- <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
- </PropertyGroup>\r
-\r
- <!-- Import Tizen property in Tizen.NET SDK -->\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
-\r
- <!-- Property Group for .NET Core Project -->\r
- <PropertyGroup>\r
- <OutputType>Exe</OutputType>\r
- <TargetFramework>netcoreapp2.0</TargetFramework>\r
- </PropertyGroup>\r
-\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugType>portable</DebugType>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>None</DebugType>\r
- </PropertyGroup>\r
-\r
- <ItemGroup>\r
- <Folder Include="lib\"/>\r
- <Folder Include="res\"/>\r
- </ItemGroup>\r
-\r
- <!-- Include Nuget Package for Tizen Project building -->\r
- <ItemGroup>\r
- <PackageReference Include="Tizen.NET" Version="4.0.0-preview1-00100" />\r
- <PackageReference Include="Tizen.NET.Sdk" Version="0.9.18-pre1" />\r
- </ItemGroup>\r
-\r
- <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
-\r
- <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
- <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- </Target>\r
-</Project>\r
+++ /dev/null
-using Tizen.Applications;\r
-using ElmSharp;\r
-using Tizen;\r
-using Tizen.Applications.Messages;\r
-\r
-namespace MsgPortApp1.Tizen\r
-{\r
- class App : CoreUIApplication\r
- {\r
- private static MessagePort _remotePort;\r
- private Bundle _confirmMsg;\r
- private static string TAG;\r
- protected override void OnCreate()\r
- {\r
- base.OnCreate();\r
- Initialize();\r
-\r
- _confirmMsg = new Bundle();\r
- _confirmMsg.AddItem("ConfirmMessage", "Message is received");\r
- TAG = "MSGPORTAPP1";\r
-\r
- Log.Debug(TAG, "@@@@@@@ Create");\r
- _remotePort = new MessagePort("RemotePort", false);\r
- Log.Debug(TAG, "@@@@@@@ MessagePort-MsgPortApp1 Create : " + _remotePort.PortName + "Trusted : " + _remotePort.Trusted);\r
-\r
- _remotePort.MessageReceived += MessageReceived_Callback;\r
- _remotePort.Listen();\r
- }\r
-\r
- void Initialize()\r
- {\r
- Window window = new Window("ElmSharpApp")\r
- {\r
- AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270 | DisplayRotation.Degree_90\r
- };\r
- window.BackButtonPressed += (s, e) =>\r
- {\r
- Exit();\r
- };\r
- window.Show();\r
-\r
- var box = new Box(window)\r
- {\r
- AlignmentX = -1,\r
- AlignmentY = -1,\r
- WeightX = 1,\r
- WeightY = 1,\r
- };\r
- box.Show();\r
-\r
- var bg = new Background(window)\r
- {\r
- Color = Color.White\r
- };\r
- bg.SetContent(box);\r
-\r
- var conformant = new Conformant(window);\r
- conformant.Show();\r
- conformant.SetContent(bg);\r
-\r
- var label = new Label(window)\r
- {\r
- Text = "Hello, Tizen",\r
- };\r
- label.Show();\r
- box.PackEnd(label);\r
- }\r
-\r
- private void MessageReceived_Callback(object sender, MessageReceivedEventArgs e)\r
- {\r
- Log.Debug(TAG, "@@@@@@@ Message Received");\r
- Log.Debug(TAG, "@@@@@@@ App ID : " + e.Remote.AppId);\r
- Log.Debug(TAG, "@@@@@@@ PortName : " + e.Remote.PortName);\r
- Log.Debug(TAG, "@@@@@@@ Trusted : " + e.Remote.Trusted);\r
- Log.Debug(TAG, "@@@@@@@ message: " + e.Message.GetItem<string>("message"));\r
-\r
- _remotePort.Send(_confirmMsg, "Tizen.Applications.Tests", "LocalPort");\r
- }\r
-\r
- static void Main(string[] args)\r
- {\r
- Elementary.Initialize();\r
- Elementary.ThemeOverlay();\r
- App app = new App();\r
- app.Run(args);\r
- }\r
- }\r
-}\r
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<manifest package="org.tizen.MsgPortApp1.Tizen" version="1.0.0" api-version="5" xmlns="http://tizen.org/ns/packages">\r
- <profile name="common" />\r
- <ui-application appid="org.tizen.MsgPortApp1.Tizen" exec="MsgPortApp1.Tizen.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">\r
- <label>MsgPortApp1.Tizen</label>\r
- <icon>MsgPortApp1.Tizen.png</icon>\r
- <background-category value="background-network" />\r
- <background-category value="iot-communication" />\r
- <background-category value="location" />\r
- <background-category value="media" />\r
- <background-category value="sensor" />\r
- <splash-screens />\r
- </ui-application>\r
- <shortcut-list />\r
- <provides-appdefined-privileges />\r
-</manifest>\r
+++ /dev/null
-\r
-Microsoft Visual Studio Solution File, Format Version 12.00\r
-# Visual Studio 15\r
-VisualStudioVersion = 15.0.27703.2035\r
-MinimumVisualStudioVersion = 10.0.40219.1\r
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortProxy", "RpcPortProxy\RpcPortProxy.csproj", "{B4C8261C-D74F-43D1-A075-B9E242851D31}"\r
-EndProject\r
-Global\r
- GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
- Debug|Any CPU = Debug|Any CPU\r
- Release|Any CPU = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
- {B4C8261C-D74F-43D1-A075-B9E242851D31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
- {B4C8261C-D74F-43D1-A075-B9E242851D31}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
- {B4C8261C-D74F-43D1-A075-B9E242851D31}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
- {B4C8261C-D74F-43D1-A075-B9E242851D31}.Release|Any CPU.Build.0 = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(SolutionProperties) = preSolution\r
- HideSolutionNode = FALSE\r
- EndGlobalSection\r
- GlobalSection(ExtensibilityGlobals) = postSolution\r
- SolutionGuid = {3E5007AD-1998-4272-8437-26CDC3729698}\r
- EndGlobalSection\r
-EndGlobal\r
+++ /dev/null
-<Project>\r
- <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
-\r
- <!-- Setting Tizen Extension Path -->\r
- <PropertyGroup Label="Globals">\r
- <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
- </PropertyGroup>\r
-\r
- <!-- Import Tizen property in Tizen.NET SDK -->\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
-\r
- <!-- Property Group for .NET Core Project -->\r
- <PropertyGroup>\r
- <OutputType>Exe</OutputType>\r
- <TargetFramework>netcoreapp2.0</TargetFramework>\r
- </PropertyGroup>\r
-\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugType>portable</DebugType>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>None</DebugType>\r
- </PropertyGroup>\r
-\r
- <ItemGroup>\r
- <Folder Include="lib\" />\r
- <Folder Include="res\" />\r
- </ItemGroup>\r
-\r
- <!-- Include Nuget Package for Tizen Project building -->\r
- <ItemGroup>\r
- <PackageReference Include="Tizen.NET.API5" Version="5.0.0.14439" />\r
- <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />\r
- </ItemGroup>\r
-\r
- <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
-\r
- <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
- <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- </Target>\r
-</Project>\r
+++ /dev/null
-using System.Threading;\r
-using Tizen;\r
-using Tizen.Applications;\r
-using Tizen.Applications.RPCPort;\r
-\r
-namespace RpcPortProxy\r
-{\r
- class App : ServiceApplication\r
- {\r
- private Proxy _proxy;\r
-\r
- class Proxy : ProxyBase\r
- {\r
- private Timer _timer;\r
- private bool _send;\r
-\r
- public Proxy(bool send)\r
- {\r
- _timer = new Timer(new TimerCallback(OnTimeout));\r
- _timer.Change(100, 0);\r
- _send = send;\r
- }\r
-\r
- private void OnTimeout(object state)\r
- {\r
- Connect("Tizen.Applications.Tests", "Test");\r
- _timer.Dispose();\r
- _timer = null;\r
- }\r
-\r
- protected override void OnConnectedEvent(string endPoint, string portName, Port port)\r
- {\r
- Log.Debug("RPCPortProxy", "OnConnectedEvent: endPoint:" + endPoint + " port:" + portName);\r
- if (_send)\r
- {\r
- using (var p = new Parcel())\r
- {\r
- p.WriteString("hello");\r
- p.Send(port);\r
- }\r
- }\r
- }\r
-\r
- protected override void OnDisconnectedEvent(string endPoint, string portName)\r
- {\r
- Log.Debug("RPCPortProxy", "OnDisconnectedEvent: endPoint:" + endPoint + " port:" + portName);\r
- }\r
-\r
- protected override void OnReceivedEvent(string endPoint, string portName)\r
- {\r
- Log.Debug("RPCPortProxy", "OnReceivedEvent: endPoint:" + endPoint + " port:" + portName);\r
- }\r
-\r
- protected override void OnRejectedEvent(string endPoint, string portName)\r
- {\r
- Log.Debug("RPCPortProxy", "OnRejectedEvent: endPoint:" + endPoint + " port:" + portName);\r
- }\r
- }\r
-\r
- protected override void OnCreate()\r
- {\r
- base.OnCreate();\r
- }\r
-\r
- protected override void OnAppControlReceived(AppControlReceivedEventArgs e)\r
- {\r
- base.OnAppControlReceived(e);\r
- if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val))\r
- {\r
- if (val.Equals("finish"))\r
- {\r
- Log.Debug("RPCPortProxy", "Finish");\r
- Exit();\r
- }\r
- }\r
- else\r
- {\r
- Log.Debug("RPCPortProxy", "Connecting");\r
- _proxy?.Dispose();\r
- if (e.ReceivedAppControl.ExtraData.TryGet("send", out string v))\r
- _proxy = new Proxy(true);\r
- else\r
- _proxy = new Proxy(false);\r
- }\r
- }\r
-\r
- protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)\r
- {\r
- base.OnDeviceOrientationChanged(e);\r
- }\r
-\r
- protected override void OnLocaleChanged(LocaleChangedEventArgs e)\r
- {\r
- base.OnLocaleChanged(e);\r
- }\r
-\r
- protected override void OnLowBattery(LowBatteryEventArgs e)\r
- {\r
- base.OnLowBattery(e);\r
- }\r
-\r
- protected override void OnLowMemory(LowMemoryEventArgs e)\r
- {\r
- base.OnLowMemory(e);\r
- }\r
-\r
- protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)\r
- {\r
- base.OnRegionFormatChanged(e);\r
- }\r
-\r
- protected override void OnTerminate()\r
- {\r
- _proxy?.Dispose();\r
- _proxy = null;\r
- base.OnTerminate();\r
- }\r
-\r
- static void Main(string[] args)\r
- {\r
- App app = new App();\r
- app.Run(args);\r
- }\r
- }\r
-}\r
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<manifest package="org.tizen.example.RpcPortProxy" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">\r
- <profile name="common" />\r
- <service-application appid="org.tizen.example.RpcPortProxy" exec="RpcPortProxy.dll" multiple="false" nodisplay="true" taskmanage="false" splash-screen-display="true" type="dotnet">\r
- <label>RpcPortProxy</label>\r
- <icon>RpcPortProxy.png</icon>\r
- <metadata key="http://tizen.org/metadata/allowedappid" value="Tizen.Applications.Tests" />\r
- <splash-screens />\r
- </service-application>\r
- <shortcut-list />\r
- <privileges>\r
- <privilege>http://tizen.org/privilege/appmanager.launch</privilege>\r
- <privilege>http://tizen.org/privilege/datasharing</privilege>\r
- </privileges>\r
- <provides-appdefined-privileges />\r
-</manifest>\r
+++ /dev/null
-\r
-Microsoft Visual Studio Solution File, Format Version 12.00\r
-# Visual Studio 15\r
-VisualStudioVersion = 15.0.27703.2035\r
-MinimumVisualStudioVersion = 10.0.40219.1\r
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortProxy2", "RpcPortProxy2\RpcPortProxy2.csproj", "{E877EB41-209D-417B-9E72-7095BBBF7604}"\r
-EndProject\r
-Global\r
- GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
- Debug|Any CPU = Debug|Any CPU\r
- Release|Any CPU = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
- {E877EB41-209D-417B-9E72-7095BBBF7604}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
- {E877EB41-209D-417B-9E72-7095BBBF7604}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
- {E877EB41-209D-417B-9E72-7095BBBF7604}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
- {E877EB41-209D-417B-9E72-7095BBBF7604}.Release|Any CPU.Build.0 = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(SolutionProperties) = preSolution\r
- HideSolutionNode = FALSE\r
- EndGlobalSection\r
- GlobalSection(ExtensibilityGlobals) = postSolution\r
- SolutionGuid = {E8C497F1-5425-439D-8021-3A6D9BF04ED4}\r
- EndGlobalSection\r
-EndGlobal\r
+++ /dev/null
-<Project>\r
- <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
-\r
- <!-- Setting Tizen Extension Path -->\r
- <PropertyGroup Label="Globals">\r
- <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
- </PropertyGroup>\r
-\r
- <!-- Import Tizen property in Tizen.NET SDK -->\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
-\r
- <!-- Property Group for .NET Core Project -->\r
- <PropertyGroup>\r
- <OutputType>Exe</OutputType>\r
- <TargetFramework>netcoreapp2.0</TargetFramework>\r
- </PropertyGroup>\r
-\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugType>portable</DebugType>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>None</DebugType>\r
- </PropertyGroup>\r
-\r
- <ItemGroup>\r
- <Folder Include="lib\" />\r
- <Folder Include="res\" />\r
- </ItemGroup>\r
-\r
- <!-- Include Nuget Package for Tizen Project building -->\r
- <ItemGroup>\r
- <PackageReference Include="Tizen.NET.API5" Version="5.0.0.14450" />\r
- <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />\r
- </ItemGroup>\r
-\r
- <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
-\r
- <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
- <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- </Target>\r
-</Project>\r
+++ /dev/null
-using System;\r
-using System.Threading;\r
-using Tizen;\r
-using Tizen.Applications;\r
-using Tizen.Applications.RPCPort;\r
-\r
-namespace RpcPortProxy\r
-{\r
- class App : ServiceApplication\r
- {\r
- private Proxy _proxy;\r
-\r
- class Proxy : ProxyBase\r
- {\r
- public Proxy()\r
- {\r
- Connect("org.tizen.example.RpcPortStub", "Test");\r
- }\r
-\r
- protected override void OnConnectedEvent(string endPoint, string portName, Port port)\r
- {\r
- Log.Debug("RPCPortProxy", "OnConnectedEvent: endPoint:" + endPoint + " port:" + portName);\r
- }\r
-\r
- protected override void OnDisconnectedEvent(string endPoint, string portName)\r
- {\r
- Log.Debug("RPCPortProxy", "OnDisconnectedEvent: endPoint:" + endPoint + " port:" + portName);\r
- }\r
-\r
- protected override void OnReceivedEvent(string endPoint, string portName)\r
- {\r
- Log.Debug("RPCPortProxy", "OnReceivedEvent: endPoint:" + endPoint + " port:" + portName);\r
- }\r
-\r
- protected override void OnRejectedEvent(string endPoint, string portName)\r
- {\r
- Log.Debug("RPCPortProxy", "OnRejectedEvent: endPoint:" + endPoint + " port:" + portName);\r
- }\r
- }\r
-\r
- protected override void OnCreate()\r
- {\r
- base.OnCreate();\r
- }\r
-\r
- protected override void OnAppControlReceived(AppControlReceivedEventArgs e)\r
- {\r
- base.OnAppControlReceived(e);\r
- if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val))\r
- {\r
- if (val.Equals("finish"))\r
- {\r
- Log.Debug("RPCPortProxy", "Finish");\r
- Exit();\r
- }\r
- }\r
- else\r
- {\r
- Log.Debug("RPCPortProxy", "Connecting");\r
- _proxy?.Dispose();\r
-\r
- try\r
- {\r
- _proxy = new Proxy();\r
- }\r
- catch (PermissionDeniedException)\r
- {\r
- Log.Debug("RPCPortProxy", "PermissionDeniedException happened");\r
- e.ReceivedAppControl.ReplyToLaunchRequest(new AppControl(), AppControlReplyResult.Succeeded);\r
- }\r
- catch (Exception ex)\r
- {\r
- Log.Debug("RPCPortProxy", "Uncatched exception " + ex.ToString());\r
- }\r
- }\r
- }\r
-\r
- protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)\r
- {\r
- base.OnDeviceOrientationChanged(e);\r
- }\r
-\r
- protected override void OnLocaleChanged(LocaleChangedEventArgs e)\r
- {\r
- base.OnLocaleChanged(e);\r
- }\r
-\r
- protected override void OnLowBattery(LowBatteryEventArgs e)\r
- {\r
- base.OnLowBattery(e);\r
- }\r
-\r
- protected override void OnLowMemory(LowMemoryEventArgs e)\r
- {\r
- base.OnLowMemory(e);\r
- }\r
-\r
- protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)\r
- {\r
- base.OnRegionFormatChanged(e);\r
- }\r
-\r
- protected override void OnTerminate()\r
- {\r
- _proxy?.Dispose();\r
- _proxy = null;\r
- base.OnTerminate();\r
- }\r
-\r
- static void Main(string[] args)\r
- {\r
- App app = new App();\r
- app.Run(args);\r
- }\r
- }\r
-}\r
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<manifest package="org.tizen.example.RpcPortProxy2" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">\r
- <profile name="common" />\r
- <service-application appid="org.tizen.example.RpcPortProxy2" exec="RpcPortProxy2.dll" multiple="false" nodisplay="true" taskmanage="false" splash-screen-display="true" type="dotnet">\r
- <label>RpcPortProxy2</label>\r
- <icon>RpcPortProxy2.png</icon>\r
- <metadata key="http://tizen.org/metadata/allowedappid" value="Tizen.Applications.Tests" />\r
- <splash-screens />\r
- </service-application>\r
- <shortcut-list />\r
- <privileges>\r
- <privilege>http://tizen.org/privilege/appmanager.launch</privilege>\r
- </privileges>\r
- <provides-appdefined-privileges />\r
-</manifest>\r
+++ /dev/null
-\r
-Microsoft Visual Studio Solution File, Format Version 12.00\r
-# Visual Studio 15\r
-VisualStudioVersion = 15.0.27703.2035\r
-MinimumVisualStudioVersion = 10.0.40219.1\r
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortStub", "RpcPortStub\RpcPortStub.csproj", "{FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}"\r
-EndProject\r
-Global\r
- GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
- Debug|Any CPU = Debug|Any CPU\r
- Release|Any CPU = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
- {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
- {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
- {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
- {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Release|Any CPU.Build.0 = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(SolutionProperties) = preSolution\r
- HideSolutionNode = FALSE\r
- EndGlobalSection\r
- GlobalSection(ExtensibilityGlobals) = postSolution\r
- SolutionGuid = {C6927ABD-FBB9-450E-BD87-9152B5AD5C22}\r
- EndGlobalSection\r
-EndGlobal\r
+++ /dev/null
-<Project>\r
- <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
-\r
- <!-- Setting Tizen Extension Path -->\r
- <PropertyGroup Label="Globals">\r
- <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
- </PropertyGroup>\r
-\r
- <!-- Import Tizen property in Tizen.NET SDK -->\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
-\r
- <!-- Property Group for .NET Core Project -->\r
- <PropertyGroup>\r
- <OutputType>Exe</OutputType>\r
- <TargetFramework>netcoreapp2.0</TargetFramework>\r
- </PropertyGroup>\r
-\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugType>portable</DebugType>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>None</DebugType>\r
- </PropertyGroup>\r
-\r
- <ItemGroup>\r
- <Folder Include="lib\" />\r
- <Folder Include="res\" />\r
- </ItemGroup>\r
-\r
- <!-- Include Nuget Package for Tizen Project building -->\r
- <ItemGroup>\r
- <PackageReference Include="Tizen.NET.API5" Version="5.0.0.14439" />\r
- <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />\r
- </ItemGroup>\r
-\r
- <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
-\r
- <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
- <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- </Target>\r
-</Project>\r
+++ /dev/null
-using System;\r
-using Tizen;\r
-using Tizen.Applications;\r
-using Tizen.Applications.RPCPort;\r
-\r
-namespace RpcPortStub\r
-{\r
- class App : ServiceApplication\r
- {\r
- private Stub _stub;\r
-\r
- private class Stub : StubBase\r
- {\r
- public Stub(string portName) : base(portName)\r
- {\r
- Listen();\r
- }\r
-\r
- protected override void OnConnectedEvent(string sender, string instance)\r
- {\r
- Log.Debug("RPCPortStub", "OnConnectedEvent: sender::" + sender + " instance::" + instance);\r
- }\r
-\r
- protected override void OnDisconnectedEvent(string sender, string instance)\r
- {\r
- Log.Debug("RPCPortStub", "OnDisconnectedEvent: sender::" + sender + " instance::" + instance);\r
- }\r
-\r
- protected override bool OnReceivedEvent(string sender, string instance, Port port)\r
- {\r
- Log.Debug("RPCPortStub", "OnReceivedEvent: sender::" + sender + " instance::" + instance);\r
- try\r
- {\r
- using (Parcel p = new Parcel(port))\r
- {\r
- string str = p.ReadString();\r
- using (Parcel ret = new Parcel())\r
- {\r
- ret.WriteString(str);\r
- ret.Send(GetPort(Port.Type.Callback, instance));\r
- }\r
- }\r
- }\r
- catch (Exception)\r
- {\r
- Log.Error("RPCPortStub", "Exception happens");\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-\r
- protected override void OnTerminatedEvent()\r
- {\r
- Log.Debug("RPCPortStub", "OnTerminatedEvent");\r
- }\r
- }\r
-\r
- protected override void OnCreate()\r
- {\r
- base.OnCreate();\r
- _stub = new Stub("Test");\r
- }\r
-\r
- protected override void OnAppControlReceived(AppControlReceivedEventArgs e)\r
- {\r
- base.OnAppControlReceived(e);\r
- if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val))\r
- {\r
- if (val.Equals("finish")) {\r
- Log.Debug("RPCPortStub", "Finish");\r
- Exit();\r
- }\r
- }\r
- }\r
-\r
- protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)\r
- {\r
- base.OnDeviceOrientationChanged(e);\r
- }\r
-\r
- protected override void OnLocaleChanged(LocaleChangedEventArgs e)\r
- {\r
- base.OnLocaleChanged(e);\r
- }\r
-\r
- protected override void OnLowBattery(LowBatteryEventArgs e)\r
- {\r
- base.OnLowBattery(e);\r
- }\r
-\r
- protected override void OnLowMemory(LowMemoryEventArgs e)\r
- {\r
- base.OnLowMemory(e);\r
- }\r
-\r
- protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)\r
- {\r
- base.OnRegionFormatChanged(e);\r
- }\r
-\r
- protected override void OnTerminate()\r
- {\r
- base.OnTerminate();\r
- _stub?.Dispose();\r
- }\r
-\r
- static void Main(string[] args)\r
- {\r
- App app = new App();\r
- app.Run(args);\r
- }\r
- }\r
-}\r
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<manifest package="org.tizen.example.RpcPortStub" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">\r
- <profile name="common" />\r
- <service-application appid="org.tizen.example.RpcPortStub" exec="RpcPortStub.dll" multiple="false" nodisplay="true" taskmanage="false" splash-screen-display="true" type="dotnet">\r
- <label>RpcPortStub</label>\r
- <icon>RpcPortStub.png</icon>\r
- <metadata key="http://tizen.org/metadata/allowedappid" value="Tizen.Applications.Tests" />\r
- <splash-screens />\r
- </service-application>\r
- <shortcut-list />\r
- <provides-appdefined-privileges />\r
-</manifest>\r
+++ /dev/null
-\r
-Microsoft Visual Studio Solution File, Format Version 12.00\r
-# Visual Studio 15\r
-VisualStudioVersion = 15.0.27703.2035\r
-MinimumVisualStudioVersion = 10.0.40219.1\r
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortStub2", "RpcPortStub2\RpcPortStub2.csproj", "{D84E03B5-7EFF-40B6-981A-BC0316180DAE}"\r
-EndProject\r
-Global\r
- GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
- Debug|Any CPU = Debug|Any CPU\r
- Release|Any CPU = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
- {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
- {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
- {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
- {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Release|Any CPU.Build.0 = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(SolutionProperties) = preSolution\r
- HideSolutionNode = FALSE\r
- EndGlobalSection\r
- GlobalSection(ExtensibilityGlobals) = postSolution\r
- SolutionGuid = {934AC992-DE63-472C-AD51-4386E224BCD4}\r
- EndGlobalSection\r
-EndGlobal\r
+++ /dev/null
-<Project>\r
- <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />\r
-\r
- <!-- Setting Tizen Extension Path -->\r
- <PropertyGroup Label="Globals">\r
- <TizenProjectExtensionsPath>$(MSBuildExtensionsPath)\Tizen\VisualStudio\</TizenProjectExtensionsPath>\r
- </PropertyGroup>\r
-\r
- <!-- Import Tizen property in Tizen.NET SDK -->\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" />\r
-\r
- <!-- Property Group for .NET Core Project -->\r
- <PropertyGroup>\r
- <OutputType>Exe</OutputType>\r
- <TargetFramework>netcoreapp2.0</TargetFramework>\r
- </PropertyGroup>\r
-\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugType>portable</DebugType>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>None</DebugType>\r
- </PropertyGroup>\r
-\r
- <ItemGroup>\r
- <Folder Include="lib\" />\r
- <Folder Include="res\" />\r
- </ItemGroup>\r
-\r
- <!-- Include Nuget Package for Tizen Project building -->\r
- <ItemGroup>\r
- <PackageReference Include="Tizen.NET.API5" Version="5.0.0.14444" />\r
- <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />\r
- </ItemGroup>\r
-\r
- <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />\r
- <Import Project="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets" Condition="Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" />\r
-\r
- <!-- Install Check 'Visual Studio for Tizen' for developing on Visual Studio -->\r
- <Target Name="TizenVsixInstallCheck" BeforeTargets="CompileDesignTime">\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.props is not exist.
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- <Warning Condition="!Exists('$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets')" Text="$(TizenProjectExtensionsPath)Tizen.NET.ProjectType.targets is not exist.\
 you need to check if 'Visual Studio for Tizen' is installed" />\r
- </Target>\r
-</Project>\r
+++ /dev/null
-using Tizen;\r
-using Tizen.Applications;\r
-using Tizen.Applications.RPCPort;\r
-\r
-namespace RpcPortStub\r
-{\r
- class App : ServiceApplication\r
- {\r
- private Stub _stub;\r
-\r
- private class Stub : StubBase\r
- {\r
- public Stub(string portName) : base(portName)\r
- {\r
- AddPrivilege("my.privilege");\r
- Listen();\r
- }\r
-\r
- protected override void OnConnectedEvent(string sender, string instance)\r
- {\r
- Log.Debug("RPCPortStub2", "OnConnectedEvent: sender::" + sender + " instance::" + instance);\r
- }\r
-\r
- protected override void OnDisconnectedEvent(string sender, string instance)\r
- {\r
- Log.Debug("RPCPortStub2", "OnDisconnectedEvent: sender::" + sender + " instance::" + instance);\r
- }\r
-\r
- protected override bool OnReceivedEvent(string sender, string instance, Port port)\r
- {\r
- Log.Debug("RPCPortStub2", "OnReceivedEvent: sender::" + sender + " instance::" + instance);\r
- using (Parcel p = new Parcel(port))\r
- {\r
- }\r
-\r
- return true;\r
- }\r
-\r
- protected override void OnTerminatedEvent()\r
- {\r
- Log.Debug("RPCPortStub2", "OnTerminatedEvent");\r
- }\r
- }\r
-\r
- protected override void OnCreate()\r
- {\r
- base.OnCreate();\r
- _stub = new Stub("Test");\r
- }\r
-\r
- protected override void OnAppControlReceived(AppControlReceivedEventArgs e)\r
- {\r
- base.OnAppControlReceived(e);\r
- if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val))\r
- {\r
- if (val.Equals("finish"))\r
- {\r
- Log.Debug("RPCPortStub2", "Finish");\r
- Exit();\r
- }\r
- }\r
- }\r
-\r
- protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)\r
- {\r
- base.OnDeviceOrientationChanged(e);\r
- }\r
-\r
- protected override void OnLocaleChanged(LocaleChangedEventArgs e)\r
- {\r
- base.OnLocaleChanged(e);\r
- }\r
-\r
- protected override void OnLowBattery(LowBatteryEventArgs e)\r
- {\r
- base.OnLowBattery(e);\r
- }\r
-\r
- protected override void OnLowMemory(LowMemoryEventArgs e)\r
- {\r
- base.OnLowMemory(e);\r
- }\r
-\r
- protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)\r
- {\r
- base.OnRegionFormatChanged(e);\r
- }\r
-\r
- protected override void OnTerminate()\r
- {\r
- base.OnTerminate();\r
- _stub?.Dispose();\r
- }\r
-\r
- static void Main(string[] args)\r
- {\r
- App app = new App();\r
- app.Run(args);\r
- }\r
- }\r
-}\r
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<manifest package="org.tizen.example.RpcPortStub2" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">\r
- <profile name="common" />\r
- <service-application appid="org.tizen.example.RpcPortStub2" exec="RpcPortStub2.dll" multiple="false" nodisplay="true" taskmanage="false" splash-screen-display="true" type="dotnet">\r
- <label>RpcPortStub2</label>\r
- <icon>RpcPortStub2.png</icon>\r
- <metadata key="http://tizen.org/metadata/allowedappid" value="Tizen.Applications.Tests" />\r
- <splash-screens />\r
- </service-application>\r
- <shortcut-list />\r
- <provides-appdefined-privileges />\r
-</manifest>\r
--- /dev/null
+using System.Reflection;\r
+using System.Runtime.CompilerServices;\r
+using System.Runtime.InteropServices;\r
+\r
+// General Information about an assembly is controlled through the following\r
+// set of attributes. Change these attribute values to modify the information\r
+// associated with an assembly.\r
+[assembly: AssemblyTitle("UIApp.Tizen")]\r
+[assembly: AssemblyDescription("")]\r
+[assembly: AssemblyConfiguration("")]\r
+[assembly: AssemblyCompany("")]\r
+[assembly: AssemblyProduct("UIApp.Tizen")]\r
+[assembly: AssemblyCopyright("Copyright © 2017")]\r
+[assembly: AssemblyTrademark("")]\r
+[assembly: AssemblyCulture("")]\r
+\r
+// Setting ComVisible to false makes the types in this assembly not visible\r
+// to COM components. If you need to access a type in this assembly from\r
+// COM, set the ComVisible attribute to true on that type.\r
+[assembly: ComVisible(false)]\r
+\r
+// The following GUID is for the ID of the typelib if this project is exposed to COM\r
+[assembly: Guid("5b2a12a4-6ed7-4cd1-8371-46daf5c4e611")]\r
+\r
+// Version information for an assembly consists of the following four values:\r
+//\r
+// Major Version\r
+// Minor Version\r
+// Build Number\r
+// Revision\r
+//\r
+// You can specify all the values or you can default the Build and Revision Numbers\r
+// by using the '*' as shown below:\r
+// [assembly: AssemblyVersion("1.0.*")]\r
+[assembly: AssemblyVersion("1.0.0.0")]\r
+[assembly: AssemblyFileVersion("1.0.0.0")]\r
--- /dev/null
+using System;\r
+\r
+namespace UIApp.Tizen\r
+{\r
+ class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication\r
+ {\r
+ protected override void OnCreate()\r
+ {\r
+ base.OnCreate();\r
+ LoadApplication(new App());\r
+ }\r
+\r
+ static void Main(string[] args)\r
+ {\r
+ var app = new Program();\r
+ global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);\r
+ app.Run(args);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <PropertyGroup>\r
+ <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>\r
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+ <ProductVersion>8.0.30703</ProductVersion>\r
+ <SchemaVersion>2.0</SchemaVersion>\r
+ <ProjectTypeGuids>{2F98DAC9-6F16-457B-AED7-D43CAC379341};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\r
+ <ProjectGuid>{5B2A12A4-6ED7-4CD1-8371-46DAF5C4E611}</ProjectGuid>\r
+ <OutputType>Exe</OutputType>\r
+ <AppDesignerFolder>Properties</AppDesignerFolder>\r
+ <RootNamespace>UIApp.Tizen</RootNamespace>\r
+ <AssemblyName>UIApp.Tizen</AssemblyName>\r
+ <FileAlignment>512</FileAlignment>\r
+ <DefaultLanguage>en-US</DefaultLanguage>\r
+ </PropertyGroup>\r
+ <PropertyGroup>\r
+ <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>\r
+ <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>\r
+ <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+ <NuGetTargetMoniker>.NETCoreApp,Version=v2.0</NuGetTargetMoniker>\r
+ <BaseNuGetRuntimeIdentifier>tizen.4.0.0-armel</BaseNuGetRuntimeIdentifier>\r
+ <NoStdLib>true</NoStdLib>\r
+ <NoWarn>$(NoWarn);1701</NoWarn>\r
+ <UseVSHostingProcess>false</UseVSHostingProcess>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+ <DebugSymbols>true</DebugSymbols>\r
+ <DebugType>portable</DebugType>\r
+ <Optimize>false</Optimize>\r
+ <OutputPath>bin\Debug\</OutputPath>\r
+ <DefineConstants>DEBUG;TRACE</DefineConstants>\r
+ <ErrorReport>prompt</ErrorReport>\r
+ <WarningLevel>4</WarningLevel>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+ <DebugType>portable</DebugType>\r
+ <Optimize>true</Optimize>\r
+ <OutputPath>bin\Release\</OutputPath>\r
+ <DefineConstants>TRACE</DefineConstants>\r
+ <ErrorReport>prompt</ErrorReport>\r
+ <WarningLevel>4</WarningLevel>\r
+ </PropertyGroup>\r
+ <ItemGroup>\r
+ <None Include="UIApp.Tizen.project.json" />\r
+ <None Include="tizen-manifest.xml" />\r
+ <None Include="shared\res\UIApp.Tizen.png" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <Compile Include="UIApp.cs" />\r
+ <Compile Include="UIApp.Tizen.cs" />\r
+ <Compile Include="Properties\AssemblyInfo.cs" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <Folder Include="lib\" />\r
+ <Folder Include="res\" />\r
+ </ItemGroup>\r
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.\r
+ Other similar extension points exist, see Microsoft.Common.targets.\r
+ <Target Name="BeforeBuild">\r
+ </Target>\r
+ <Target Name="AfterBuild">\r
+ </Target>\r
+ -->\r
+ <PropertyGroup>\r
+ <!-- https://github.com/dotnet/corefxlab/tree/master/samples/NetCoreSample and\r
+ https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/target-dotnetcore-with-msbuild\r
+ -->\r
+ <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two\r
+ properties to any folder that exists to skip the GetReferenceAssemblyPaths task (not target) and\r
+ to prevent it from outputting a warning (MSB3644).\r
+ -->\r
+ <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>\r
+ <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>\r
+ <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>\r
+ </PropertyGroup>\r
+ <ProjectExtensions>\r
+ <VisualStudio>\r
+ <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Debug|Any CPU">\r
+ <ProjectCommonFlavorCfg>\r
+ <excludeXamarinForms>True</excludeXamarinForms>\r
+ </ProjectCommonFlavorCfg>\r
+ </FlavorProperties>\r
+ <FlavorProperties GUID="{2F98DAC9-6F16-457B-AED7-D43CAC379341}" Configuration="Release|Any CPU">\r
+ <ProjectCommonFlavorCfg />\r
+ </FlavorProperties>\r
+ </VisualStudio>\r
+ </ProjectExtensions>\r
+</Project>
\ No newline at end of file
--- /dev/null
+{\r
+ "buildOptions": {\r
+ "emitEntryPoint": true,\r
+ "debugType": "portable",\r
+ "platform": "AnyCPU",\r
+ "preserveCompilationContext": true\r
+ },\r
+ "dependencies": {\r
+ "Microsoft.NETCore.App": "2.0.0-preview1-002111-00",\r
+ "Tizen.Applications.Common": "1.5.8",\r
+ "Tizen.Applications.UI": "1.5.8",\r
+ "Xamarin.Forms": "2.3.5.256-pre6",\r
+ "Xamarin.Forms.Platform.Tizen": "2.3.5-r256-001"\r
+ },\r
+ "runtimes": {\r
+ "tizen.4.0.0-armel": {}\r
+ },\r
+ "frameworks": {\r
+ "netcoreapp2.0": {\r
+ "imports": [\r
+ "portable-net45+wp80+win81+wpa81",\r
+ "netstandard1.6"\r
+ ]\r
+ }\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 14\r
+VisualStudioVersion = 14.0.25420.1\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIApp.Tizen", "UIApp.Tizen.csproj", "{5B2A12A4-6ED7-4CD1-8371-46DAF5C4E611}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Release|Any CPU = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {5B2A12A4-6ED7-4CD1-8371-46DAF5C4E611}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {5B2A12A4-6ED7-4CD1-8371-46DAF5C4E611}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {5B2A12A4-6ED7-4CD1-8371-46DAF5C4E611}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {5B2A12A4-6ED7-4CD1-8371-46DAF5C4E611}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+using System;\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+using System.Text;\r
+\r
+using Xamarin.Forms;\r
+\r
+namespace UIApp\r
+{\r
+ public class App : Application\r
+ {\r
+ public App()\r
+ {\r
+ // The root page of your application\r
+ MainPage = new ContentPage\r
+ {\r
+ Content = new StackLayout\r
+ {\r
+ VerticalOptions = LayoutOptions.Center,\r
+ Children = {\r
+ new Label {\r
+ HorizontalTextAlignment = TextAlignment.Center,\r
+ Text = "Welcome to Xamarin Forms!"\r
+ }\r
+ }\r
+ }\r
+ };\r
+ }\r
+\r
+ protected override void OnStart()\r
+ {\r
+ // Handle when your app starts\r
+ }\r
+\r
+ protected override void OnSleep()\r
+ {\r
+ // Handle when your app sleeps\r
+ }\r
+\r
+ protected override void OnResume()\r
+ {\r
+ // Handle when your app resumes\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="UIApp.Tizen" version="1.0.0">\r
+ <profile name="common" />\r
+ <ui-application appid="org.tizen.example.UIApp.Tizen"\r
+ exec="UIApp.Tizen.exe"\r
+ type="dotnet"\r
+ multiple="false"\r
+ taskmanage="true"\r
+ nodisplay="false"\r
+ launch_mode="caller">\r
+ <icon>UIApp.Tizen.png</icon>\r
+ <label>UIApp.Tizen</label>\r
+ </ui-application>\r
+</manifest>\r
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using NUnitLite.TUnit;
+using AutoTemplate;
+
+namespace XamarinForTizen.Tizen
+{
+
+ class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
+ {
+ private static App _app;
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+
+ Console.WriteLine("TCT : OnCreate()");
+ _app = new App();
+ LoadApplication(_app);
+
+ TRunner t = new TRunner();
+ t.LoadTestsuite();
+ t.Execute();
+ }
+
+ public static App getApp()
+ {
+ return _app;
+ }
+ static void Main(string[] args)
+ {
+ Console.WriteLine("TCT : Main()");
+ var app = new Program();\r
+ global::Xamarin.Forms.Forms.Init(app);
+ app.Run(args);
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <!-- Property Group for .NET Core Project -->
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>tizen80</TargetFramework>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <!-- Property Group for Tizen Project -->
+ <PropertyGroup>
+ <TizenCreateTpkOnBuild>true</TizenCreateTpkOnBuild>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Folder Include="lib\" />
+ </ItemGroup>
+
+ <Import Project="..\Common\dependencies.props" />
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)">
+ <ExcludeAssets>Runtime</ExcludeAssets>
+ </PackageReference>
+ <PackageReference Include="Tizen.NET.Sdk" Version="$(TizenNETSdkVersion)" />
+ <PackageReference Include="Xamarin.Forms.Platform.Tizen" Version="2.5.1.444934" />
+ </ItemGroup>
+
+ <!-- Include Nuget Package for Tizen Project building -->
+ <ItemGroup>
+ <ProjectReference Include="..\Template\AutoTemplate\AutoTemplate.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio Version 16\r
+VisualStudioVersion = 16.0.30104.148\r
+MinimumVisualStudioVersion = 15.0.26124.0\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.MessagePort.Tests", "Tizen.Applications.MessagePort.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Debug|x64 = Debug|x64\r
+ Debug|x86 = Debug|x86\r
+ Release|Any CPU = Release|Any CPU\r
+ Release|x64 = Release|x64\r
+ Release|x86 = Release|x86\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Tizen.Applications.Messages;
+using XamarinForTizen.Tizen;
+
+namespace Tizen.Applications.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.Applications.Messages.MessagePort Test : send and receive messages between applications through MessagePort")]
+ public class MessagePortTests
+ {
+ protected readonly string LogTag = typeof(Program).Namespace;
+ private Tizen.Applications.Messages.MessagePort _messagePort;
+ private Task<IEnumerable<ApplicationRunningContext>> _runningApps;
+ private Bundle _message;
+ private RemoteValues _remote;
+ private IEnumerable<ApplicationRunningContext> _list;
+ private const string PortName = "LocalPort";
+ private const string MyRemoteAppId = "org.tizen.MsgPortApp.Tizen";
+ private const string MyRemoteAppId1 = "org.tizen.MsgPortApp1.Tizen";
+ private bool _flag;
+
+ [SetUp]
+ public void Init()
+ {
+ _messagePort = null;
+ _flag = false;
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ _message = null;
+ _remote = null;
+ if (_messagePort != null)
+ {
+ _messagePort.Dispose();
+ }
+ _flag = false;
+ if (_runningApps != null)
+ {
+ _runningApps = null;
+ }
+ }
+
+ void MessageReceivedCallback(object sender, MessageReceivedEventArgs e)
+ {
+ Log.Debug(LogTag, "receive !! ");
+ _message = e.Message;
+ _remote = e.Remote;
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Message Received ");
+ Console.WriteLine("TCT @@@ Message Received ");
+ if (e.Remote.AppId != null)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "from :" + e.Remote.AppId);
+ _flag = true;
+ }
+ }
+
+ void AppControlReplyCallback(Tizen.Applications.AppControl launchRequest, Tizen.Applications.AppControl replyRequest, AppControlReplyResult result)
+ {
+
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : MessagePort Constructor")]
+ [Property("SPEC", " Tizen.Applications.Messages.MessagePort.MessagePort C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ public void MessagePort_INIT()
+ {
+ _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
+
+ Assert.IsNotNull(_messagePort, "Object should not be null after initializing");
+ Assert.IsInstanceOf<string>(_messagePort.PortName);
+ Assert.AreEqual(PortName, _messagePort.PortName, "Value of \"PortName\" should be matched with value of \"portName\"");
+ Assert.IsInstanceOf<bool>(_messagePort.Trusted);
+ Assert.IsFalse(_messagePort.Trusted, "Value of \"Trusted\" should be false");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : MessagePort Property")]
+ [Property("SPEC", " Tizen.Applications.Messages.MessagePort.PortName A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ public void PortName_PROPERTY_SET_GET()
+ {
+ _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
+
+ Assert.IsInstanceOf<string>(_messagePort.PortName);
+ Assert.AreEqual(PortName, _messagePort.PortName, "Value of \"PortName\" should be matched with value of \"portName\"");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : MessagePort Property")]
+ [Property("SPEC", " Tizen.Applications.Messages.MessagePort.Trusted A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ public void Trusted_PROPERTY_SET_GET()
+ {
+ _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
+
+ Assert.IsInstanceOf<bool>(_messagePort.Trusted);
+ Assert.IsFalse(_messagePort.Trusted, "Value of \"Trusted\" should be false");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : MessagePort Property")]
+ [Property("SPEC", " Tizen.Applications.Messages.MessagePort.Listening A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ public void Listening_PROPERTY_GET()
+ {
+ /* PRECONDITION
+ * Init MessagePort
+ * Start listening
+ * */
+ _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
+
+ _messagePort.Listen();
+ Assert.IsTrue(_messagePort.Listening, "The attribute \"Listening\" should be true");
+
+ /* TEST CODE */
+ _messagePort.StopListening();
+ Assert.IsFalse(_messagePort.Listening, "The attribute \"Listening\" should be false");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Register a local message port - it should start listening message")]
+ [Property("SPEC", " Tizen.Applications.Messages.MessagePort.Listen M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ public void Listen_FROM_A_PORT()
+ {
+ /* PRECONDITION
+ * Init MessagePort
+ * */
+ _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
+
+ /* TEST CODE */
+ _messagePort.Listen();
+ Assert.IsTrue(_messagePort.Listening, "The attribute \"Listening\" should be true");
+
+ /* POSTCONDITION
+ * Unregisters the message port
+ * */
+ _messagePort.StopListening();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Unregister a local message port - it should stop listening message")]
+ [Property("SPEC", " Tizen.Applications.Messages.MessagePort.StopListening M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ public void StopListening_FROM_A_PORT()
+ {
+ /* PRECONDITION
+ * Init MessagePort
+ * Start listening
+ * */
+ _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
+
+ _messagePort.Listen();
+
+ /* TEST CODE */
+ _messagePort.StopListening();
+ Assert.IsFalse(_messagePort.Listening, "The attribute \"Listening\" should be false");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Send a message to a remote application")]
+ [Property("SPEC", " Tizen.Applications.Messages.MessagePort.Send M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ [Property("COVPARAM", "Tizen.Applications.Bundle, string, string")]
+ public async Task Send_A_MESSAGE_TO_A_REMOTE_APP()
+ {
+ /* PRECONDITION
+ * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
+ * 2)Init MessagePort -> Start listening
+ * */
+ string myRemotePort = "RemotePort";
+ bool isRunning = false;
+ bool trusted = false;
+
+ _runningApps = ApplicationManager.GetRunningApplicationsAsync();
+ _list = await _runningApps;
+ foreach (var app in _list)
+ {
+ if (app.ApplicationId == MyRemoteAppId)
+ {
+ isRunning = true;
+ break;
+ }
+
+ }
+ Assert.IsTrue(isRunning, MyRemoteAppId + "should be running");
+
+ _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, trusted);
+ _messagePort.MessageReceived += MessageReceivedCallback;
+ _messagePort.Listen();
+
+ /* TEST CODE */
+ var msg = new Bundle();
+ Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
+ msg.AddItem("message", "Send_A_MESSAGE_TO_A_REMOTE_APP");
+ _messagePort.Send(msg, MyRemoteAppId, myRemotePort);
+
+ Log.Debug(LogTag, "send !! ");
+
+
+ await Task.Delay(2000);
+ Assert.IsTrue(_flag, "Message is not sent");
+ _messagePort.MessageReceived -= MessageReceivedCallback;
+
+ /* POSTCONDITION
+ * Unregisters the message port
+ * */
+ _messagePort.StopListening();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Send a message to a remote application")]
+ [Property("SPEC", " Tizen.Applications.Messages.MessagePort.Send M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ [Property("COVPARAM", "Tizen.Applications.Bundle, string, string, bool")]
+ public async Task Send_A_TRUSTED_MESSAGE_TO_A_REMOTE_APP()
+ {
+ /* PRECONDITION
+ * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
+ * 2)Init MessagePort -> Start listening
+ * */
+ string myRemotePort = "RemotePort1";
+ bool isRunning = false;
+ bool trusted = true;
+
+ _runningApps = ApplicationManager.GetRunningApplicationsAsync();
+ _list = await _runningApps;
+ foreach (var app in _list)
+ {
+ if (app.ApplicationId == MyRemoteAppId)
+ {
+ isRunning = true;
+ break;
+ }
+ }
+ Assert.IsTrue(isRunning, MyRemoteAppId + "should be running");
+
+ _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, trusted);
+ _messagePort.MessageReceived += MessageReceivedCallback;
+ _messagePort.Listen();
+
+ /* TEST CODE */
+ var trustedMsg = new Bundle();
+ Assert.IsNotNull(trustedMsg, "Object \"msg\" should not be null after initializing");
+ trustedMsg.AddItem("message", "Send_A_TRUSTED_MESSAGE_TO_A_REMOTE_APP");
+ _messagePort.Send(trustedMsg, MyRemoteAppId, myRemotePort, trusted);
+
+ await Task.Delay(2000);
+ Assert.IsTrue(_flag, "Message is not sent");
+ _messagePort.MessageReceived -= MessageReceivedCallback;
+
+ /* POSTCONDITION
+ * Unregisters the message port
+ * */
+ _messagePort.StopListening();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Check MessageReceived event when receiving a message from a remote application")]
+ [Property("SPEC", " Tizen.Applications.Messages.MessagePort.MessageReceived E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ public async Task MessageReceived_CHECK_EVENT()
+ {
+ /* PRECONDITION
+ * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
+ * 2)Init MessagePort -> Start listening -> Send a message to remoteApp and wait for callback message to check event
+ * */
+ string myRemotePort = "RemotePort";
+ bool isRunning = false;
+ bool trusted = false;
+
+ _runningApps = ApplicationManager.GetRunningApplicationsAsync();
+ _list = await _runningApps;
+ foreach (var app in _list)
+ {
+ if (app.ApplicationId == MyRemoteAppId1)
+ {
+ isRunning = true;
+ break;
+ }
+
+ }
+ Assert.IsTrue(isRunning, MyRemoteAppId1 + "should be running");
+
+ _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, trusted);
+ _messagePort.MessageReceived += MessageReceivedCallback;
+ _messagePort.Listen();
+
+ var msg = new Bundle();
+ Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
+ msg.AddItem("message", "MessageReceived_CHECK_EVENT");
+ _messagePort.Send(msg, MyRemoteAppId1, myRemotePort);
+ await Task.Delay(2000);
+
+ /* TEST CODE */
+ Assert.IsTrue(_flag, "MessageReceived event when receiving a message from a remote application");
+ _messagePort.MessageReceived -= MessageReceivedCallback;
+
+ /* POSTCONDITION
+ * Unregisters the message port
+ * */
+ _messagePort.StopListening();
+ }
+
+ //[Test]
+ //[Category("P1")]
+ //[Description("Test Message Remote of MessageReceivedEventArgs.")]
+ //[Property("SPEC", " Tizen.Applications.Messages.MessageReceivedEventArgs.Message A")]
+ //[Property("SPEC_URL", "-")]
+ //[Property("CRITERIA", "PRO")]
+ //[Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")]
+ //public async Task Message_GET() {
+ // /* PRECONDITION
+ // * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
+ // * 2)Init MessagePort -> Start listening -> Send a message to remoteApp and wait for callback message to check event
+ // * */
+ // if (s_message.Count == 0) {
+ // LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "message negative");
+ // string myRemotePort = "RemotePort";
+ // bool isRunning = false;
+ // bool trusted = false;
+
+ // runningApps = ApplicationManager.GetRunningApplicationsAsync();
+ // list = await runningApps;
+ // foreach (var app in list) {
+ // if (app.ApplicationId == myRemoteAppId1) {
+ // isRunning = true;
+ // break;
+ // }
+
+ // }
+ // Assert.IsTrue(isRunning, myRemoteAppId1 + "should be running");
+
+ // messagePort = new Tizen.Applications.Messages.MessagePort(portName, trusted);
+ // Assert.IsNotNull(messagePort, "Object \"messagePort\" should not be null after initializing");
+ // messagePort.MessageReceived += MessageReceivedCallback;
+ // messagePort.Listen();
+
+ // var msg = new Bundle();
+ // Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
+ // msg.AddItem("message", "MessageReceived_CHECK_EVENT");
+ // messagePort.Send(msg, myRemoteAppId1, myRemotePort);
+ // await Task.Delay(2000);
+ // messagePort.MessageReceived -= MessageReceivedCallback;
+ // messagePort.StopListening();
+ // }
+
+ // /* TEST CODE */
+ // Assert.Greater(s_message.Count, 0, "Message of MessageReceivedEventArgs should be more 0");
+ //}
+
+ //[Test]
+ //[Category("P1")]
+ //[Description("Test property Remote of MessageReceivedEventArgs.")]
+ //[Property("SPEC", " Tizen.Applications.Messages.MessageReceivedEventArgs.Remote A")]
+ //[Property("SPEC_URL", "-")]
+ //[Property("CRITERIA", "PRO")]
+ //[Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")]
+ //public async Task Remote_GET() {
+ // /* PRECONDITION
+ // * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
+ // * 2)Init MessagePort -> Start listening -> Send a message to remoteApp and wait for callback message to check event
+ // * */
+ // LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Remote " + s_remote.AppId);
+ // if (s_remote.AppId == null) {
+ // LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Remote negative");
+ // string myRemotePort = "RemotePort";
+ // bool isRunning = false;
+ // bool trusted = false;
+
+ // runningApps = ApplicationManager.GetRunningApplicationsAsync();
+ // list = await runningApps;
+ // foreach (var app in list) {
+ // if (app.ApplicationId == myRemoteAppId1) {
+ // isRunning = true;
+ // break;
+ // }
+
+ // }
+ // Assert.IsTrue(isRunning, myRemoteAppId1 + "should be running");
+
+ // messagePort = new Tizen.Applications.Messages.MessagePort(portName, trusted);
+ // Assert.IsNotNull(messagePort, "Object \"messagePort\" should not be null after initializing");
+ // messagePort.MessageReceived += MessageReceivedCallback;
+ // messagePort.Listen();
+
+ // var msg = new Bundle();
+ // Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
+ // msg.AddItem("message", "MessageReceived_CHECK_EVENT");
+ // messagePort.Send(msg, myRemoteAppId1, myRemotePort);
+ // await Task.Delay(2000);
+ // messagePort.MessageReceived -= MessageReceivedCallback;
+ // messagePort.StopListening();
+ // }
+
+ // /* TEST CODE */
+ // string APP_ID = "org.tizen.MsgPortApp1";
+ // Assert.AreEqual(APP_ID, s_remote.AppId, "AppId of Remote of MessageReceivedEventArgs should be " + APP_ID + ".");
+ // s_remote = null;
+ //}
+ }
+}
+
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Tizen.Applications.Messages;
+using XamarinForTizen.Tizen;
+
+namespace Tizen.Applications.Tests
+{
+
+ [TestFixture]
+ [Description("Test : argument of Received Message ")]
+ class MessageReceivedEventArgsTests
+ {
+ protected readonly string LogTag = typeof(Program).Namespace;
+ private Tizen.Applications.Messages.MessagePort _messagePort;
+ private Bundle _message;
+ private RemoteValues _remote;
+ private IEnumerable<ApplicationRunningContext> _list;
+ private const string PortName = "LocalPort";
+ private const string MyRemoteAppId = "org.tizen.MsgPortApp.Tizen";
+ private const string MyRemoteAppId1 = "org.tizen.MsgPortApp1.Tizen";
+ private bool _flag;
+
+ [SetUp]
+ public void Init()
+ {
+ _messagePort = null;
+ _flag = false;
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ if (_messagePort != null)
+ {
+ _messagePort.Dispose();
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MessageReceivedEventArgs() constructor.")]
+ [Property("SPEC", "Tizen.Applications.Messages.MessageReceivedEventArgs.MessageReceivedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Dao Trong Hieu, tronghieu.d@samsung.com")]
+ public void MessageReceivedEventArgs_INIT()
+ {
+ /* TEST CODE */
+ MessageReceivedEventArgs msgReceivedArgs = new MessageReceivedEventArgs();
+ Assert.IsNotNull(msgReceivedArgs, "MessageReceivedEventArgs should be not null after init");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Message Remote of MessageReceivedEventArgs.")]
+ [Property("SPEC", " Tizen.Applications.Messages.MessageReceivedEventArgs.Message A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")]
+ public async Task Message_GET()
+ {
+ /* PRECONDITION
+ * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
+ * 2)Init MessagePort -> Start listening -> Send a message to remoteApp and wait for callback message to check event
+ * */
+ //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "message start ");
+ if (_message == null)
+ {
+ //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "message negative");
+ string myRemotePort = "RemotePort";
+ bool isRunning = false;
+ bool trusted = false;
+
+ _list = await ApplicationManager.GetRunningApplicationsAsync();
+ foreach (var app in _list)
+ {
+ if (app.ApplicationId == MyRemoteAppId1)
+ {
+ isRunning = true;
+ break;
+ }
+
+ }
+ Assert.IsTrue(isRunning, MyRemoteAppId1 + "should be running");
+
+ _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, trusted);
+ Assert.IsNotNull(_messagePort, "Object \"messagePort\" should not be null after initializing");
+ _messagePort.MessageReceived += MessageReceivedCallback;
+ _messagePort.Listen();
+
+ var msg = new Bundle();
+ Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
+ msg.AddItem("message", "MessageReceived_CHECK_EVENT");
+ _messagePort.Send(msg, MyRemoteAppId1, myRemotePort);
+ Log.Error(LogTag, "send !! ");
+ await Task.Delay(2000);
+ _messagePort.MessageReceived -= MessageReceivedCallback;
+ _messagePort.StopListening();
+ }
+
+ /* TEST CODE */
+ //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "message end");
+ Assert.Greater(_message.Count, 0, "Message of MessageReceivedEventArgs should be more 0");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test property Remote of MessageReceivedEventArgs.")]
+ [Property("SPEC", " Tizen.Applications.Messages.MessageReceivedEventArgs.Remote A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")]
+ public async Task Remote_GET()
+ {
+ /* PRECONDITION
+ * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
+ * 2)Init MessagePort -> Start listening -> Send a message to remoteApp and wait for callback message to check event
+ * */
+ //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Remote start");
+ if (_remote == null)
+ {
+ //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Remote negative");
+ string myRemotePort = "RemotePort";
+ bool isRunning = false;
+ bool trusted = false;
+
+ _list = await ApplicationManager.GetRunningApplicationsAsync();
+ foreach (var app in _list)
+ {
+ if (app.ApplicationId == MyRemoteAppId1)
+ {
+ isRunning = true;
+ break;
+ }
+
+ }
+ Assert.IsTrue(isRunning, MyRemoteAppId1 + "should be running");
+
+ _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, trusted);
+ Assert.IsNotNull(_messagePort, "Object \"messagePort\" should not be null after initializing");
+ _messagePort.MessageReceived += MessageReceivedCallback;
+ _messagePort.Listen();
+
+ var msg = new Bundle();
+ Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
+ msg.AddItem("message", "MessageReceived_CHECK_EVENT");
+ _messagePort.Send(msg, MyRemoteAppId1, myRemotePort);
+ Log.Debug(LogTag, "send !! ");
+ await Task.Delay(2000);
+ _messagePort.MessageReceived -= MessageReceivedCallback;
+ _messagePort.StopListening();
+ }
+
+ /* TEST CODE */
+ string APP_ID = "org.tizen.MsgPortApp1.Tizen";
+ //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Remote end");
+ Assert.AreEqual(APP_ID, _remote.AppId, "AppId of Remote of MessageReceivedEventArgs should be " + APP_ID + ".");
+ _remote = null;
+ }
+
+ void MessageReceivedCallback(object sender, MessageReceivedEventArgs e)
+ {
+ Log.Debug(LogTag, "receive !! ");
+ _message = e.Message;
+ _remote = e.Remote;
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Message Received ");
+ Console.WriteLine("TCT @@@ Message Received ");
+ if (e.Remote.AppId != null)
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "from :" + e.Remote.AppId);
+ _flag = true;
+ }
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.Applications.Messages;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+
+namespace Tizen.Applications.Tests
+{
+
+ [TestFixture]
+ [Description("RemotePort information Test")]
+ class RemotePortTests
+ {
+ public RemotePort _remotePort;
+ private MessagePort _messagePort;
+ public const string remoteAppId = "org.tizen.MsgPortApp.Tizen";
+ public const string myRemotePort = "TestRemotePort";
+ private Task<IEnumerable<ApplicationRunningContext>> _runningApps;
+ private IEnumerable<ApplicationRunningContext> _list;
+ private bool _flag;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
+
+ _flag = false;
+ if (_remotePort != null)
+ {
+ _remotePort.Dispose();
+ }
+ if (_messagePort != null)
+ {
+ _messagePort.Dispose();
+ }
+ if (_runningApps != null)
+ {
+ _runningApps = null;
+ }
+ }
+ private void RemotePortStateChangedCallback(object sender, RemotePortStateChangedEventArgs e)
+ {
+ _flag = true;
+ Log.Debug("REMOTEPORT", "@@# RemotePortStateChangedCallback : " + _flag);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RemotePort() constructor")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemotePort.RemotePort C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void RemotePort_INIT()
+ {
+ Log.Debug("REMOTEPORT", "@@# RemotePort_INIT");
+ /* TEST CODE */
+ _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
+ Assert.IsNotNull(_remotePort, "_remotePort object should be not null after initializing");
+ Assert.IsInstanceOf<RemotePort>(_remotePort, "_remotePort object must be RemotePort instance");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets RemotePort AppId")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemotePort.AppId A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void AppId_PROPERTY_GET()
+ {
+ Log.Debug("REMOTEPORT", "@@# AppId_PROPERTY_GET");
+ /* TEST CODE */
+ _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
+
+ Assert.IsInstanceOf<string>(_remotePort.AppId);
+ Assert.AreEqual(remoteAppId, _remotePort.AppId, "Value of _remotePort.AppId must be matched with remoteAppId");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RemotePort PortName.")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemotePort.PortName A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void PortName_PROPERTY_GET()
+ {
+ Log.Debug("REMOTEPORT", "@@# PortName_PROPERTY_GET");
+ /* TEST CODE */
+ _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
+
+ Assert.IsInstanceOf<string>(_remotePort.PortName);
+ Assert.AreEqual(myRemotePort, _remotePort.PortName, "Value of _remotePort.PortName must be matched with myRemotePort");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RemotePort PortName.")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemotePort.Trusted A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Trusted_PROPERTY_GET()
+ {
+ Log.Debug("REMOTEPORT", "@@# Trusted_PROPERTY_GET");
+ /* TEST CODE */
+ _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
+
+ Assert.IsInstanceOf<bool>(_remotePort.Trusted);
+ Assert.IsFalse(_remotePort.Trusted, "Value of _remotePort.PortName must be false");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RemotePort PortName.")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemotePort.IsRunning M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public async Task IsRunning_CHECK_VALUE()
+ {
+ Log.Debug("REMOTEPORT", "@@# IsRunning_CHECK_VALUE");
+ /* TEST CODE */
+ bool appIsRunning = false;
+ bool portIsRunning = false;
+
+ _runningApps = ApplicationManager.GetRunningApplicationsAsync();
+ _list = await _runningApps;
+ foreach (var app in _list)
+ {
+ if (app.ApplicationId == remoteAppId)
+ {
+ appIsRunning = true;
+ break;
+ }
+
+ }
+ Assert.IsTrue(appIsRunning, remoteAppId + " should be running");
+
+ _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
+
+ portIsRunning = _remotePort.IsRunning();
+
+ Assert.IsTrue(portIsRunning, "_remotePort must be running");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RemotePort RemotePortStateChanged.")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemotePort.RemotePortStateChanged E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public async Task RemotePortStateChanged_EVENT()
+ {
+ Log.Debug("REMOTEPORT", "@@# RemotePortStateChanged_EVENT");
+ bool isRunning = false;
+ _flag = false;
+ string controlRemotePort = "ControlRemotePort";
+
+ _runningApps = ApplicationManager.GetRunningApplicationsAsync();
+ _list = await _runningApps;
+ foreach (var app in _list)
+ {
+ if (app.ApplicationId == remoteAppId)
+ {
+ isRunning = true;
+ break;
+ }
+
+ }
+ Assert.IsTrue(isRunning, remoteAppId + " should be running");
+
+ _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
+ _remotePort.RemotePortStateChanged += RemotePortStateChangedCallback;
+
+ _messagePort = new MessagePort(controlRemotePort, false);
+ _messagePort.Listen();
+
+ var msg = new Bundle();
+ Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
+
+ msg.AddItem("message", "ChangeState");
+ _messagePort.Send(msg, remoteAppId, controlRemotePort);
+ await Task.Delay(5000);
+
+ Assert.IsTrue(_flag, "RemotePortStateChanged callback is not called");
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.Applications.Messages;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+
+namespace Tizen.Applications.Tests
+{
+
+ [TestFixture]
+ [Description("RemotePortStateChangedEventArgs Test")]
+ class RemotePortStateChangedEventArgsTests
+ {
+ public RemotePort _remotePort;
+ private MessagePort _messagePort;
+ public const string remoteAppId = "org.tizen.MsgPortApp.Tizen";
+ public const string myRemotePort = "TestRemotePort";
+ private Task<IEnumerable<ApplicationRunningContext>> _runningApps;
+ private IEnumerable<ApplicationRunningContext> _list;
+ private RemotePortStateChangedEventArgs _changeState;
+ private bool _flag;
+ private State _state;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
+
+ _flag = false;
+ if (_remotePort != null)
+ {
+ _remotePort.Dispose();
+ }
+ if (_messagePort != null)
+ {
+ _messagePort.Dispose();
+ }
+ if (_runningApps != null)
+ {
+ _runningApps = null;
+ }
+ if (_changeState != null)
+ {
+ _changeState = null;
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RemotePortStateChangedEventArgs() constructor")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemotePortStateChangedEventArgs.RemotePortStateChangedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void RemotePortStateChangedEventArgs_INIT()
+ {
+ Log.Debug("REMOTEPORT", "@@# RemotePortStateChangedEventArgs_INIT");
+ /* TEST CODE */
+ _changeState = new RemotePortStateChangedEventArgs();
+ Assert.IsNotNull(_changeState, "_changeState object should be not null after initializing");
+ Assert.IsInstanceOf<RemotePortStateChangedEventArgs>(_changeState, "_changeState object must be RemotePortStateChangedEventArgs instance");
+ }
+
+ private void RemotePortStateChangedCallback(object sender, RemotePortStateChangedEventArgs e)
+ {
+ _flag = true;
+ _state = e.Status;
+ Log.Debug("REMOTEPORT", "@@# RemotePortStateChangedCallback : " + _flag);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RemotePortStateChangedEventArgs Status check.")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemotePortStateChangedEventArgs.Status A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public async Task Status_PROPERTY_GET()
+ {
+ Log.Debug("REMOTEPORT", "@@# Status_PROPERTY_GET");
+ bool isRunning = false;
+ _flag = false;
+ string controlRemotePort = "ControlRemotePort";
+
+ _runningApps = ApplicationManager.GetRunningApplicationsAsync();
+ _list = await _runningApps;
+ foreach (var app in _list)
+ {
+ if (app.ApplicationId == remoteAppId)
+ {
+ isRunning = true;
+ break;
+ }
+
+ }
+ Assert.IsTrue(isRunning, remoteAppId + " should be running");
+
+ _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
+ _remotePort.RemotePortStateChanged += RemotePortStateChangedCallback;
+
+ _messagePort = new MessagePort(controlRemotePort, false);
+ _messagePort.Listen();
+
+ var msg = new Bundle();
+ Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
+
+ msg.AddItem("message", "ChangeState");
+ _messagePort.Send(msg, remoteAppId, controlRemotePort);
+ await Task.Delay(5000);
+
+ Assert.IsTrue(_flag, "RemotePortStateChanged callback is not called");
+ Assert.IsNotNull(_state, "RemotePortStateChangedEventArgs must not be null");
+
+ Log.Debug("REMOTEPORT", "@@# Status_PROPERTY_GET state : " + _state.ToString());
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+
+namespace Tizen.Applications.Tests
+{
+
+ [TestFixture]
+ [Description("Test : Remote Values ")]
+ class RemoteValuesTests
+ {
+ public Tizen.Applications.Messages.RemoteValues _remoteValue;
+ public const string MyRemoteAppId = "org.tizen.myRemoteAppId";
+ public const string MyRemotePortName = "myRemotePortName";
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
+
+ _remoteValue = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RemoteValues() constructor.")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemoteValues.RemoteValues C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Dao Trong Hieu, tronghieu.d@samsung.com")]
+ public void RemoteValues_INIT()
+ {
+ /* TEST CODE */
+ _remoteValue = new Tizen.Applications.Messages.RemoteValues();
+ Assert.IsNotNull(_remoteValue, "RemoteValues object should be not null after initializing");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : RemoteValues Properties.")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemoteValues.AppId A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ public void AppId_PROPERTY_SET_GET()
+ {
+ /* TEST CODE */
+ _remoteValue = new Tizen.Applications.Messages.RemoteValues();
+ Assert.IsNotNull(_remoteValue, "RemoteValues object should be not null after initializing");
+
+ _remoteValue.AppId = MyRemoteAppId;
+ Assert.IsInstanceOf<string>(_remoteValue.AppId);
+ Assert.AreEqual(MyRemoteAppId, _remoteValue.AppId, "Propety \"AppId\": the set value and the get value are not equal");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : RemoteValues Properties.")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemoteValues.PortName A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ public void PortName_PROPERTY_SET_GET()
+ {
+ /* TEST CODE */
+ _remoteValue = new Tizen.Applications.Messages.RemoteValues();
+ Assert.IsNotNull(_remoteValue, "RemoteValues object should be not null after initializing");
+
+ _remoteValue.PortName = MyRemotePortName;
+ Assert.IsInstanceOf<string>(_remoteValue.PortName);
+ Assert.AreEqual(MyRemotePortName, _remoteValue.PortName, "Property \"PortName\": the set value and the get value are not equal");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : RemoteValues Properties.")]
+ [Property("SPEC", "Tizen.Applications.Messages.RemoteValues.Trusted A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
+ public void Trusted_PROPERTY_SET_GET()
+ {
+ /* TEST CODE */
+ _remoteValue = new Tizen.Applications.Messages.RemoteValues();
+ Assert.IsNotNull(_remoteValue, "RemoteValues object should be not null after initializing");
+
+ _remoteValue.Trusted = false;
+ Assert.IsInstanceOf<bool>(_remoteValue.Trusted);
+ Assert.IsFalse(_remoteValue.Trusted, "Property \"Trusted\": the set value and the get value are not equal");
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="8" package="Tizen.Applications.MessagePort.Tests" version="1.0.0">
+ <profile name="common" />
+ <ui-application appid="Tizen.Applications.MessagePort.Tests"
+ exec="Tizen.Applications.MessagePort.Tests.dll"
+ type="dotnet"
+ multiple="false"
+ taskmanage="true"
+ launch_mode="single">
+ <icon>Tizen.Applications.MessagePort.Tests.png</icon>
+ <label>Tizen.Applications.MessagePort.Tests</label>
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ </privileges>
+</manifest>
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using NUnitLite.TUnit;
+using AutoTemplate;
+
+namespace XamarinForTizen.Tizen
+{
+
+ class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
+ {
+ private static App _app;
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+
+ Console.WriteLine("TCT : OnCreate()");
+ _app = new App();
+ LoadApplication(_app);
+
+ TRunner t = new TRunner();
+ t.LoadTestsuite();
+ t.Execute();
+ }
+
+ public static App getApp()
+ {
+ return _app;
+ }
+ static void Main(string[] args)
+ {
+ Console.WriteLine("TCT : Main()");
+ var app = new Program();
+ global::Xamarin.Forms.Forms.Init(app);
+ app.Run(args);
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <!-- Property Group for .NET Core Project -->
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>tizen80</TargetFramework>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <!-- Property Group for Tizen Project -->
+ <PropertyGroup>
+ <TizenCreateTpkOnBuild>true</TizenCreateTpkOnBuild>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Folder Include="lib\" />
+ </ItemGroup>
+
+ <Import Project="..\Common\dependencies.props" />
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)">
+ <ExcludeAssets>Runtime</ExcludeAssets>
+ </PackageReference>
+ <PackageReference Include="Tizen.NET.Sdk" Version="$(TizenNETSdkVersion)" />
+ </ItemGroup>
+
+ <!-- Include Nuget Package for Tizen Project building -->
+ <ItemGroup>
+ <ProjectReference Include="..\Template\AutoTemplate\AutoTemplate.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio Version 16\r
+VisualStudioVersion = 16.0.30104.148\r
+MinimumVisualStudioVersion = 15.0.26124.0\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Preference.Tests", "Tizen.Applications.Preference.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Debug|x64 = Debug|x64\r
+ Debug|x86 = Debug|x86\r
+ Release|Any CPU = Release|Any CPU\r
+ Release|x64 = Release|x64\r
+ Release|x86 = Release|x86\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+using System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.Applications.Tests
+{
+ [TestFixture]
+ [Description("Tizen.Applications.Preference.EventContext test case")]
+ public class EventContextTests
+ {
+ private bool _callbackIsCalled;
+ private PreferenceChangedEventArgs _preferChEvent;
+ [SetUp]
+ public void Init()
+ {
+ _callbackIsCalled = false;
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
+ }
+
+ private void PreferenceChangedCallback(object sender, PreferenceChangedEventArgs preEv)
+ {
+ Log.Debug("PREF", "@@## PreferenceChangedCallback");
+ _preferChEvent = preEv;
+
+ _callbackIsCalled = true;
+ }
+ public async Task WaitCallback()
+ {
+ int count = 0;
+ while (true)
+ {
+ if (count < 3)
+ count = count + 1;
+ else
+ break;
+
+ if (_callbackIsCalled == true)
+ break;
+
+ await Task.Delay(1000);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference EventContext changed callback calling")]
+ [Property("SPEC", "Tizen.Applications.Preference.EventContext.Changed E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public async Task Changed_CALLBACK()
+ {
+ Log.Debug("PREF", "@@## EventContext Changed_CALLBACK");
+
+ string intKey = "Gunter";
+ _callbackIsCalled = false;
+
+ _preferChEvent = new PreferenceChangedEventArgs();
+
+ try
+ {
+ Preference.Set(intKey, 33);
+ Preference.EventContext context;
+ Preference.GetEventContext(intKey).TryGetTarget(out context);
+ if (context != null)
+ {
+ context.Changed += PreferenceChangedCallback;
+ }
+
+ Preference.Set(intKey, 77);
+
+ await WaitCallback();
+
+ Assert.AreEqual(_callbackIsCalled, true, "preference callback is not called");
+ Assert.AreEqual(_preferChEvent.Key, intKey, "preference key is not matched");
+
+ if (context != null)
+ {
+ context.Changed -= PreferenceChangedCallback;
+ }
+
+ Preference.Remove(intKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.Applications.Tests
+{
+ [TestFixture]
+ [Description("Tizen.Applications.Preference test case")]
+ public class PreferenceTest
+ {
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference int type set test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Set M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Set_INT_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference set int value");
+
+ string intKey = "setintkey";
+ int intVal = 33;
+ int val;
+
+ try
+ {
+ Preference.Set(intKey, intVal);
+ val = Preference.Get<int>(intKey);
+ Assert.AreEqual(intVal, val, "int value is not set properly");
+ Preference.Remove(intKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference int type get test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Get<T> M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Get_INT_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference get int value ");
+
+ string intKey = "getintkey";
+ int intVal = 34;
+ int val;
+
+ try
+ {
+ Preference.Set(intKey, intVal);
+ val = Preference.Get<int>(intKey);
+ Assert.AreEqual(intVal, val, "int value is not set properly");
+ Preference.Remove(intKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference int type remove test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Remove M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Remove_INT_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference remove int value");
+
+ string intKey = "rmintkey";
+ int intVal = 35;
+ int val;
+
+ try
+ {
+ Preference.Set(intKey, intVal);
+ val = Preference.Get<int>(intKey);
+ Preference.Remove(intKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+
+ Assert.Throws<KeyNotFoundException>(() => Preference.Get<int>(intKey));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference double type set test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Set M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Set_DOUBLE_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference set double value");
+
+ string doubleKey = "setdoublekey";
+ double doubleVal = 33.3;
+ double val;
+
+ try
+ {
+ Preference.Set(doubleKey, doubleVal);
+ val = Preference.Get<double>(doubleKey);
+ Assert.AreEqual(doubleVal, val, "double value is not set properly");
+ Preference.Remove(doubleKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference double type get test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Get<T> M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Get_DOUBLE_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference get double value");
+
+ string doubleKey = "getdoublekey";
+ double doubleVal = 34.4;
+ double val;
+
+ try
+ {
+ Preference.Set(doubleKey, doubleVal);
+ val = Preference.Get<double>(doubleKey);
+ Assert.AreEqual(doubleVal, val, "double value is not set properly");
+ Preference.Remove(doubleKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference double type remove test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Remove M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Remove_DOUBLE_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference get double value");
+
+ string doubleKey = "rmdoublekey";
+ double doubleVal = 35.5;
+ double val;
+
+ try
+ {
+ Preference.Set(doubleKey, doubleVal);
+ val = Preference.Get<double>(doubleKey);
+ Preference.Remove(doubleKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+
+ Assert.Throws<KeyNotFoundException>(() => Preference.Get<double>(doubleKey));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference string type set test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Set M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Set_STRING_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference set string value");
+
+ string stringKey = "setstringkey";
+ string stringVal = "setPref";
+ string val;
+
+ try
+ {
+ Preference.Set(stringKey, stringVal);
+ val = Preference.Get<string>(stringKey);
+ Assert.AreEqual(stringVal, val, "string value is not set properly");
+ Preference.Remove(stringKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference string type get test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Get<T> M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Get_STRING_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference get string value");
+
+ string stringKey = "getstringkey";
+ string stringVal = "getPref";
+ string val;
+
+ try
+ {
+ Preference.Set(stringKey, stringVal);
+ val = Preference.Get<string>(stringKey);
+ Assert.AreEqual(stringVal, val, "string value is not set properly");
+ Preference.Remove(stringKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference string type remove test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Remove M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Remove_STRING_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference remove string value");
+
+ string stringKey = "rmstringkey";
+ string stringVal = "rmPref";
+ string val;
+
+ try
+ {
+ Preference.Set(stringKey, stringVal);
+ val = Preference.Get<string>(stringKey);
+ Preference.Remove(stringKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+
+ Assert.Throws<KeyNotFoundException>(() => Preference.Get<string>(stringKey));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference bool type set test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Set M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Set_BOOL_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference set bool value");
+
+ string boolKey = "setboolKey";
+ bool boolVal = true;
+ bool val;
+
+ try
+ {
+ Preference.Set(boolKey, boolVal);
+ val = Preference.Get<bool>(boolKey);
+ Assert.AreEqual(boolVal, val, "bool value is not set properly");
+ Preference.Remove(boolKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference bool type get test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Get<T> M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Get_BOOL_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference get bool value");
+
+ string boolKey = "getboolKey";
+ bool boolVal = true;
+ bool val;
+
+ try
+ {
+ Preference.Set(boolKey, boolVal);
+ val = Preference.Get<bool>(boolKey);
+ Assert.AreEqual(boolVal, val, "bool value is not set properly");
+ Preference.Remove(boolKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference bool type remove test")]
+ [Property("SPEC", "Tizen.Applications.Preference.Remove M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Remove_BOOL_TYPE()
+ {
+ Log.Debug("PREF", "@@## Preference remove bool value");
+
+ string boolKey = "rmboolKey";
+ bool boolVal = true;
+ bool val;
+
+ try
+ {
+ Preference.Set(boolKey, boolVal);
+ val = Preference.Get<bool>(boolKey);
+ Preference.Remove(boolKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+
+ Assert.Throws<KeyNotFoundException>(() => Preference.Get<bool>(boolKey));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test Preference set exception case because of wrong parameters")]
+ [Property("SPEC", "Tizen.Applications.Preference.Set M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Set_EXCEPTION_CASE()
+ {
+ Log.Debug("PREF", "@@## Preference set exception");
+
+ Assert.Throws<ArgumentException>(() => Preference.Set(null, 1));
+ Assert.Throws<ArgumentException>(() => Preference.Set(null, 1.1));
+ Assert.Throws<ArgumentException>(() => Preference.Set(null, true));
+ Assert.Throws<ArgumentException>(() => Preference.Set("validkey", null));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test Preference get exception case")]
+ [Property("SPEC", "Tizen.Applications.Preference.Get<T> M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Get_EXCEPTION_CASE()
+ {
+ Log.Debug("PREF", "@@## Preference get exception");
+
+ Assert.Throws<ArgumentException>(() => Preference.Get<int>(null));
+ Assert.Throws<ArgumentException>(() => Preference.Get<bool>(null));
+ Assert.Throws<KeyNotFoundException>(() => Preference.Get<double>("invalidkey"));
+ Assert.Throws<KeyNotFoundException>(() => Preference.Get<string>("invalidkey2"));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test Preference remove exception case")]
+ [Property("SPEC", "Tizen.Applications.Preference.Remove M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Remove_EXCEPTION_CASE()
+ {
+ Log.Debug("PREF", "@@## Preference remove exception");
+
+ Assert.Throws<ArgumentException>(() => Preference.Remove(null));
+ Assert.Throws<KeyNotFoundException>(() => Preference.Remove("invalidkey"));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference contains test to check whether the key is exist or not")]
+ [Property("SPEC", "Tizen.Applications.Preference.Contains M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Contains_RETURN_TYPE_BOOL()
+ {
+ Log.Debug("PREF", "@@## Preference contains test");
+
+ string intKey = "Fin";
+ string stringKey = "Jake";
+ int intVal = 77;
+ string stringVal = "advan";
+ bool result;
+
+ try
+ {
+ Preference.Set(intKey, intVal);
+ Preference.Set(stringKey, stringVal);
+
+ result = Preference.Contains(intKey);
+ Assert.AreEqual(result, true, "int value is not set properly");
+
+ result = Preference.Contains(stringKey);
+ Assert.AreEqual(result, true, "string value is not set properly");
+
+ Preference.Remove(intKey);
+ Preference.Remove(stringKey);
+
+ result = Preference.Contains(intKey);
+ Assert.AreEqual(result, false, "int value is not removed properly");
+
+ result = Preference.Contains(stringKey);
+ Assert.AreEqual(result, false, "string value is not removed properly");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test Preference contains test exception case")]
+ [Property("SPEC", "Tizen.Applications.Preference.Contains M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Contains_EXCEPTION()
+ {
+ Log.Debug("PREF", "@@## Preference contains exception test");
+
+ Assert.Throws<ArgumentException>(() => Preference.Contains(null));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference removeall test to check whether all keys are removed properly")]
+ [Property("SPEC", "Tizen.Applications.Preference.RemoveAll M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void RemoveAll_CHECK_WITHOUT_EXCEPTION()
+ {
+ Log.Debug("PREF", "@@## Preference removeall");
+
+ string intKey = "Gunter";
+ int intVal = 77;
+ string stringKey = "Ice";
+ string stringVal = "King";
+ string doubleKey = "Fiona";
+ double doubleVal = 33.3;
+ string boolKey = "Marcy";
+ bool boolVal = true;
+
+ bool result;
+
+ try
+ {
+ Preference.Set(intKey, intVal);
+ Preference.Set(stringKey, stringVal);
+ Preference.Set(doubleKey, doubleVal);
+ Preference.Set(boolKey, boolVal);
+ Preference.RemoveAll();
+
+ result = Preference.Contains(intKey);
+ Assert.AreEqual(result, false, "int value is not removed properly");
+
+ result = Preference.Contains(stringKey);
+ Assert.AreEqual(result, false, "string value is not removed properly");
+
+ result = Preference.Contains(doubleKey);
+ Assert.AreEqual(result, false, "double value is not removed properly");
+
+ result = Preference.Contains(boolKey);
+ Assert.AreEqual(result, false, "bool value is not removed properly");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference keys test to check get keys list")]
+ [Property("SPEC", "Tizen.Applications.Preference.Keys A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void Keys_RETURN_TYPE_LIST()
+ {
+ Log.Debug("PREF", "@@## Preference keys");
+
+ string intKey = "Gunter";
+ int intVal = 77;
+ string stringKey = "Ice";
+ string stringVal = "King";
+ string doubleKey = "Fiona";
+ double doubleVal = 33.3;
+ string boolKey = "Marcy";
+ bool boolVal = true;
+
+ bool result;
+
+ try
+ {
+ Preference.Set(intKey, intVal);
+ Preference.Set(stringKey, stringVal);
+ Preference.Set(doubleKey, doubleVal);
+ Preference.Set(boolKey, boolVal);
+
+ foreach (string prefKey in Preference.Keys)
+ {
+ result = Preference.Contains(prefKey);
+ Assert.AreEqual(result, true, "key is not in Preference.Keys : " + prefKey);
+ }
+
+ Preference.RemoveAll();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test Preference GetEventContext test exception case")]
+ [Property("SPEC", "Tizen.Applications.Preference.GetEventContext M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void GetEventContext_EXCEPTION()
+ {
+ Log.Debug("PREF", "@@## Preference GetEventContext exception case");
+
+ Preference.EventContext context;
+ Assert.Throws<KeyNotFoundException>(() => Preference.GetEventContext("invalidkey"));
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Preference GetEventContext test")]
+ [Property("SPEC", "Tizen.Applications.Preference.GetEventContext M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void GetEventContext_CHECK_WITHOUT_EXCEPTION()
+ {
+ Log.Debug("PREF", "@@## Preference GetEventContext");
+
+ string intKey = "Fiona";
+ Preference.EventContext context;
+
+ try
+ {
+ Preference.Set(intKey, 33);
+ Preference.GetEventContext(intKey).TryGetTarget(out context);
+ Assert.IsNotNull(context, "Failed to get EventContext");
+
+ Preference.Remove(intKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System.Threading.Tasks;
+
+namespace Tizen.Applications.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.Application.PreferenceChangedEventArgs Tests")]
+ public class PreferenceChangedEventArgsTests
+ {
+ private bool _callbackIsCalled;
+ private PreferenceChangedEventArgs _preferChEvent;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test PreferenceChangedEventArgs method initialization")]
+ [Property("SPEC", "Tizen.Applications.PreferenceChangedEventArgs.PreferenceChangedEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public void PreferenceChangedEventArgs_INIT()
+ {
+ var myPreferenceChangedEventArgs = new PreferenceChangedEventArgs();
+ Assert.IsInstanceOf<PreferenceChangedEventArgs>(myPreferenceChangedEventArgs);
+ Assert.IsNotNull(myPreferenceChangedEventArgs, "PreferenceChangedEventArgs should be not null after init.");
+ }
+
+ private void PreferenceChangedCallback(object sender, PreferenceChangedEventArgs preEv)
+ {
+ Log.Debug("PREF", "@@## PreferenceChangedCallback");
+ _preferChEvent = preEv;
+
+ _callbackIsCalled = true;
+ }
+ public async Task WaitCallback()
+ {
+ int count = 0;
+ while (true)
+ {
+ if (count < 3)
+ count = count + 1;
+ else
+ break;
+
+ if (_callbackIsCalled == true)
+ break;
+
+ await Task.Delay(1000);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test PreferenceChangedEventArgs get Key test")]
+ [Property("SPEC", "Tizen.Applications.PreferenceChangedEventArgs.Key A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
+ public async Task Key_PROPERTY_GET()
+ {
+ Log.Debug("PREF", "@@## PreferenceChangedEventArgs Key_PROPERTY_GET");
+
+ string intKey = "Candy";
+ _callbackIsCalled = false;
+
+ _preferChEvent = new PreferenceChangedEventArgs();
+
+ try
+ {
+ Preference.Set(intKey, 33);
+ Preference.EventContext context;
+ Preference.GetEventContext(intKey).TryGetTarget(out context);
+ if (context != null)
+ {
+ context.Changed += PreferenceChangedCallback;
+ }
+
+ Preference.Set(intKey, 77);
+
+ await WaitCallback();
+
+ Assert.AreEqual(_callbackIsCalled, true, "preference callback is not called");
+ Assert.AreEqual(_preferChEvent.Key, intKey, "preference key is not matched");
+
+ if (context != null)
+ {
+ context.Changed -= PreferenceChangedCallback;
+ }
+
+ Preference.Remove(intKey);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="8" package="Tizen.Applications.Preference.Tests" version="1.0.0">
+ <profile name="common" />
+ <ui-application appid="Tizen.Applications.Preference.Tests"
+ exec="Tizen.Applications.Preference.Tests.dll"
+ type="dotnet"
+ multiple="false"
+ taskmanage="true"
+ launch_mode="single">
+ <icon>Tizen.Applications.Preference.Tests.png</icon>
+ <label>Tizen.Applications.Preference.Tests</label>
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ </privileges>
+</manifest>
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using NUnitLite.TUnit;
+using AutoTemplate;
+
+namespace XamarinForTizen.Tizen
+{
+
+ class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
+ {
+ private static App _app;
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+
+ Console.WriteLine("TCT : OnCreate()");
+ _app = new App();
+ LoadApplication(_app);
+
+ TRunner t = new TRunner();
+ t.LoadTestsuite();
+ t.Execute();
+ }
+
+ public static App getApp()
+ {
+ return _app;
+ }
+ static void Main(string[] args)
+ {
+ Console.WriteLine("TCT : Main()");
+ var app = new Program();
+ global::Xamarin.Forms.Forms.Init(app);
+ app.Run(args);
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <!-- Property Group for .NET Core Project -->
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>tizen80</TargetFramework>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <!-- Property Group for Tizen Project -->
+ <PropertyGroup>
+ <TizenCreateTpkOnBuild>true</TizenCreateTpkOnBuild>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Folder Include="lib\" />
+ </ItemGroup>
+
+ <Import Project="..\Common\dependencies.props" />
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)">
+ <ExcludeAssets>Runtime</ExcludeAssets>
+ </PackageReference>
+ <PackageReference Include="Tizen.NET.Sdk" Version="$(TizenNETSdkVersion)" />
+ </ItemGroup>
+
+ <!-- Include Nuget Package for Tizen Project building -->
+ <ItemGroup>
+ <ProjectReference Include="..\Template\AutoTemplate\AutoTemplate.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio Version 16\r
+VisualStudioVersion = 16.0.30104.148\r
+MinimumVisualStudioVersion = 15.0.26124.0\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.RPCPort.Tests", "Tizen.Applications.RPCPort.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Debug|x64 = Debug|x64\r
+ Debug|x86 = Debug|x86\r
+ Release|Any CPU = Release|Any CPU\r
+ Release|x64 = Release|x64\r
+ Release|x86 = Release|x86\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+using Tizen.Applications.RPCPort;
+
+namespace Tizen.Applications.Tests
+{
+ [TestFixture]
+ [Description("Tizen.Application.RPCPort.Exceptions Tests")]
+ public class ExceptionTests
+ {
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test InvalidIOException initialization")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.InvalidIOException.InvalidIOException C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void InvalidIOException_INIT()
+ {
+ /* TEST CODE */
+ var e = new InvalidIOException();
+
+ Assert.IsNotNull(e, "InvalidIOException shouldn't be null after init");
+ Assert.IsInstanceOf<InvalidOperationException>(e);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test InvalidIDException initialization")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.InvalidIDException.InvalidIDException C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void InvalidIDException_INIT()
+ {
+ /* TEST CODE */
+ var e = new InvalidIDException();
+
+ Assert.IsNotNull(e, "InvalidIDException shouldn't be null after init");
+ Assert.IsInstanceOf<InvalidOperationException>(e);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test PermissionDeniedException initialization")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.PermissionDeniedException.PermissionDeniedException C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void PermissionDeniedException_INIT()
+ {
+ /* TEST CODE */
+ var e = new PermissionDeniedException();
+
+ Assert.IsNotNull(e, "PermissionDeniedException shouldn't be null after init");
+ Assert.IsInstanceOf<InvalidOperationException>(e);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test InvalidProtocolException initialization")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.InvalidProtocolException.InvalidProtocolException C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void InvalidProtocolException_INIT()
+ {
+ /* TEST CODE */
+ var e = new InvalidProtocolException();
+
+ Assert.IsNotNull(e, "InvalidProtocolException shouldn't be null after init");
+ Assert.IsInstanceOf<InvalidOperationException>(e);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test NotConnectedSocketException initialization")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.NotConnectedSocketException.NotConnectedSocketException C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void NotConnectedSocketException_INIT()
+ {
+ /* TEST CODE */
+ var e = new NotConnectedSocketException();
+
+ Assert.IsNotNull(e, "NotConnectedSocketException shouldn't be null after init");
+ Assert.IsInstanceOf<InvalidOperationException>(e);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test InvalidCallbackException initialization")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.InvalidCallbackException.InvalidCallbackException C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void InvalidCallbackException_INIT()
+ {
+ /* TEST CODE */
+ var e = new InvalidCallbackException();
+
+ Assert.IsNotNull(e, "InvalidCallbackException shouldn't be null after init");
+ Assert.IsInstanceOf<InvalidOperationException>(e);
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+using Tizen.Applications.RPCPort;
+
+namespace Tizen.Applications.Tests
+{
+ public class Proxy : ProxyBase
+ {
+ public bool Connected { get; set; }
+
+ public bool Received { get; set; }
+
+ public void SendTestMessage()
+ {
+ using (var p = new Parcel())
+ {
+ p.WriteString("test");
+ p.Send(Port);
+ }
+ }
+
+ protected override void OnConnectedEvent(string endPoint, string portName, Port port)
+ {
+ Connected = true;
+ }
+
+ protected override void OnDisconnectedEvent(string endPoint, string portName)
+ {
+ }
+
+ protected override void OnReceivedEvent(string endPoint, string portName)
+ {
+ using (var p = new Parcel(CallbackPort))
+ {
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ }
+ Received = true;
+ }
+
+ protected override void OnRejectedEvent(string endPoint, string portName)
+ {
+ }
+
+ public void TestConnect()
+ {
+ Connect("org.tizen.example.RpcPortStub", "Test");
+ }
+ }
+
+
+ [TestFixture]
+ [Description("Tizen.Application.RPCPort.Parcel Tests")]
+ public class ParcelTests
+ {
+ private Proxy _proxy;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
+ _proxy = new Proxy();
+ _proxy.TestConnect();
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
+ _proxy.Dispose();
+ _proxy = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Parcel initialization")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Parcel C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void Parcel_INIT()
+ {
+ /* TEST CODE */
+ using (var p = new Parcel())
+ {
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test Parcel initialization with port")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Parcel C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("COVPARAM", "Port")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task Parcel_INIT_WITH_PARAMETER()
+ {
+ /* PRECONDITION
+ * */
+ await Task.Delay(4000);
+ Assert.True(_proxy.Connected);
+ _proxy.SendTestMessage();
+ await Task.Delay(2000);
+
+ /* TEST CODE */
+ Assert.True(_proxy.Received);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test constructor with null argument")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Parcel C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTN")]
+ [Property("COVPARAM", "Port")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void Parcel_NULL_ARGUMENTS()
+ {
+ /* PRECONDITION */
+
+ /* TEST CODE */
+ try
+ {
+ var p = new Parcel(null);
+ }
+ catch (InvalidIOException)
+ {
+ Assert.Pass();
+ }
+
+ Assert.Fail();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Send parcel to the other application which has been connected before")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Send M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task Send_CHECK_WITHOUT_EXCEPTION()
+ {
+ try
+ {
+ /* PRECONDITION */
+ await Task.Delay(2000);
+ Assert.True(_proxy.Connected);
+
+ /* TEST CODE */
+ _proxy.SendTestMessage();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail(e.ToString());
+ }
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Send parcel with null Port object")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Send M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void Send_WITH_NULL_ARGUMENTS()
+ {
+ /* PRECONDITION */
+ using (var p = new Parcel())
+ {
+ /* TEST CODE */
+ try
+ {
+ p.Send(null);
+ }
+ catch (InvalidIOException)
+ {
+ Assert.Pass();
+ }
+ }
+
+ Assert.Fail();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Read a byte from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadByte M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void ReadByte_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ p.WriteByte(0x33);
+
+ /* TEST CODE */
+ byte b = p.ReadByte();
+ Assert.IsTrue((b == 0x33), "ReadByte failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Read 'short' type value from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadShort M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void ReadShort_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ p.WriteShort(100);
+
+ /* TEST CODE */
+ short b = p.ReadShort();
+ Assert.IsTrue((b == 100), "ReadShort failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Read 'int' type value from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadInt M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void ReadInt_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ p.WriteInt(100);
+
+ /* TEST CODE */
+ int b = p.ReadInt();
+ Assert.IsTrue((b == 100), "ReadInt failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Read 'long' type value from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadLong M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void ReadLong_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ p.WriteLong(100);
+
+ /* TEST CODE */
+ long b = p.ReadLong();
+ Assert.IsTrue((b == 100), "ReadLong failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Read 'float' type value from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadFloat M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void ReadFloat_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ p.WriteFloat(1.0f);
+
+ /* TEST CODE */
+ float b = p.ReadFloat();
+ Assert.IsTrue((b == 1.0f), "ReadFloat failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Read 'double' type value from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadDouble M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void ReadDouble_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ p.WriteDouble(1.0);
+
+ /* TEST CODE */
+ double b = p.ReadDouble();
+ Assert.IsTrue((b == 1.0), "ReadDouble failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Read 'string' type value from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadString M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void ReadString_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ p.WriteString("test");
+
+ /* TEST CODE */
+ string b = p.ReadString();
+ Assert.IsTrue((b == "test"), "ReadString failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Read 'bool' type value from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadBool M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void ReadBool_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ p.WriteBool(true);
+
+ /* TEST CODE */
+ bool b = p.ReadBool();
+ Assert.IsTrue(b, "ReadBool failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Read 'Bundle' type value from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadBundle M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void ReadBundle_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ using (var b = new Bundle())
+ {
+ b.AddItem("key", "value");
+ p.WriteBundle(b);
+ }
+
+ /* TEST CODE */
+ using (Bundle b = p.ReadBundle())
+ {
+ Assert.IsNotNull(b, "Bundle shouldn't be null");
+ string val = b.GetItem<string>("key");
+ Assert.IsTrue(val == "value", "ReadBundle failed");
+ }
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Read array count from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadArrayCount M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void ReadArrayCount_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ p.WriteArrayCount(10);
+
+ /* TEST CODE */
+ int b = p.ReadArrayCount();
+ Assert.IsTrue(b == 10, "ReadArrayCount failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Read bytes from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Read M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void Read_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ var bts = new byte[10] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ p.Write(bts);
+
+ /* TEST CODE */
+ var b = p.Read(10);
+ for (int i = 0; i < 10; i++)
+ {
+ Assert.IsTrue(b[i] == i, "Read failed");
+ }
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Write a byte to parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteByte M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void WriteByte_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+
+ /* TEST CODE */
+ p.WriteByte(0x33);
+ byte b = p.ReadByte();
+ Assert.IsTrue((b == 0x33), "WriteByte failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Write 'short' type value to parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteShort M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void WriteShort_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+
+ /* TEST CODE */
+ p.WriteShort(100);
+ short b = p.ReadShort();
+ Assert.IsTrue((b == 100), "WriteShort failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Write 'int' type value to parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteInt M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void WriteInt_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+
+ /* TEST CODE */
+ p.WriteInt(100);
+ int b = p.ReadInt();
+ Assert.IsTrue((b == 100), "WriteInt failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Write 'long' type value to parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteLong M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void WriteLong_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+
+ /* TEST CODE */
+ p.WriteLong(100);
+ long b = p.ReadLong();
+ Assert.IsTrue((b == 100), "WriteLong failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Write 'float' type value to parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteFloat M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void WriteFloat_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+
+ /* TEST CODE */
+ p.WriteFloat(1.0f);
+ float b = p.ReadFloat();
+ Assert.IsTrue((b == 1.0f), "WriteFloat failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Write 'double' type value to parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteDouble M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void WriteDouble_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+
+ /* TEST CODE */
+ p.WriteDouble(1.0);
+ double b = p.ReadDouble();
+ Assert.IsTrue((b == 1.0), "WriteDouble failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Wrtie 'string' type value to parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteString M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void WriteString_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+
+ /* TEST CODE */
+ p.WriteString("test");
+ string b = p.ReadString();
+ Assert.IsTrue((b == "test"), "WriteString failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Write 'bool' type value to parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteBool M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void WriteBool_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+
+ /* TEST CODE */
+ p.WriteBool(true);
+ bool b = p.ReadBool();
+ Assert.IsTrue(b, "WriteBool failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Write 'Bundle' type value to parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteBundle M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void WriteBundle_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+
+ using (var b = new Bundle())
+ {
+ b.AddItem("key", "value");
+
+ /* TEST CODE */
+ p.WriteBundle(b);
+ }
+
+ using (Bundle b = p.ReadBundle())
+ {
+ Assert.IsNotNull(b, "Bundle shouldn't be null");
+ string val = b.GetItem<string>("key");
+ Assert.IsTrue(val == "value", "WriteBundle failed");
+ }
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Write array count from parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteArrayCount M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void WriteArrayCount_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+
+ /* TEST CODE */
+ p.WriteArrayCount(10);
+ int b = p.ReadArrayCount();
+ Assert.IsTrue(b == 10, "WriteArrayCount failed");
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Write bytes to parcel")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Write M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void Write_RETURN()
+ {
+ using (var p = new Parcel())
+ {
+ /* PRECONDITION */
+ Assert.IsInstanceOf<RPCPort.Parcel>(p);
+ Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
+ var bts = new byte[10] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+
+ /* TEST CODE */
+ p.Write(bts);
+ var b = p.Read(10);
+ for (int i = 0; i < 10; i++)
+ {
+ Assert.IsTrue(b[i] == i, "Write failed");
+ }
+ }
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System.Threading.Tasks;
+using Tizen.Applications.RPCPort;
+
+namespace Tizen.Applications.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.Application.RPCPort.ProxyBase Tests")]
+ public class ProxyBaseTests
+ {
+ private Proxy _proxy;
+
+ public class Proxy : ProxyBase
+ {
+ public bool Connected { get; set; }
+ public bool Disconnected { get; set; }
+ public bool Rejected { get; set; }
+
+ public string Result { get; set; }
+
+ private Port _port;
+
+ public void SendHello()
+ {
+ using (Parcel p = new Parcel())
+ {
+ p.WriteString("hello");
+ p.Send(_port);
+ }
+ }
+
+ protected override void OnConnectedEvent(string endPoint, string portName, Port port)
+ {
+ Connected = true;
+ _port = port;
+ }
+
+ protected override void OnDisconnectedEvent(string endPoint, string portName)
+ {
+ Disconnected = true;
+ }
+
+ protected override void OnReceivedEvent(string endPoint, string portName)
+ {
+ using (Parcel p = new Parcel(GetPort(Port.Type.Callback)))
+ {
+ Result = p.ReadString();
+ }
+ }
+
+ protected override void OnRejectedEvent(string endPoint, string portName)
+ {
+ Rejected = true;
+ }
+
+ public void TestConnect()
+ {
+ Connect("org.tizen.example.RpcPortStub", "Test");
+ }
+
+ public void ConnectForInvalidIOException()
+ {
+ Connect("invalid.app", "Test");
+ }
+ public void ConnectForRejectedEvent()
+ {
+ Connect("org.tizen.example.RpcPortStub2", "Test");
+ }
+
+ public void TestGetPort()
+ {
+ Port p = GetPort(Port.Type.Main);
+ Assert.NotNull(p);
+
+ p = GetPort(Port.Type.Callback);
+ Assert.NotNull(p);
+ }
+
+ public Port GetPort()
+ {
+ return Port;
+ }
+
+ public Port GetCallbackPort()
+ {
+ return CallbackPort;
+ }
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
+ _proxy = new Proxy();
+ _proxy.TestConnect();
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
+ _proxy?.Dispose();
+ _proxy = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test ProxyBase initialization")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.ProxyBase.ProxyBase C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void ProxyBase_INIT()
+ {
+ var p = new Proxy();
+
+ Assert.IsInstanceOf<ProxyBase>(p);
+ Assert.IsNotNull(p, "Proxy shouldn't be null");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Connect to stub application")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.Connect M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task Connect_RETURN()
+ {
+ /* PRECONDITION */
+ await Task.Delay(4000);
+
+ /* TEST CODE */
+ Assert.True(_proxy.Connected);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test : Try to reconnect to app without disposing")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.Connect M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task Connect_CHECK_INVALID_ID_EXCEPTION()
+ {
+ /* PRECONDITION */
+ await Task.Delay(4000);
+ Assert.True(_proxy.Connected);
+
+ try
+ {
+ /* TEST CODE */
+ _proxy.TestConnect();
+ }
+ catch (InvalidIDException)
+ {
+ Assert.Pass();
+ }
+
+ Assert.Fail();
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test : Connect to invalid stub application")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.Connect M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void Connect_CHECK_INVALID_IO_EXCEPTION()
+ {
+ /* PRECONDITION */
+ _proxy?.Dispose();
+ _proxy = new Proxy();
+
+ try
+ {
+ /* TEST CODE */
+ _proxy.ConnectForInvalidIOException();
+ }
+ catch (InvalidIOException)
+ {
+ Assert.Pass();
+ }
+
+ Assert.Fail();
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test : Connect to stub application with invalid permission")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.Connect M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task Connect_CHECK_PERMISSION_DENIED_EXCEPTION()
+ {
+ /* PRECONDITION */
+ _proxy?.Dispose();
+ _proxy = null;
+ AppControlReplyResult ret = AppControlReplyResult.Failed;
+
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy2"
+ };
+
+ AppControl.SendLaunchRequest(c, (AppControl launchRequest, AppControl replyRequest, AppControlReplyResult result) =>
+ {
+ ret = result;
+ });
+ await Task.Delay(4000);
+
+ /* TEST CODE */
+ Assert.True(ret == AppControlReplyResult.Succeeded);
+
+ /* POSTCONDITION */
+ c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy2"
+ };
+
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(2000);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : OnConnected events")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.OnConnectedEvent E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task OnConnectedEvent_CHECK_CB()
+ {
+ /* PRECONDITION */
+ await Task.Delay(4000);
+
+ /* TEST CODE */
+ Assert.True(_proxy.Connected);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : OnDisconnected events")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.OnDisconnectedEvent E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task OnDisconnectedEvent_CHECK_CB()
+ {
+ /* PRECONDITION */
+ await Task.Delay(4000);
+ Assert.True(_proxy.Connected);
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortStub"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(4000);
+
+ /* TEST CODE */
+ Assert.True(_proxy.Disconnected);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : OnRejected events")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.OnRejectedEvent E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task OnRejectedEvent_CHECK_CB()
+ {
+ /* PRECONDITION */
+ _proxy?.Dispose();
+ _proxy = new Proxy();
+ _proxy.ConnectForRejectedEvent();
+ await Task.Delay(4000);
+
+ /* TEST CODE */
+ Assert.True(_proxy.Rejected);
+
+ /* POSTCONDITION */
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortStub2"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(2000);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : OnReceived events")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.OnReceivedEvent E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task OnReceivedEvent_CHECK_CB()
+ {
+ /* PRECONDITION */
+ await Task.Delay(4000);
+ Assert.True(_proxy.Connected);
+ _proxy.SendHello();
+ await Task.Delay(4000);
+
+ /* TEST CODE */
+ Assert.NotNull(_proxy.Result);
+ Assert.True(_proxy.Result.Equals("hello"));
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test : GetPort from disconnected object")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.GetPort M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task GetPort_CHECK_EXCEPTION()
+ {
+ /* PRECONDITION */
+ await Task.Delay(4000);
+ Assert.True(_proxy.Connected);
+ _proxy?.Dispose();
+
+ /* TEST CODE */
+ try
+ {
+ _proxy.TestGetPort();
+ }
+ catch (InvalidIOException)
+ {
+ Assert.Pass();
+ }
+ finally
+ {
+ _proxy = null;
+ }
+
+ Assert.Fail();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : GetPort from proxy object")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.GetPort M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task GetPort_RETURN()
+ {
+ /* PRECONDITION */
+ await Task.Delay(4000);
+ Assert.True(_proxy.Connected);
+
+ /* TEST CODE */
+ _proxy.TestGetPort();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Port Property")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.ProxyBase.Port A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task Port_PROPERTY_GET()
+ {
+ /* PRECONDITION */
+ await Task.Delay(4000);
+ Assert.True(_proxy.Connected);
+
+ /* TEST CODE */
+ Assert.NotNull(_proxy.GetPort());
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : CallbackPort Property")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.ProxyBase.CallbackPort A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task CallbackPort_PROPERTY_GET()
+ {
+ /* PRECONDITION */
+ await Task.Delay(4000);
+ Assert.True(_proxy.Connected);
+
+ /* TEST CODE */
+ Assert.NotNull(_proxy.GetCallbackPort());
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Tizen.Applications.RPCPort;
+
+namespace Tizen.Applications.Tests
+{
+ [TestFixture]
+ [Description("Tizen.Application.RPCPort.StubBase Tests")]
+ public class StubBaseTests
+ {
+ private Stub _stub;
+ private static bool _disposed;
+
+ public class Stub : StubBase
+ {
+ public bool Connected { get; set; }
+ public bool Disconnected { get; set; }
+ public bool Received { get; set; }
+ public string Instance { get; set; }
+
+ public Stub(string portName) : base(portName)
+ {
+ }
+
+ protected override void OnConnectedEvent(string sender, string instance)
+ {
+ Connected = true;
+ Instance = instance;
+ }
+
+ protected override void OnDisconnectedEvent(string sender, string instance)
+ {
+ Disconnected = true;
+ }
+
+ protected override bool OnReceivedEvent(string sender, string instance, Port port)
+ {
+ Received = true;
+ using (var p = new Parcel(port))
+ {
+
+ }
+ return true;
+ }
+
+ protected override void OnTerminatedEvent()
+ {
+ _disposed = true;
+ }
+
+ public void TestListen()
+ {
+ Listen();
+ }
+
+ public void TestGetPort(string inst)
+ {
+ Port p = GetPort(Port.Type.Main, inst);
+ Assert.NotNull(p);
+
+ p = GetPort(Port.Type.Callback, inst);
+ Assert.NotNull(p);
+ }
+
+ public void TestAddPrivilege()
+ {
+ AddPrivilege("test.privilege");
+ }
+
+ public void TestAddPrivilegeWithNull()
+ {
+ AddPrivilege(null);
+ }
+
+ public void TestSetTrusted(bool trusted)
+ {
+ SetTrusted(trusted);
+ }
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
+ _stub = new Stub("Test");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
+ _stub?.Dispose();
+ _stub = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test StubBase initialization")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.StubBase C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void StubBase_INIT()
+ {
+ Assert.IsInstanceOf<StubBase>(_stub);
+ Assert.IsNotNull(_stub, "Stub shouldn't be null");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Listen to proxy application")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.Listen M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task Listen_CHECK_RETURN()
+ {
+ /* PRECONDITION */
+ _stub.TestListen();
+ var ctrl = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+
+ AppControl.SendLaunchRequest(ctrl);
+
+ await Task.Delay(4000);
+
+ /* TEST CODE */
+ Assert.True(_stub.Connected);
+
+ /* POSTCONDITION */
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(2000);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test : Listen to proxy application after being disposed")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.Listen M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void Listen_CHECK_WITH_EXCEPTION()
+ {
+ /* PRECONDITION */
+ _stub?.Dispose();
+
+ try
+ {
+ /* TEST CODE */
+ _stub.TestListen();
+ }
+ catch (InvalidIOException)
+ {
+ Assert.Pass();
+ }
+ finally
+ {
+ _stub = null;
+ }
+
+ Assert.Fail();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : OnConnected events")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.OnConnectedEvent E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task OnConnectedEvent_CHECK_CB()
+ {
+ /* PRECONDITION */
+ _stub.TestListen();
+ var ctrl = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+
+ AppControl.SendLaunchRequest(ctrl);
+ await Task.Delay(4000);
+
+ /* TEST CODE */
+ Assert.True(_stub.Connected);
+
+ /* POSTCONDITION */
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(2000);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : OnDisconnected events")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.OnDisconnectedEvent E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task OnDisconnectedEvent_CHECK_CB()
+ {
+ /* PRECONDITION */
+ _stub.TestListen();
+ var ctrl = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+
+ AppControl.SendLaunchRequest(ctrl);
+ await Task.Delay(4000);
+ Assert.True(_stub.Connected);
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(3000);
+
+ /* TEST CODE */
+ Assert.True(_stub.Disconnected);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : OnReceived events")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.OnReceivedEvent E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task OnReceivedEvent_CHECK_CB()
+ {
+ /* PRECONDITION */
+ _stub.TestListen();
+ var ctrl = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+ ctrl.ExtraData.Add("send", "hello");
+
+ AppControl.SendLaunchRequest(ctrl);
+ await Task.Delay(4000);
+ Assert.True(_stub.Connected);
+
+ /* TEST CODE */
+ Assert.True(_stub.Received);
+
+ /* POSTCONDITION */
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(3000);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : OnTerminated events")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.OnTerminatedEvent E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task OnTerminatedEvent_CHECK_CB()
+ {
+ /* PRECONDITION */
+ _stub.TestListen();
+ var ctrl = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+
+ AppControl.SendLaunchRequest(ctrl);
+ await Task.Delay(4000);
+ Assert.True(_stub.Connected);
+ _disposed = false;
+
+ /* TEST CODE */
+ _stub.Dispose();
+ Assert.True(_disposed);
+
+ /* POSTCONDITION */
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(3000);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : GetPort from stub object")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.GetPort M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task GetPort_RETURN()
+ {
+ /* PRECONDITION */
+ _stub.TestListen();
+ var ctrl = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+
+ AppControl.SendLaunchRequest(ctrl);
+
+ await Task.Delay(4000);
+ Assert.True(_stub.Connected);
+ Assert.NotNull(_stub.Instance);
+
+ /* TEST CODE */
+ _stub.TestGetPort(_stub.Instance);
+
+ /* POSTCONDITION */
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(2000);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test : GetPort from wrong instance")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.GetPort M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task GetPort_CHECK_INVALID_IO_EXCEPTION()
+ {
+ /* PRECONDITION */
+ _stub.TestListen();
+ var ctrl = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+
+ AppControl.SendLaunchRequest(ctrl);
+ await Task.Delay(4000);
+
+ Assert.True(_stub.Connected);
+ Assert.NotNull(_stub.Instance);
+
+ try
+ {
+ /* TEST CODE */
+ _stub.TestGetPort("wrong_inst");
+
+ }
+ catch (InvalidIOException)
+ {
+ Assert.Pass();
+ }
+ finally
+ {
+ /* POSTCONDITION */
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(2000);
+ }
+
+ Assert.Fail();
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test : GetPort from wrong stub object")]
+ [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.GetPort M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void GetPort_CHECK_INVALID_ID_EXCEPTION()
+ {
+ /* PRECONDITION */
+ _stub.TestListen();
+ _stub.Dispose();
+
+ try
+ {
+ /* TEST CODE */
+ _stub.TestGetPort("wrong_instance");
+ }
+ catch (InvalidIDException)
+ {
+ Assert.Pass();
+ }
+ finally
+ {
+ _stub = null;
+ }
+
+ Assert.Fail();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Add privilege to stub object")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.AddPrivilege M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task AddPrivilege_RETURN()
+ {
+ /* PRECONDITION */
+
+ /* TEST CODE */
+ _stub.TestAddPrivilege();
+ _stub.TestListen();
+ var ctrl = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+
+ AppControl.SendLaunchRequest(ctrl);
+
+ await Task.Delay(4000);
+ Assert.False(_stub.Connected);
+
+ /* POSTCONDITION */
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(2000);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Test : Add privilege with null argument")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.AddPrivilege M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void AddPrivilege_CHECK_WITH_EXCEPTION()
+ {
+ /* PRECONDITION */
+
+ /* TEST CODE */
+ try
+ {
+ _stub.TestAddPrivilegeWithNull();
+ }
+ catch (ArgumentNullException)
+ {
+ Assert.Pass();
+ }
+ Assert.Fail();
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Set trusted flag as true")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.SetTrusted M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task SetTrusted_RETURN1()
+ {
+ /* PRECONDITION */
+
+ /* TEST CODE */
+ _stub.TestSetTrusted(true);
+ _stub.TestListen();
+ var ctrl = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+
+ AppControl.SendLaunchRequest(ctrl);
+ await Task.Delay(4000);
+ Assert.False(_stub.Connected);
+
+ /* POSTCONDITION */
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(2000);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : Set trusted flag as false")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.SetTrusted M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public async Task SetTrusted_RETURN2()
+ {
+ /* PRECONDITION */
+
+ /* TEST CODE */
+ _stub.TestSetTrusted(false);
+ _stub.TestListen();
+ var ctrl = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+
+ AppControl.SendLaunchRequest(ctrl);
+ await Task.Delay(4000);
+ Assert.True(_stub.Connected);
+
+ /* POSTCONDITION */
+ var c = new AppControl()
+ {
+ ApplicationId = "org.tizen.example.RpcPortProxy"
+ };
+ c.ExtraData.Add("Test", "finish");
+ AppControl.SendLaunchRequest(c);
+ await Task.Delay(2000);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test : PortName Property")]
+ [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.PortName A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
+ public void PortName_PROPERTY_GET()
+ {
+ Assert.NotNull(_stub.PortName);
+ Assert.True(_stub.PortName.Equals("Test"));
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest package="Tizen.Applications.RPCPort.Tests" version="1.0.0" api-version="8" xmlns="http://tizen.org/ns/packages">
+ <profile name="common" />
+ <ui-application appid="Tizen.Applications.RPCPort.Tests" exec="Tizen.Applications.RPCPort.Tests.dll" multiple="false" taskmanage="true" type="dotnet" launch_mode="single">
+ <icon>Tizen.Applications.RPCPort.Tests.png</icon>
+ <label>Tizen.Applications.RPCPort.Tests</label>
+ <splash-screens />
+ </ui-application>
+ <shortcut-list />
+ <privileges>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ <privilege>http://tizen.org/privilege/datasharing</privilege>
+ </privileges>
+ <dependencies />
+ <provides-appdefined-privileges />
+</manifest>
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using NUnitLite.TUnit;
+using AutoTemplate;
+
+namespace XamarinForTizen.Tizen
+{
+
+ class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
+ {
+ private static App _app;
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+
+ Console.WriteLine("TCT : OnCreate()");
+ _app = new App();
+ LoadApplication(_app);
+
+ TRunner t = new TRunner();
+ t.LoadTestsuite();
+ t.Execute();
+ }
+
+ public static App getApp()
+ {
+ return _app;
+ }
+ static void Main(string[] args)
+ {
+ Console.WriteLine("TCT : Main()");
+ var app = new Program();
+ global::Xamarin.Forms.Forms.Init(app);
+ app.Run(args);
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <!-- Property Group for .NET Core Project -->
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>tizen80</TargetFramework>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <!-- Property Group for Tizen Project -->
+ <PropertyGroup>
+ <TizenCreateTpkOnBuild>true</TizenCreateTpkOnBuild>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Folder Include="lib\" />
+ </ItemGroup>
+
+ <Import Project="..\Common\dependencies.props" />
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)">
+ <ExcludeAssets>Runtime</ExcludeAssets>
+ </PackageReference>
+ <PackageReference Include="Tizen.NET.Sdk" Version="$(TizenNETSdkVersion)" />
+ </ItemGroup>
+
+ <!-- Include Nuget Package for Tizen Project building -->
+ <ItemGroup>
+ <ProjectReference Include="..\Template\AutoTemplate\AutoTemplate.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio Version 16\r
+VisualStudioVersion = 16.0.30104.148\r
+MinimumVisualStudioVersion = 15.0.26124.0\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Service.Tests", "Tizen.Applications.Service.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Debug|x64 = Debug|x64\r
+ Debug|x86 = Debug|x86\r
+ Release|Any CPU = Release|Any CPU\r
+ Release|x64 = Release|x64\r
+ Release|x86 = Release|x86\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+
+namespace Tizen.Applications.Tests
+{
+
+ [TestFixture]
+ [Description("ServiceApplication init test")]
+ public class ServiceApplicationTests
+ {
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ServiceApplication() constructor.")]
+ [Property("SPEC", "Tizen.Applications.ServiceApplication.ServiceApplication C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Nguyen Duc Han, duchan.ng.d@samsung.com")]
+ public void ServiceApplication_INIT()
+ {
+ /* TEST CODE */
+ Application App = new ServiceApplication();
+ Assert.IsNotNull(App, "Application should be not null after init");
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="8" package="Tizen.Applications.Service.Tests" version="1.0.0">
+ <profile name="common" />
+ <ui-application appid="Tizen.Applications.Service.Tests"
+ exec="Tizen.Applications.Service.Tests.dll"
+ type="dotnet"
+ multiple="false"
+ taskmanage="true"
+ launch_mode="single">
+ <icon>Tizen.Applications.Service.Tests.png</icon>
+ <label>Tizen.Applications.Service.Tests</label>
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ </privileges>
+</manifest>
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26730.15
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30104.148
MinimumVisualStudioVersion = 15.0.26124.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Tests", "Tizen.Applications.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}"
EndProject
{FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU
{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.NUI|Any CPU.ActiveCfg = Debug|Any CPU
- {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.NUI|Any CPU.Build.0 = Debug|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU
{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
//Assert.IsTrue (rFlag, " rFlag should be true after SendLaunchReques"); //this code will be used when API "AppControlReplyCallback" working
}
- [Test]
- [Category("P1")]
- [Description("Test : Send Terminate Request - UI app should be terminated")]
- [Property("SPEC", "Tizen.Applications.AppControl.SendTerminateRequest M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")]
- public async Task SendTerminateRequest_TO_A_UI_APP()
- {
- /* PRECONDITION
- * Install org.tizen.example.UIApp.Tizen.tpk <in folder res/>
- * Privilege: http://tizen.org/privilege/appmanager.launch
- * */
-
- /* TEST CODE */
- AppControl MyAppControl = new Tizen.Applications.AppControl(true);
- Assert.IsNotNull(MyAppControl, "Object should not be null after initializing");
-
- MyAppControl.Operation = AppControlOperations.Default;
- MyAppControl.ApplicationId = MyUIAppId;
- MyAppControl.LaunchMode = AppControlLaunchMode.Group;
-
- Tizen.Applications.AppControl.SendLaunchRequest(MyAppControl, AppControlReplyReceivedCallback);
- await waitFlag();
- Assert.IsTrue(_flag, MyUIAppId + "should be running after launching request has sent");
-
- bool IsRunning = false;
- Tizen.Applications.AppControl.SendTerminateRequest(MyAppControl);
- _runningApps = ApplicationManager.GetRunningApplicationsAsync();
-
- _list = await _runningApps;
- foreach (var app in _list)
- {
- if (app.ApplicationId == MyUIAppId)
- IsRunning = true;
- }
- Assert.IsTrue(!IsRunning, MyUIAppId + "should not be running after terminating request has sent");
- }
-
[Test]
[Category("P2")]
[Description("SendTerminateRequest - Send terminate request with null argument")]
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-
-namespace Tizen.Applications.Tests
-{
- [TestFixture]
- [Description("TSCoreUIApplication init test")]
- public class CoreUIApplicationTests
- {
- [SetUp]
- public void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("UIApplication() constructor.")]
- [Property("SPEC", "Tizen.Applications.CoreUIApplication.CoreUIApplication C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Nguyen Duc Han, duchan.ng.d@samsung.com")]
- public void CoreUIApplication_INIT()
- {
- /* TEST CODE */
- Application app = new CoreUIApplication();
- Assert.IsNotNull(app, "Application should be not null after init");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Check whether CurrentDeviceOrientation returns expected value or not")]
- [Property("SPEC", "Tizen.Applications.CoreUIApplication.CurrentDeviceOrientation A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")]
- public void CurrentDeviceOrientation_PROPERTY_GET()
- {
- CoreUIApplication app = new CoreUIApplication();
- var deviceOrientation = app.CurrentDeviceOrientation;
- Assert.IsInstanceOf<DeviceOrientation>(deviceOrientation);
- Assert.IsTrue((deviceOrientation == DeviceOrientation.Orientation_0) ||\r
- (deviceOrientation == DeviceOrientation.Orientation_90) ||\r
- (deviceOrientation == DeviceOrientation.Orientation_180) ||\r
- (deviceOrientation == DeviceOrientation.Orientation_270),
- "Property \"CurrentDeviceOrientation\": should be Orientation_0 or Orientation_90 or Orientation_180 or Orientation_270");
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Tizen.Applications.Messages;
-using XamarinForTizen.Tizen;
-
-namespace Tizen.Applications.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Applications.Messages.MessagePort Test : send and receive messages between applications through MessagePort")]
- public class MessagePortTests
- {
- protected readonly string LogTag = typeof(Program).Namespace;
- private Tizen.Applications.Messages.MessagePort _messagePort;
- private Task<IEnumerable<ApplicationRunningContext>> _runningApps;
- private Bundle _message;
- private RemoteValues _remote;
- private IEnumerable<ApplicationRunningContext> _list;
- private const string PortName = "LocalPort";
- private const string MyRemoteAppId = "org.tizen.MsgPortApp.Tizen";
- private const string MyRemoteAppId1 = "org.tizen.MsgPortApp1.Tizen";
- private bool _flag;
-
- [SetUp]
- public void Init()
- {
- _messagePort = null;
- _flag = false;
- }
-
- [TearDown]
- public void Destroy()
- {
- _message = null;
- _remote = null;
- if (_messagePort != null)
- {
- _messagePort.Dispose();
- }
- _flag = false;
- if (_runningApps != null)
- {
- _runningApps = null;
- }
- }
-
- void MessageReceivedCallback(object sender, MessageReceivedEventArgs e)
- {
- Log.Debug(LogTag, "receive !! ");
- _message = e.Message;
- _remote = e.Remote;
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Message Received ");
- Console.WriteLine("TCT @@@ Message Received ");
- if (e.Remote.AppId != null)
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "from :" + e.Remote.AppId);
- _flag = true;
- }
- }
-
- void AppControlReplyCallback(Tizen.Applications.AppControl launchRequest, Tizen.Applications.AppControl replyRequest, AppControlReplyResult result)
- {
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : MessagePort Constructor")]
- [Property("SPEC", " Tizen.Applications.Messages.MessagePort.MessagePort C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- public void MessagePort_INIT()
- {
- _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
-
- Assert.IsNotNull(_messagePort, "Object should not be null after initializing");
- Assert.IsInstanceOf<string>(_messagePort.PortName);
- Assert.AreEqual(PortName, _messagePort.PortName, "Value of \"PortName\" should be matched with value of \"portName\"");
- Assert.IsInstanceOf<bool>(_messagePort.Trusted);
- Assert.IsFalse(_messagePort.Trusted, "Value of \"Trusted\" should be false");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : MessagePort Property")]
- [Property("SPEC", " Tizen.Applications.Messages.MessagePort.PortName A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- public void PortName_PROPERTY_SET_GET()
- {
- _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
-
- Assert.IsInstanceOf<string>(_messagePort.PortName);
- Assert.AreEqual(PortName, _messagePort.PortName, "Value of \"PortName\" should be matched with value of \"portName\"");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : MessagePort Property")]
- [Property("SPEC", " Tizen.Applications.Messages.MessagePort.Trusted A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- public void Trusted_PROPERTY_SET_GET()
- {
- _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
-
- Assert.IsInstanceOf<bool>(_messagePort.Trusted);
- Assert.IsFalse(_messagePort.Trusted, "Value of \"Trusted\" should be false");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : MessagePort Property")]
- [Property("SPEC", " Tizen.Applications.Messages.MessagePort.Listening A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- public void Listening_PROPERTY_GET()
- {
- /* PRECONDITION
- * Init MessagePort
- * Start listening
- * */
- _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
-
- _messagePort.Listen();
- Assert.IsTrue(_messagePort.Listening, "The attribute \"Listening\" should be true");
-
- /* TEST CODE */
- _messagePort.StopListening();
- Assert.IsFalse(_messagePort.Listening, "The attribute \"Listening\" should be false");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Register a local message port - it should start listening message")]
- [Property("SPEC", " Tizen.Applications.Messages.MessagePort.Listen M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- public void Listen_FROM_A_PORT()
- {
- /* PRECONDITION
- * Init MessagePort
- * */
- _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
-
- /* TEST CODE */
- _messagePort.Listen();
- Assert.IsTrue(_messagePort.Listening, "The attribute \"Listening\" should be true");
-
- /* POSTCONDITION
- * Unregisters the message port
- * */
- _messagePort.StopListening();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Unregister a local message port - it should stop listening message")]
- [Property("SPEC", " Tizen.Applications.Messages.MessagePort.StopListening M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- public void StopListening_FROM_A_PORT()
- {
- /* PRECONDITION
- * Init MessagePort
- * Start listening
- * */
- _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, false);
-
- _messagePort.Listen();
-
- /* TEST CODE */
- _messagePort.StopListening();
- Assert.IsFalse(_messagePort.Listening, "The attribute \"Listening\" should be false");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Send a message to a remote application")]
- [Property("SPEC", " Tizen.Applications.Messages.MessagePort.Send M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- [Property("COVPARAM", "Tizen.Applications.Bundle, string, string")]
- public async Task Send_A_MESSAGE_TO_A_REMOTE_APP()
- {
- /* PRECONDITION
- * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
- * 2)Init MessagePort -> Start listening
- * */
- string myRemotePort = "RemotePort";
- bool isRunning = false;
- bool trusted = false;
-
- _runningApps = ApplicationManager.GetRunningApplicationsAsync();
- _list = await _runningApps;
- foreach (var app in _list)
- {
- if (app.ApplicationId == MyRemoteAppId)
- {
- isRunning = true;
- break;
- }
-
- }
- Assert.IsTrue(isRunning, MyRemoteAppId + "should be running");
-
- _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, trusted);
- _messagePort.MessageReceived += MessageReceivedCallback;
- _messagePort.Listen();
-
- /* TEST CODE */
- var msg = new Bundle();
- Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
- msg.AddItem("message", "Send_A_MESSAGE_TO_A_REMOTE_APP");
- _messagePort.Send(msg, MyRemoteAppId, myRemotePort);
-
- Log.Debug(LogTag, "send !! ");
-
-
- await Task.Delay(2000);
- Assert.IsTrue(_flag, "Message is not sent");
- _messagePort.MessageReceived -= MessageReceivedCallback;
-
- /* POSTCONDITION
- * Unregisters the message port
- * */
- _messagePort.StopListening();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Send a message to a remote application")]
- [Property("SPEC", " Tizen.Applications.Messages.MessagePort.Send M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- [Property("COVPARAM", "Tizen.Applications.Bundle, string, string, bool")]
- public async Task Send_A_TRUSTED_MESSAGE_TO_A_REMOTE_APP()
- {
- /* PRECONDITION
- * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
- * 2)Init MessagePort -> Start listening
- * */
- string myRemotePort = "RemotePort1";
- bool isRunning = false;
- bool trusted = true;
-
- _runningApps = ApplicationManager.GetRunningApplicationsAsync();
- _list = await _runningApps;
- foreach (var app in _list)
- {
- if (app.ApplicationId == MyRemoteAppId)
- {
- isRunning = true;
- break;
- }
- }
- Assert.IsTrue(isRunning, MyRemoteAppId + "should be running");
-
- _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, trusted);
- _messagePort.MessageReceived += MessageReceivedCallback;
- _messagePort.Listen();
-
- /* TEST CODE */
- var trustedMsg = new Bundle();
- Assert.IsNotNull(trustedMsg, "Object \"msg\" should not be null after initializing");
- trustedMsg.AddItem("message", "Send_A_TRUSTED_MESSAGE_TO_A_REMOTE_APP");
- _messagePort.Send(trustedMsg, MyRemoteAppId, myRemotePort, trusted);
-
- await Task.Delay(2000);
- Assert.IsTrue(_flag, "Message is not sent");
- _messagePort.MessageReceived -= MessageReceivedCallback;
-
- /* POSTCONDITION
- * Unregisters the message port
- * */
- _messagePort.StopListening();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Check MessageReceived event when receiving a message from a remote application")]
- [Property("SPEC", " Tizen.Applications.Messages.MessagePort.MessageReceived E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- public async Task MessageReceived_CHECK_EVENT()
- {
- /* PRECONDITION
- * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
- * 2)Init MessagePort -> Start listening -> Send a message to remoteApp and wait for callback message to check event
- * */
- string myRemotePort = "RemotePort";
- bool isRunning = false;
- bool trusted = false;
-
- _runningApps = ApplicationManager.GetRunningApplicationsAsync();
- _list = await _runningApps;
- foreach (var app in _list)
- {
- if (app.ApplicationId == MyRemoteAppId1)
- {
- isRunning = true;
- break;
- }
-
- }
- Assert.IsTrue(isRunning, MyRemoteAppId1 + "should be running");
-
- _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, trusted);
- _messagePort.MessageReceived += MessageReceivedCallback;
- _messagePort.Listen();
-
- var msg = new Bundle();
- Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
- msg.AddItem("message", "MessageReceived_CHECK_EVENT");
- _messagePort.Send(msg, MyRemoteAppId1, myRemotePort);
- await Task.Delay(2000);
-
- /* TEST CODE */
- Assert.IsTrue(_flag, "MessageReceived event when receiving a message from a remote application");
- _messagePort.MessageReceived -= MessageReceivedCallback;
-
- /* POSTCONDITION
- * Unregisters the message port
- * */
- _messagePort.StopListening();
- }
-
- //[Test]
- //[Category("P1")]
- //[Description("Test Message Remote of MessageReceivedEventArgs.")]
- //[Property("SPEC", " Tizen.Applications.Messages.MessageReceivedEventArgs.Message A")]
- //[Property("SPEC_URL", "-")]
- //[Property("CRITERIA", "PRO")]
- //[Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")]
- //public async Task Message_GET() {
- // /* PRECONDITION
- // * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
- // * 2)Init MessagePort -> Start listening -> Send a message to remoteApp and wait for callback message to check event
- // * */
- // if (s_message.Count == 0) {
- // LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "message negative");
- // string myRemotePort = "RemotePort";
- // bool isRunning = false;
- // bool trusted = false;
-
- // runningApps = ApplicationManager.GetRunningApplicationsAsync();
- // list = await runningApps;
- // foreach (var app in list) {
- // if (app.ApplicationId == myRemoteAppId1) {
- // isRunning = true;
- // break;
- // }
-
- // }
- // Assert.IsTrue(isRunning, myRemoteAppId1 + "should be running");
-
- // messagePort = new Tizen.Applications.Messages.MessagePort(portName, trusted);
- // Assert.IsNotNull(messagePort, "Object \"messagePort\" should not be null after initializing");
- // messagePort.MessageReceived += MessageReceivedCallback;
- // messagePort.Listen();
-
- // var msg = new Bundle();
- // Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
- // msg.AddItem("message", "MessageReceived_CHECK_EVENT");
- // messagePort.Send(msg, myRemoteAppId1, myRemotePort);
- // await Task.Delay(2000);
- // messagePort.MessageReceived -= MessageReceivedCallback;
- // messagePort.StopListening();
- // }
-
- // /* TEST CODE */
- // Assert.Greater(s_message.Count, 0, "Message of MessageReceivedEventArgs should be more 0");
- //}
-
- //[Test]
- //[Category("P1")]
- //[Description("Test property Remote of MessageReceivedEventArgs.")]
- //[Property("SPEC", " Tizen.Applications.Messages.MessageReceivedEventArgs.Remote A")]
- //[Property("SPEC_URL", "-")]
- //[Property("CRITERIA", "PRO")]
- //[Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")]
- //public async Task Remote_GET() {
- // /* PRECONDITION
- // * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
- // * 2)Init MessagePort -> Start listening -> Send a message to remoteApp and wait for callback message to check event
- // * */
- // LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Remote " + s_remote.AppId);
- // if (s_remote.AppId == null) {
- // LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Remote negative");
- // string myRemotePort = "RemotePort";
- // bool isRunning = false;
- // bool trusted = false;
-
- // runningApps = ApplicationManager.GetRunningApplicationsAsync();
- // list = await runningApps;
- // foreach (var app in list) {
- // if (app.ApplicationId == myRemoteAppId1) {
- // isRunning = true;
- // break;
- // }
-
- // }
- // Assert.IsTrue(isRunning, myRemoteAppId1 + "should be running");
-
- // messagePort = new Tizen.Applications.Messages.MessagePort(portName, trusted);
- // Assert.IsNotNull(messagePort, "Object \"messagePort\" should not be null after initializing");
- // messagePort.MessageReceived += MessageReceivedCallback;
- // messagePort.Listen();
-
- // var msg = new Bundle();
- // Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
- // msg.AddItem("message", "MessageReceived_CHECK_EVENT");
- // messagePort.Send(msg, myRemoteAppId1, myRemotePort);
- // await Task.Delay(2000);
- // messagePort.MessageReceived -= MessageReceivedCallback;
- // messagePort.StopListening();
- // }
-
- // /* TEST CODE */
- // string APP_ID = "org.tizen.MsgPortApp1";
- // Assert.AreEqual(APP_ID, s_remote.AppId, "AppId of Remote of MessageReceivedEventArgs should be " + APP_ID + ".");
- // s_remote = null;
- //}
- }
-}
-
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Tizen.Applications.Messages;
-using XamarinForTizen.Tizen;
-
-namespace Tizen.Applications.Tests
-{
-
- [TestFixture]
- [Description("Test : argument of Received Message ")]
- class MessageReceivedEventArgsTests
- {
- protected readonly string LogTag = typeof(Program).Namespace;
- private Tizen.Applications.Messages.MessagePort _messagePort;
- private Bundle _message;
- private RemoteValues _remote;
- private IEnumerable<ApplicationRunningContext> _list;
- private const string PortName = "LocalPort";
- private const string MyRemoteAppId = "org.tizen.MsgPortApp.Tizen";
- private const string MyRemoteAppId1 = "org.tizen.MsgPortApp1.Tizen";
- private bool _flag;
-
- [SetUp]
- public void Init()
- {
- _messagePort = null;
- _flag = false;
- }
-
- [TearDown]
- public void Destroy()
- {
- if (_messagePort != null)
- {
- _messagePort.Dispose();
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("MessageReceivedEventArgs() constructor.")]
- [Property("SPEC", "Tizen.Applications.Messages.MessageReceivedEventArgs.MessageReceivedEventArgs C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Dao Trong Hieu, tronghieu.d@samsung.com")]
- public void MessageReceivedEventArgs_INIT()
- {
- /* TEST CODE */
- MessageReceivedEventArgs msgReceivedArgs = new MessageReceivedEventArgs();
- Assert.IsNotNull(msgReceivedArgs, "MessageReceivedEventArgs should be not null after init");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Message Remote of MessageReceivedEventArgs.")]
- [Property("SPEC", " Tizen.Applications.Messages.MessageReceivedEventArgs.Message A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")]
- public async Task Message_GET()
- {
- /* PRECONDITION
- * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
- * 2)Init MessagePort -> Start listening -> Send a message to remoteApp and wait for callback message to check event
- * */
- //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "message start ");
- if (_message == null)
- {
- //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "message negative");
- string myRemotePort = "RemotePort";
- bool isRunning = false;
- bool trusted = false;
-
- _list = await ApplicationManager.GetRunningApplicationsAsync();
- foreach (var app in _list)
- {
- if (app.ApplicationId == MyRemoteAppId1)
- {
- isRunning = true;
- break;
- }
-
- }
- Assert.IsTrue(isRunning, MyRemoteAppId1 + "should be running");
-
- _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, trusted);
- Assert.IsNotNull(_messagePort, "Object \"messagePort\" should not be null after initializing");
- _messagePort.MessageReceived += MessageReceivedCallback;
- _messagePort.Listen();
-
- var msg = new Bundle();
- Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
- msg.AddItem("message", "MessageReceived_CHECK_EVENT");
- _messagePort.Send(msg, MyRemoteAppId1, myRemotePort);
- Log.Error(LogTag, "send !! ");
- await Task.Delay(2000);
- _messagePort.MessageReceived -= MessageReceivedCallback;
- _messagePort.StopListening();
- }
-
- /* TEST CODE */
- //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "message end");
- Assert.Greater(_message.Count, 0, "Message of MessageReceivedEventArgs should be more 0");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property Remote of MessageReceivedEventArgs.")]
- [Property("SPEC", " Tizen.Applications.Messages.MessageReceivedEventArgs.Remote A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")]
- public async Task Remote_GET()
- {
- /* PRECONDITION
- * 1)Install org.tizen.MsgPortApp.tpk <in folder res/> and run it
- * 2)Init MessagePort -> Start listening -> Send a message to remoteApp and wait for callback message to check event
- * */
- //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Remote start");
- if (_remote == null)
- {
- //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Remote negative");
- string myRemotePort = "RemotePort";
- bool isRunning = false;
- bool trusted = false;
-
- _list = await ApplicationManager.GetRunningApplicationsAsync();
- foreach (var app in _list)
- {
- if (app.ApplicationId == MyRemoteAppId1)
- {
- isRunning = true;
- break;
- }
-
- }
- Assert.IsTrue(isRunning, MyRemoteAppId1 + "should be running");
-
- _messagePort = new Tizen.Applications.Messages.MessagePort(PortName, trusted);
- Assert.IsNotNull(_messagePort, "Object \"messagePort\" should not be null after initializing");
- _messagePort.MessageReceived += MessageReceivedCallback;
- _messagePort.Listen();
-
- var msg = new Bundle();
- Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
- msg.AddItem("message", "MessageReceived_CHECK_EVENT");
- _messagePort.Send(msg, MyRemoteAppId1, myRemotePort);
- Log.Debug(LogTag, "send !! ");
- await Task.Delay(2000);
- _messagePort.MessageReceived -= MessageReceivedCallback;
- _messagePort.StopListening();
- }
-
- /* TEST CODE */
- string APP_ID = "org.tizen.MsgPortApp1.Tizen";
- //LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Remote end");
- Assert.AreEqual(APP_ID, _remote.AppId, "AppId of Remote of MessageReceivedEventArgs should be " + APP_ID + ".");
- _remote = null;
- }
-
- void MessageReceivedCallback(object sender, MessageReceivedEventArgs e)
- {
- Log.Debug(LogTag, "receive !! ");
- _message = e.Message;
- _remote = e.Remote;
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Message Received ");
- Console.WriteLine("TCT @@@ Message Received ");
- if (e.Remote.AppId != null)
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "from :" + e.Remote.AppId);
- _flag = true;
- }
- }
- }
-}
+++ /dev/null
-using System;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Tizen.Applications.Tests
-{
- [TestFixture]
- [Description("Tizen.Applications.Preference.EventContext test case")]
- public class EventContextTests
- {
- private bool _callbackIsCalled;
- private PreferenceChangedEventArgs _preferChEvent;
- [SetUp]
- public void Init()
- {
- _callbackIsCalled = false;
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
- }
-
- private void PreferenceChangedCallback(object sender, PreferenceChangedEventArgs preEv)
- {
- Log.Debug("PREF", "@@## PreferenceChangedCallback");
- _preferChEvent = preEv;
-
- _callbackIsCalled = true;
- }
- public async Task WaitCallback()
- {
- int count = 0;
- while (true)
- {
- if (count < 3)
- count = count + 1;
- else
- break;
-
- if (_callbackIsCalled == true)
- break;
-
- await Task.Delay(1000);
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference EventContext changed callback calling")]
- [Property("SPEC", "Tizen.Applications.Preference.EventContext.Changed E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public async Task Changed_CALLBACK()
- {
- Log.Debug("PREF", "@@## EventContext Changed_CALLBACK");
-
- string intKey = "Gunter";
- _callbackIsCalled = false;
-
- _preferChEvent = new PreferenceChangedEventArgs();
-
- try
- {
- Preference.Set(intKey, 33);
- Preference.EventContext context;
- Preference.GetEventContext(intKey).TryGetTarget(out context);
- if (context != null)
- {
- context.Changed += PreferenceChangedCallback;
- }
-
- Preference.Set(intKey, 77);
-
- await WaitCallback();
-
- Assert.AreEqual(_callbackIsCalled, true, "preference callback is not called");
- Assert.AreEqual(_preferChEvent.Key, intKey, "preference key is not matched");
-
- if (context != null)
- {
- context.Changed -= PreferenceChangedCallback;
- }
-
- Preference.Remove(intKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Tizen.Applications.Tests
-{
- [TestFixture]
- [Description("Tizen.Applications.Preference test case")]
- public class PreferenceTest
- {
- [SetUp]
- public void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference int type set test")]
- [Property("SPEC", "Tizen.Applications.Preference.Set M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Set_INT_TYPE()
- {
- Log.Debug("PREF", "@@## Preference set int value");
-
- string intKey = "setintkey";
- int intVal = 33;
- int val;
-
- try
- {
- Preference.Set(intKey, intVal);
- val = Preference.Get<int>(intKey);
- Assert.AreEqual(intVal, val, "int value is not set properly");
- Preference.Remove(intKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference int type get test")]
- [Property("SPEC", "Tizen.Applications.Preference.Get<T> M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Get_INT_TYPE()
- {
- Log.Debug("PREF", "@@## Preference get int value ");
-
- string intKey = "getintkey";
- int intVal = 34;
- int val;
-
- try
- {
- Preference.Set(intKey, intVal);
- val = Preference.Get<int>(intKey);
- Assert.AreEqual(intVal, val, "int value is not set properly");
- Preference.Remove(intKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference int type remove test")]
- [Property("SPEC", "Tizen.Applications.Preference.Remove M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Remove_INT_TYPE()
- {
- Log.Debug("PREF", "@@## Preference remove int value");
-
- string intKey = "rmintkey";
- int intVal = 35;
- int val;
-
- try
- {
- Preference.Set(intKey, intVal);
- val = Preference.Get<int>(intKey);
- Preference.Remove(intKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
-
- Assert.Throws<KeyNotFoundException>(() => Preference.Get<int>(intKey));
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference double type set test")]
- [Property("SPEC", "Tizen.Applications.Preference.Set M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Set_DOUBLE_TYPE()
- {
- Log.Debug("PREF", "@@## Preference set double value");
-
- string doubleKey = "setdoublekey";
- double doubleVal = 33.3;
- double val;
-
- try
- {
- Preference.Set(doubleKey, doubleVal);
- val = Preference.Get<double>(doubleKey);
- Assert.AreEqual(doubleVal, val, "double value is not set properly");
- Preference.Remove(doubleKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference double type get test")]
- [Property("SPEC", "Tizen.Applications.Preference.Get<T> M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Get_DOUBLE_TYPE()
- {
- Log.Debug("PREF", "@@## Preference get double value");
-
- string doubleKey = "getdoublekey";
- double doubleVal = 34.4;
- double val;
-
- try
- {
- Preference.Set(doubleKey, doubleVal);
- val = Preference.Get<double>(doubleKey);
- Assert.AreEqual(doubleVal, val, "double value is not set properly");
- Preference.Remove(doubleKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference double type remove test")]
- [Property("SPEC", "Tizen.Applications.Preference.Remove M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Remove_DOUBLE_TYPE()
- {
- Log.Debug("PREF", "@@## Preference get double value");
-
- string doubleKey = "rmdoublekey";
- double doubleVal = 35.5;
- double val;
-
- try
- {
- Preference.Set(doubleKey, doubleVal);
- val = Preference.Get<double>(doubleKey);
- Preference.Remove(doubleKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
-
- Assert.Throws<KeyNotFoundException>(() => Preference.Get<double>(doubleKey));
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference string type set test")]
- [Property("SPEC", "Tizen.Applications.Preference.Set M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Set_STRING_TYPE()
- {
- Log.Debug("PREF", "@@## Preference set string value");
-
- string stringKey = "setstringkey";
- string stringVal = "setPref";
- string val;
-
- try
- {
- Preference.Set(stringKey, stringVal);
- val = Preference.Get<string>(stringKey);
- Assert.AreEqual(stringVal, val, "string value is not set properly");
- Preference.Remove(stringKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference string type get test")]
- [Property("SPEC", "Tizen.Applications.Preference.Get<T> M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Get_STRING_TYPE()
- {
- Log.Debug("PREF", "@@## Preference get string value");
-
- string stringKey = "getstringkey";
- string stringVal = "getPref";
- string val;
-
- try
- {
- Preference.Set(stringKey, stringVal);
- val = Preference.Get<string>(stringKey);
- Assert.AreEqual(stringVal, val, "string value is not set properly");
- Preference.Remove(stringKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference string type remove test")]
- [Property("SPEC", "Tizen.Applications.Preference.Remove M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Remove_STRING_TYPE()
- {
- Log.Debug("PREF", "@@## Preference remove string value");
-
- string stringKey = "rmstringkey";
- string stringVal = "rmPref";
- string val;
-
- try
- {
- Preference.Set(stringKey, stringVal);
- val = Preference.Get<string>(stringKey);
- Preference.Remove(stringKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
-
- Assert.Throws<KeyNotFoundException>(() => Preference.Get<string>(stringKey));
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference bool type set test")]
- [Property("SPEC", "Tizen.Applications.Preference.Set M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Set_BOOL_TYPE()
- {
- Log.Debug("PREF", "@@## Preference set bool value");
-
- string boolKey = "setboolKey";
- bool boolVal = true;
- bool val;
-
- try
- {
- Preference.Set(boolKey, boolVal);
- val = Preference.Get<bool>(boolKey);
- Assert.AreEqual(boolVal, val, "bool value is not set properly");
- Preference.Remove(boolKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference bool type get test")]
- [Property("SPEC", "Tizen.Applications.Preference.Get<T> M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Get_BOOL_TYPE()
- {
- Log.Debug("PREF", "@@## Preference get bool value");
-
- string boolKey = "getboolKey";
- bool boolVal = true;
- bool val;
-
- try
- {
- Preference.Set(boolKey, boolVal);
- val = Preference.Get<bool>(boolKey);
- Assert.AreEqual(boolVal, val, "bool value is not set properly");
- Preference.Remove(boolKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference bool type remove test")]
- [Property("SPEC", "Tizen.Applications.Preference.Remove M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Remove_BOOL_TYPE()
- {
- Log.Debug("PREF", "@@## Preference remove bool value");
-
- string boolKey = "rmboolKey";
- bool boolVal = true;
- bool val;
-
- try
- {
- Preference.Set(boolKey, boolVal);
- val = Preference.Get<bool>(boolKey);
- Preference.Remove(boolKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
-
- Assert.Throws<KeyNotFoundException>(() => Preference.Get<bool>(boolKey));
- }
-
- [Test]
- [Category("P2")]
- [Description("Test Preference set exception case because of wrong parameters")]
- [Property("SPEC", "Tizen.Applications.Preference.Set M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Set_EXCEPTION_CASE()
- {
- Log.Debug("PREF", "@@## Preference set exception");
-
- Assert.Throws<ArgumentException>(() => Preference.Set(null, 1));
- Assert.Throws<ArgumentException>(() => Preference.Set(null, 1.1));
- Assert.Throws<ArgumentException>(() => Preference.Set(null, true));
- Assert.Throws<ArgumentException>(() => Preference.Set("validkey", null));
- }
-
- [Test]
- [Category("P2")]
- [Description("Test Preference get exception case")]
- [Property("SPEC", "Tizen.Applications.Preference.Get<T> M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Get_EXCEPTION_CASE()
- {
- Log.Debug("PREF", "@@## Preference get exception");
-
- Assert.Throws<ArgumentException>(() => Preference.Get<int>(null));
- Assert.Throws<ArgumentException>(() => Preference.Get<bool>(null));
- Assert.Throws<KeyNotFoundException>(() => Preference.Get<double>("invalidkey"));
- Assert.Throws<KeyNotFoundException>(() => Preference.Get<string>("invalidkey2"));
- }
-
- [Test]
- [Category("P2")]
- [Description("Test Preference remove exception case")]
- [Property("SPEC", "Tizen.Applications.Preference.Remove M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Remove_EXCEPTION_CASE()
- {
- Log.Debug("PREF", "@@## Preference remove exception");
-
- Assert.Throws<ArgumentException>(() => Preference.Remove(null));
- Assert.Throws<KeyNotFoundException>(() => Preference.Remove("invalidkey"));
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference contains test to check whether the key is exist or not")]
- [Property("SPEC", "Tizen.Applications.Preference.Contains M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Contains_RETURN_TYPE_BOOL()
- {
- Log.Debug("PREF", "@@## Preference contains test");
-
- string intKey = "Fin";
- string stringKey = "Jake";
- int intVal = 77;
- string stringVal = "advan";
- bool result;
-
- try
- {
- Preference.Set(intKey, intVal);
- Preference.Set(stringKey, stringVal);
-
- result = Preference.Contains(intKey);
- Assert.AreEqual(result, true, "int value is not set properly");
-
- result = Preference.Contains(stringKey);
- Assert.AreEqual(result, true, "string value is not set properly");
-
- Preference.Remove(intKey);
- Preference.Remove(stringKey);
-
- result = Preference.Contains(intKey);
- Assert.AreEqual(result, false, "int value is not removed properly");
-
- result = Preference.Contains(stringKey);
- Assert.AreEqual(result, false, "string value is not removed properly");
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P2")]
- [Description("Test Preference contains test exception case")]
- [Property("SPEC", "Tizen.Applications.Preference.Contains M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Contains_EXCEPTION()
- {
- Log.Debug("PREF", "@@## Preference contains exception test");
-
- Assert.Throws<ArgumentException>(() => Preference.Contains(null));
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference removeall test to check whether all keys are removed properly")]
- [Property("SPEC", "Tizen.Applications.Preference.RemoveAll M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void RemoveAll_CHECK_WITHOUT_EXCEPTION()
- {
- Log.Debug("PREF", "@@## Preference removeall");
-
- string intKey = "Gunter";
- int intVal = 77;
- string stringKey = "Ice";
- string stringVal = "King";
- string doubleKey = "Fiona";
- double doubleVal = 33.3;
- string boolKey = "Marcy";
- bool boolVal = true;
-
- bool result;
-
- try
- {
- Preference.Set(intKey, intVal);
- Preference.Set(stringKey, stringVal);
- Preference.Set(doubleKey, doubleVal);
- Preference.Set(boolKey, boolVal);
- Preference.RemoveAll();
-
- result = Preference.Contains(intKey);
- Assert.AreEqual(result, false, "int value is not removed properly");
-
- result = Preference.Contains(stringKey);
- Assert.AreEqual(result, false, "string value is not removed properly");
-
- result = Preference.Contains(doubleKey);
- Assert.AreEqual(result, false, "double value is not removed properly");
-
- result = Preference.Contains(boolKey);
- Assert.AreEqual(result, false, "bool value is not removed properly");
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference keys test to check get keys list")]
- [Property("SPEC", "Tizen.Applications.Preference.Keys A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Keys_RETURN_TYPE_LIST()
- {
- Log.Debug("PREF", "@@## Preference keys");
-
- string intKey = "Gunter";
- int intVal = 77;
- string stringKey = "Ice";
- string stringVal = "King";
- string doubleKey = "Fiona";
- double doubleVal = 33.3;
- string boolKey = "Marcy";
- bool boolVal = true;
-
- bool result;
-
- try
- {
- Preference.Set(intKey, intVal);
- Preference.Set(stringKey, stringVal);
- Preference.Set(doubleKey, doubleVal);
- Preference.Set(boolKey, boolVal);
-
- foreach (string prefKey in Preference.Keys)
- {
- result = Preference.Contains(prefKey);
- Assert.AreEqual(result, true, "key is not in Preference.Keys : " + prefKey);
- }
-
- Preference.RemoveAll();
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P2")]
- [Description("Test Preference GetEventContext test exception case")]
- [Property("SPEC", "Tizen.Applications.Preference.GetEventContext M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void GetEventContext_EXCEPTION()
- {
- Log.Debug("PREF", "@@## Preference GetEventContext exception case");
-
- Preference.EventContext context;
- Assert.Throws<KeyNotFoundException>(() => Preference.GetEventContext("invalidkey"));
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Preference GetEventContext test")]
- [Property("SPEC", "Tizen.Applications.Preference.GetEventContext M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void GetEventContext_CHECK_WITHOUT_EXCEPTION()
- {
- Log.Debug("PREF", "@@## Preference GetEventContext");
-
- string intKey = "Fiona";
- Preference.EventContext context;
-
- try
- {
- Preference.Set(intKey, 33);
- Preference.GetEventContext(intKey).TryGetTarget(out context);
- Assert.IsNotNull(context, "Failed to get EventContext");
-
- Preference.Remove(intKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System.Threading.Tasks;
-
-namespace Tizen.Applications.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Application.PreferenceChangedEventArgs Tests")]
- public class PreferenceChangedEventArgsTests
- {
- private bool _callbackIsCalled;
- private PreferenceChangedEventArgs _preferChEvent;
-
- [SetUp]
- public void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test PreferenceChangedEventArgs method initialization")]
- [Property("SPEC", "Tizen.Applications.PreferenceChangedEventArgs.PreferenceChangedEventArgs C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void PreferenceChangedEventArgs_INIT()
- {
- var myPreferenceChangedEventArgs = new PreferenceChangedEventArgs();
- Assert.IsInstanceOf<PreferenceChangedEventArgs>(myPreferenceChangedEventArgs);
- Assert.IsNotNull(myPreferenceChangedEventArgs, "PreferenceChangedEventArgs should be not null after init.");
- }
-
- private void PreferenceChangedCallback(object sender, PreferenceChangedEventArgs preEv)
- {
- Log.Debug("PREF", "@@## PreferenceChangedCallback");
- _preferChEvent = preEv;
-
- _callbackIsCalled = true;
- }
- public async Task WaitCallback()
- {
- int count = 0;
- while (true)
- {
- if (count < 3)
- count = count + 1;
- else
- break;
-
- if (_callbackIsCalled == true)
- break;
-
- await Task.Delay(1000);
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test PreferenceChangedEventArgs get Key test")]
- [Property("SPEC", "Tizen.Applications.PreferenceChangedEventArgs.Key A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public async Task Key_PROPERTY_GET()
- {
- Log.Debug("PREF", "@@## PreferenceChangedEventArgs Key_PROPERTY_GET");
-
- string intKey = "Candy";
- _callbackIsCalled = false;
-
- _preferChEvent = new PreferenceChangedEventArgs();
-
- try
- {
- Preference.Set(intKey, 33);
- Preference.EventContext context;
- Preference.GetEventContext(intKey).TryGetTarget(out context);
- if (context != null)
- {
- context.Changed += PreferenceChangedCallback;
- }
-
- Preference.Set(intKey, 77);
-
- await WaitCallback();
-
- Assert.AreEqual(_callbackIsCalled, true, "preference callback is not called");
- Assert.AreEqual(_preferChEvent.Key, intKey, "preference key is not matched");
-
- if (context != null)
- {
- context.Changed -= PreferenceChangedCallback;
- }
-
- Preference.Remove(intKey);
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using System.Threading.Tasks;
-using Tizen.Applications.RPCPort;
-
-namespace Tizen.Applications.Tests
-{
- [TestFixture]
- [Description("Tizen.Application.RPCPort.Exceptions Tests")]
- public class ExceptionTests
- {
- [SetUp]
- public void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test InvalidIOException initialization")]
- [Property("SPEC", "Tizen.Applications.RPCPort.InvalidIOException.InvalidIOException C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void InvalidIOException_INIT()
- {
- /* TEST CODE */
- var e = new InvalidIOException();
-
- Assert.IsNotNull(e, "InvalidIOException shouldn't be null after init");
- Assert.IsInstanceOf<InvalidOperationException>(e);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test InvalidIDException initialization")]
- [Property("SPEC", "Tizen.Applications.RPCPort.InvalidIDException.InvalidIDException C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void InvalidIDException_INIT()
- {
- /* TEST CODE */
- var e = new InvalidIDException();
-
- Assert.IsNotNull(e, "InvalidIDException shouldn't be null after init");
- Assert.IsInstanceOf<InvalidOperationException>(e);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test PermissionDeniedException initialization")]
- [Property("SPEC", "Tizen.Applications.RPCPort.PermissionDeniedException.PermissionDeniedException C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void PermissionDeniedException_INIT()
- {
- /* TEST CODE */
- var e = new PermissionDeniedException();
-
- Assert.IsNotNull(e, "PermissionDeniedException shouldn't be null after init");
- Assert.IsInstanceOf<InvalidOperationException>(e);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test InvalidProtocolException initialization")]
- [Property("SPEC", "Tizen.Applications.RPCPort.InvalidProtocolException.InvalidProtocolException C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void InvalidProtocolException_INIT()
- {
- /* TEST CODE */
- var e = new InvalidProtocolException();
-
- Assert.IsNotNull(e, "InvalidProtocolException shouldn't be null after init");
- Assert.IsInstanceOf<InvalidOperationException>(e);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test NotConnectedSocketException initialization")]
- [Property("SPEC", "Tizen.Applications.RPCPort.NotConnectedSocketException.NotConnectedSocketException C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void NotConnectedSocketException_INIT()
- {
- /* TEST CODE */
- var e = new NotConnectedSocketException();
-
- Assert.IsNotNull(e, "NotConnectedSocketException shouldn't be null after init");
- Assert.IsInstanceOf<InvalidOperationException>(e);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test InvalidCallbackException initialization")]
- [Property("SPEC", "Tizen.Applications.RPCPort.InvalidCallbackException.InvalidCallbackException C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void InvalidCallbackException_INIT()
- {
- /* TEST CODE */
- var e = new InvalidCallbackException();
-
- Assert.IsNotNull(e, "InvalidCallbackException shouldn't be null after init");
- Assert.IsInstanceOf<InvalidOperationException>(e);
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using System.Threading.Tasks;
-using Tizen.Applications.RPCPort;
-
-namespace Tizen.Applications.Tests
-{
- public class Proxy : ProxyBase
- {
- public bool Connected { get; set; }
-
- public bool Received { get; set; }
-
- public void SendTestMessage()
- {
- using (var p = new Parcel())
- {
- p.WriteString("test");
- p.Send(Port);
- }
- }
-
- protected override void OnConnectedEvent(string endPoint, string portName, Port port)
- {
- Connected = true;
- }
-
- protected override void OnDisconnectedEvent(string endPoint, string portName)
- {
- }
-
- protected override void OnReceivedEvent(string endPoint, string portName)
- {
- using (var p = new Parcel(CallbackPort))
- {
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- }
- Received = true;
- }
-
- protected override void OnRejectedEvent(string endPoint, string portName)
- {
- }
-
- public void TestConnect()
- {
- Connect("org.tizen.example.RpcPortStub", "Test");
- }
- }
-
-
- [TestFixture]
- [Description("Tizen.Application.RPCPort.Parcel Tests")]
- public class ParcelTests
- {
- private Proxy _proxy;
-
- [SetUp]
- public void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- _proxy = new Proxy();
- _proxy.TestConnect();
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
- _proxy.Dispose();
- _proxy = null;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Parcel initialization")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Parcel C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void Parcel_INIT()
- {
- /* TEST CODE */
- using (var p = new Parcel())
- {
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Parcel initialization with port")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Parcel C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("COVPARAM", "Port")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task Parcel_INIT_WITH_PARAMETER()
- {
- /* PRECONDITION
- * */
- await Task.Delay(4000);
- Assert.True(_proxy.Connected);
- _proxy.SendTestMessage();
- await Task.Delay(2000);
-
- /* TEST CODE */
- Assert.True(_proxy.Received);
- }
-
- [Test]
- [Category("P2")]
- [Description("Test constructor with null argument")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Parcel C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTN")]
- [Property("COVPARAM", "Port")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void Parcel_NULL_ARGUMENTS()
- {
- /* PRECONDITION */
-
- /* TEST CODE */
- try
- {
- var p = new Parcel(null);
- }
- catch (InvalidIOException)
- {
- Assert.Pass();
- }
-
- Assert.Fail();
- }
-
- [Test]
- [Category("P1")]
- [Description("Send parcel to the other application which has been connected before")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Send M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task Send_CHECK_WITHOUT_EXCEPTION()
- {
- try
- {
- /* PRECONDITION */
- await Task.Delay(2000);
- Assert.True(_proxy.Connected);
-
- /* TEST CODE */
- _proxy.SendTestMessage();
- }
- catch (Exception e)
- {
- Assert.Fail(e.ToString());
- }
- }
-
- [Test]
- [Category("P2")]
- [Description("Send parcel with null Port object")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Send M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void Send_WITH_NULL_ARGUMENTS()
- {
- /* PRECONDITION */
- using (var p = new Parcel())
- {
- /* TEST CODE */
- try
- {
- p.Send(null);
- }
- catch (InvalidIOException)
- {
- Assert.Pass();
- }
- }
-
- Assert.Fail();
- }
-
- [Test]
- [Category("P1")]
- [Description("Read a byte from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadByte M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void ReadByte_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- p.WriteByte(0x33);
-
- /* TEST CODE */
- byte b = p.ReadByte();
- Assert.IsTrue((b == 0x33), "ReadByte failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Read 'short' type value from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadShort M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void ReadShort_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- p.WriteShort(100);
-
- /* TEST CODE */
- short b = p.ReadShort();
- Assert.IsTrue((b == 100), "ReadShort failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Read 'int' type value from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadInt M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void ReadInt_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- p.WriteInt(100);
-
- /* TEST CODE */
- int b = p.ReadInt();
- Assert.IsTrue((b == 100), "ReadInt failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Read 'long' type value from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadLong M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void ReadLong_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- p.WriteLong(100);
-
- /* TEST CODE */
- long b = p.ReadLong();
- Assert.IsTrue((b == 100), "ReadLong failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Read 'float' type value from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadFloat M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void ReadFloat_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- p.WriteFloat(1.0f);
-
- /* TEST CODE */
- float b = p.ReadFloat();
- Assert.IsTrue((b == 1.0f), "ReadFloat failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Read 'double' type value from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadDouble M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void ReadDouble_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- p.WriteDouble(1.0);
-
- /* TEST CODE */
- double b = p.ReadDouble();
- Assert.IsTrue((b == 1.0), "ReadDouble failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Read 'string' type value from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadString M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void ReadString_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- p.WriteString("test");
-
- /* TEST CODE */
- string b = p.ReadString();
- Assert.IsTrue((b == "test"), "ReadString failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Read 'bool' type value from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadBool M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void ReadBool_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- p.WriteBool(true);
-
- /* TEST CODE */
- bool b = p.ReadBool();
- Assert.IsTrue(b, "ReadBool failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Read 'Bundle' type value from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadBundle M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void ReadBundle_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- using (var b = new Bundle())
- {
- b.AddItem("key", "value");
- p.WriteBundle(b);
- }
-
- /* TEST CODE */
- using (Bundle b = p.ReadBundle())
- {
- Assert.IsNotNull(b, "Bundle shouldn't be null");
- string val = b.GetItem<string>("key");
- Assert.IsTrue(val == "value", "ReadBundle failed");
- }
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Read array count from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.ReadArrayCount M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void ReadArrayCount_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- p.WriteArrayCount(10);
-
- /* TEST CODE */
- int b = p.ReadArrayCount();
- Assert.IsTrue(b == 10, "ReadArrayCount failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Read bytes from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Read M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void Read_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- var bts = new byte[10] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- p.Write(bts);
-
- /* TEST CODE */
- var b = p.Read(10);
- for (int i = 0; i < 10; i++)
- {
- Assert.IsTrue(b[i] == i, "Read failed");
- }
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Write a byte to parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteByte M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void WriteByte_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
-
- /* TEST CODE */
- p.WriteByte(0x33);
- byte b = p.ReadByte();
- Assert.IsTrue((b == 0x33), "WriteByte failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Write 'short' type value to parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteShort M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void WriteShort_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
-
- /* TEST CODE */
- p.WriteShort(100);
- short b = p.ReadShort();
- Assert.IsTrue((b == 100), "WriteShort failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Write 'int' type value to parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteInt M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void WriteInt_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
-
- /* TEST CODE */
- p.WriteInt(100);
- int b = p.ReadInt();
- Assert.IsTrue((b == 100), "WriteInt failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Write 'long' type value to parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteLong M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void WriteLong_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
-
- /* TEST CODE */
- p.WriteLong(100);
- long b = p.ReadLong();
- Assert.IsTrue((b == 100), "WriteLong failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Write 'float' type value to parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteFloat M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void WriteFloat_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
-
- /* TEST CODE */
- p.WriteFloat(1.0f);
- float b = p.ReadFloat();
- Assert.IsTrue((b == 1.0f), "WriteFloat failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Write 'double' type value to parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteDouble M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void WriteDouble_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
-
- /* TEST CODE */
- p.WriteDouble(1.0);
- double b = p.ReadDouble();
- Assert.IsTrue((b == 1.0), "WriteDouble failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Wrtie 'string' type value to parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteString M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void WriteString_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
-
- /* TEST CODE */
- p.WriteString("test");
- string b = p.ReadString();
- Assert.IsTrue((b == "test"), "WriteString failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Write 'bool' type value to parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteBool M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void WriteBool_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
-
- /* TEST CODE */
- p.WriteBool(true);
- bool b = p.ReadBool();
- Assert.IsTrue(b, "WriteBool failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Write 'Bundle' type value to parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteBundle M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void WriteBundle_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
-
- using (var b = new Bundle())
- {
- b.AddItem("key", "value");
-
- /* TEST CODE */
- p.WriteBundle(b);
- }
-
- using (Bundle b = p.ReadBundle())
- {
- Assert.IsNotNull(b, "Bundle shouldn't be null");
- string val = b.GetItem<string>("key");
- Assert.IsTrue(val == "value", "WriteBundle failed");
- }
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Write array count from parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.WriteArrayCount M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void WriteArrayCount_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
-
- /* TEST CODE */
- p.WriteArrayCount(10);
- int b = p.ReadArrayCount();
- Assert.IsTrue(b == 10, "WriteArrayCount failed");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Write bytes to parcel")]
- [Property("SPEC", "Tizen.Applications.RPCPort.Parcel.Write M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void Write_RETURN()
- {
- using (var p = new Parcel())
- {
- /* PRECONDITION */
- Assert.IsInstanceOf<RPCPort.Parcel>(p);
- Assert.IsNotNull(p, "Parcel shouldn't be null after init.");
- var bts = new byte[10] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-
- /* TEST CODE */
- p.Write(bts);
- var b = p.Read(10);
- for (int i = 0; i < 10; i++)
- {
- Assert.IsTrue(b[i] == i, "Write failed");
- }
- }
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System.Threading.Tasks;
-using Tizen.Applications.RPCPort;
-
-namespace Tizen.Applications.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Application.RPCPort.ProxyBase Tests")]
- public class ProxyBaseTests
- {
- private Proxy _proxy;
-
- public class Proxy : ProxyBase
- {
- public bool Connected { get; set; }
- public bool Disconnected { get; set; }
- public bool Rejected { get; set; }
-
- public string Result { get; set; }
-
- private Port _port;
-
- public void SendHello()
- {
- using (Parcel p = new Parcel())
- {
- p.WriteString("hello");
- p.Send(_port);
- }
- }
-
- protected override void OnConnectedEvent(string endPoint, string portName, Port port)
- {
- Connected = true;
- _port = port;
- }
-
- protected override void OnDisconnectedEvent(string endPoint, string portName)
- {
- Disconnected = true;
- }
-
- protected override void OnReceivedEvent(string endPoint, string portName)
- {
- using (Parcel p = new Parcel(GetPort(Port.Type.Callback)))
- {
- Result = p.ReadString();
- }
- }
-
- protected override void OnRejectedEvent(string endPoint, string portName)
- {
- Rejected = true;
- }
-
- public void TestConnect()
- {
- Connect("org.tizen.example.RpcPortStub", "Test");
- }
-
- public void ConnectForInvalidIOException()
- {
- Connect("invalid.app", "Test");
- }
- public void ConnectForRejectedEvent()
- {
- Connect("org.tizen.example.RpcPortStub2", "Test");
- }
-
- public void TestGetPort()
- {
- Port p = GetPort(Port.Type.Main);
- Assert.NotNull(p);
-
- p = GetPort(Port.Type.Callback);
- Assert.NotNull(p);
- }
-
- public Port GetPort()
- {
- return Port;
- }
-
- public Port GetCallbackPort()
- {
- return CallbackPort;
- }
- }
-
- [SetUp]
- public void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- _proxy = new Proxy();
- _proxy.TestConnect();
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
- _proxy?.Dispose();
- _proxy = null;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ProxyBase initialization")]
- [Property("SPEC", "Tizen.Applications.RPCPort.ProxyBase.ProxyBase C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void ProxyBase_INIT()
- {
- var p = new Proxy();
-
- Assert.IsInstanceOf<ProxyBase>(p);
- Assert.IsNotNull(p, "Proxy shouldn't be null");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Connect to stub application")]
- [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.Connect M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task Connect_RETURN()
- {
- /* PRECONDITION */
- await Task.Delay(4000);
-
- /* TEST CODE */
- Assert.True(_proxy.Connected);
- }
-
- [Test]
- [Category("P2")]
- [Description("Test : Try to reconnect to app without disposing")]
- [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.Connect M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task Connect_CHECK_INVALID_ID_EXCEPTION()
- {
- /* PRECONDITION */
- await Task.Delay(4000);
- Assert.True(_proxy.Connected);
-
- try
- {
- /* TEST CODE */
- _proxy.TestConnect();
- }
- catch (InvalidIDException)
- {
- Assert.Pass();
- }
-
- Assert.Fail();
- }
-
- [Test]
- [Category("P2")]
- [Description("Test : Connect to invalid stub application")]
- [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.Connect M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void Connect_CHECK_INVALID_IO_EXCEPTION()
- {
- /* PRECONDITION */
- _proxy?.Dispose();
- _proxy = new Proxy();
-
- try
- {
- /* TEST CODE */
- _proxy.ConnectForInvalidIOException();
- }
- catch (InvalidIOException)
- {
- Assert.Pass();
- }
-
- Assert.Fail();
- }
-
- [Test]
- [Category("P2")]
- [Description("Test : Connect to stub application with invalid permission")]
- [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.Connect M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task Connect_CHECK_PERMISSION_DENIED_EXCEPTION()
- {
- /* PRECONDITION */
- _proxy?.Dispose();
- _proxy = null;
- AppControlReplyResult ret = AppControlReplyResult.Failed;
-
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy2"
- };
-
- AppControl.SendLaunchRequest(c, (AppControl launchRequest, AppControl replyRequest, AppControlReplyResult result) =>
- {
- ret = result;
- });
- await Task.Delay(4000);
-
- /* TEST CODE */
- Assert.True(ret == AppControlReplyResult.Succeeded);
-
- /* POSTCONDITION */
- c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy2"
- };
-
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(2000);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : OnConnected events")]
- [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.OnConnectedEvent E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task OnConnectedEvent_CHECK_CB()
- {
- /* PRECONDITION */
- await Task.Delay(4000);
-
- /* TEST CODE */
- Assert.True(_proxy.Connected);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : OnDisconnected events")]
- [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.OnDisconnectedEvent E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task OnDisconnectedEvent_CHECK_CB()
- {
- /* PRECONDITION */
- await Task.Delay(4000);
- Assert.True(_proxy.Connected);
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortStub"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(4000);
-
- /* TEST CODE */
- Assert.True(_proxy.Disconnected);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : OnRejected events")]
- [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.OnRejectedEvent E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task OnRejectedEvent_CHECK_CB()
- {
- /* PRECONDITION */
- _proxy?.Dispose();
- _proxy = new Proxy();
- _proxy.ConnectForRejectedEvent();
- await Task.Delay(4000);
-
- /* TEST CODE */
- Assert.True(_proxy.Rejected);
-
- /* POSTCONDITION */
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortStub2"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(2000);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : OnReceived events")]
- [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.OnReceivedEvent E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task OnReceivedEvent_CHECK_CB()
- {
- /* PRECONDITION */
- await Task.Delay(4000);
- Assert.True(_proxy.Connected);
- _proxy.SendHello();
- await Task.Delay(4000);
-
- /* TEST CODE */
- Assert.NotNull(_proxy.Result);
- Assert.True(_proxy.Result.Equals("hello"));
- }
-
- [Test]
- [Category("P2")]
- [Description("Test : GetPort from disconnected object")]
- [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.GetPort M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task GetPort_CHECK_EXCEPTION()
- {
- /* PRECONDITION */
- await Task.Delay(4000);
- Assert.True(_proxy.Connected);
- _proxy?.Dispose();
-
- /* TEST CODE */
- try
- {
- _proxy.TestGetPort();
- }
- catch (InvalidIOException)
- {
- Assert.Pass();
- }
- finally
- {
- _proxy = null;
- }
-
- Assert.Fail();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : GetPort from proxy object")]
- [Property("SPEC", " Tizen.Applications.RPCPort.ProxyBase.GetPort M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task GetPort_RETURN()
- {
- /* PRECONDITION */
- await Task.Delay(4000);
- Assert.True(_proxy.Connected);
-
- /* TEST CODE */
- _proxy.TestGetPort();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Port Property")]
- [Property("SPEC", "Tizen.Applications.RPCPort.ProxyBase.Port A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task Port_PROPERTY_GET()
- {
- /* PRECONDITION */
- await Task.Delay(4000);
- Assert.True(_proxy.Connected);
-
- /* TEST CODE */
- Assert.NotNull(_proxy.GetPort());
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : CallbackPort Property")]
- [Property("SPEC", "Tizen.Applications.RPCPort.ProxyBase.CallbackPort A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task CallbackPort_PROPERTY_GET()
- {
- /* PRECONDITION */
- await Task.Delay(4000);
- Assert.True(_proxy.Connected);
-
- /* TEST CODE */
- Assert.NotNull(_proxy.GetCallbackPort());
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Applications.RPCPort;
-
-namespace Tizen.Applications.Tests
-{
- [TestFixture]
- [Description("Tizen.Application.RPCPort.StubBase Tests")]
- public class StubBaseTests
- {
- private Stub _stub;
- private static bool _disposed;
-
- public class Stub : StubBase
- {
- public bool Connected { get; set; }
- public bool Disconnected { get; set; }
- public bool Received { get; set; }
- public string Instance { get; set; }
-
- public Stub(string portName) : base(portName)
- {
- }
-
- protected override void OnConnectedEvent(string sender, string instance)
- {
- Connected = true;
- Instance = instance;
- }
-
- protected override void OnDisconnectedEvent(string sender, string instance)
- {
- Disconnected = true;
- }
-
- protected override bool OnReceivedEvent(string sender, string instance, Port port)
- {
- Received = true;
- using (var p = new Parcel(port))
- {
-
- }
- return true;
- }
-
- protected override void OnTerminatedEvent()
- {
- _disposed = true;
- }
-
- public void TestListen()
- {
- Listen();
- }
-
- public void TestGetPort(string inst)
- {
- Port p = GetPort(Port.Type.Main, inst);
- Assert.NotNull(p);
-
- p = GetPort(Port.Type.Callback, inst);
- Assert.NotNull(p);
- }
-
- public void TestAddPrivilege()
- {
- AddPrivilege("test.privilege");
- }
-
- public void TestAddPrivilegeWithNull()
- {
- AddPrivilege(null);
- }
-
- public void TestSetTrusted(bool trusted)
- {
- SetTrusted(trusted);
- }
- }
-
- [SetUp]
- public void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- _stub = new Stub("Test");
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
- _stub?.Dispose();
- _stub = null;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test StubBase initialization")]
- [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.StubBase C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void StubBase_INIT()
- {
- Assert.IsInstanceOf<StubBase>(_stub);
- Assert.IsNotNull(_stub, "Stub shouldn't be null");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Listen to proxy application")]
- [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.Listen M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task Listen_CHECK_RETURN()
- {
- /* PRECONDITION */
- _stub.TestListen();
- var ctrl = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
-
- AppControl.SendLaunchRequest(ctrl);
-
- await Task.Delay(4000);
-
- /* TEST CODE */
- Assert.True(_stub.Connected);
-
- /* POSTCONDITION */
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(2000);
- }
-
- [Test]
- [Category("P2")]
- [Description("Test : Listen to proxy application after being disposed")]
- [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.Listen M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void Listen_CHECK_WITH_EXCEPTION()
- {
- /* PRECONDITION */
- _stub?.Dispose();
-
- try
- {
- /* TEST CODE */
- _stub.TestListen();
- }
- catch (InvalidIOException)
- {
- Assert.Pass();
- }
- finally
- {
- _stub = null;
- }
-
- Assert.Fail();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : OnConnected events")]
- [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.OnConnectedEvent E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task OnConnectedEvent_CHECK_CB()
- {
- /* PRECONDITION */
- _stub.TestListen();
- var ctrl = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
-
- AppControl.SendLaunchRequest(ctrl);
- await Task.Delay(4000);
-
- /* TEST CODE */
- Assert.True(_stub.Connected);
-
- /* POSTCONDITION */
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(2000);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : OnDisconnected events")]
- [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.OnDisconnectedEvent E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task OnDisconnectedEvent_CHECK_CB()
- {
- /* PRECONDITION */
- _stub.TestListen();
- var ctrl = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
-
- AppControl.SendLaunchRequest(ctrl);
- await Task.Delay(4000);
- Assert.True(_stub.Connected);
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(3000);
-
- /* TEST CODE */
- Assert.True(_stub.Disconnected);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : OnReceived events")]
- [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.OnReceivedEvent E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task OnReceivedEvent_CHECK_CB()
- {
- /* PRECONDITION */
- _stub.TestListen();
- var ctrl = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
- ctrl.ExtraData.Add("send", "hello");
-
- AppControl.SendLaunchRequest(ctrl);
- await Task.Delay(4000);
- Assert.True(_stub.Connected);
-
- /* TEST CODE */
- Assert.True(_stub.Received);
-
- /* POSTCONDITION */
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(3000);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : OnTerminated events")]
- [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.OnTerminatedEvent E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task OnTerminatedEvent_CHECK_CB()
- {
- /* PRECONDITION */
- _stub.TestListen();
- var ctrl = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
-
- AppControl.SendLaunchRequest(ctrl);
- await Task.Delay(4000);
- Assert.True(_stub.Connected);
- _disposed = false;
-
- /* TEST CODE */
- _stub.Dispose();
- Assert.True(_disposed);
-
- /* POSTCONDITION */
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(3000);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : GetPort from stub object")]
- [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.GetPort M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task GetPort_RETURN()
- {
- /* PRECONDITION */
- _stub.TestListen();
- var ctrl = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
-
- AppControl.SendLaunchRequest(ctrl);
-
- await Task.Delay(4000);
- Assert.True(_stub.Connected);
- Assert.NotNull(_stub.Instance);
-
- /* TEST CODE */
- _stub.TestGetPort(_stub.Instance);
-
- /* POSTCONDITION */
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(2000);
- }
-
- [Test]
- [Category("P2")]
- [Description("Test : GetPort from wrong instance")]
- [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.GetPort M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task GetPort_CHECK_INVALID_IO_EXCEPTION()
- {
- /* PRECONDITION */
- _stub.TestListen();
- var ctrl = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
-
- AppControl.SendLaunchRequest(ctrl);
- await Task.Delay(4000);
-
- Assert.True(_stub.Connected);
- Assert.NotNull(_stub.Instance);
-
- try
- {
- /* TEST CODE */
- _stub.TestGetPort("wrong_inst");
-
- }
- catch (InvalidIOException)
- {
- Assert.Pass();
- }
- finally
- {
- /* POSTCONDITION */
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(2000);
- }
-
- Assert.Fail();
- }
-
- [Test]
- [Category("P2")]
- [Description("Test : GetPort from wrong stub object")]
- [Property("SPEC", " Tizen.Applications.RPCPort.StubBase.GetPort M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void GetPort_CHECK_INVALID_ID_EXCEPTION()
- {
- /* PRECONDITION */
- _stub.TestListen();
- _stub.Dispose();
-
- try
- {
- /* TEST CODE */
- _stub.TestGetPort("wrong_instance");
- }
- catch (InvalidIDException)
- {
- Assert.Pass();
- }
- finally
- {
- _stub = null;
- }
-
- Assert.Fail();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Add privilege to stub object")]
- [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.AddPrivilege M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task AddPrivilege_RETURN()
- {
- /* PRECONDITION */
-
- /* TEST CODE */
- _stub.TestAddPrivilege();
- _stub.TestListen();
- var ctrl = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
-
- AppControl.SendLaunchRequest(ctrl);
-
- await Task.Delay(4000);
- Assert.False(_stub.Connected);
-
- /* POSTCONDITION */
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(2000);
- }
-
- [Test]
- [Category("P2")]
- [Description("Test : Add privilege with null argument")]
- [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.AddPrivilege M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void AddPrivilege_CHECK_WITH_EXCEPTION()
- {
- /* PRECONDITION */
-
- /* TEST CODE */
- try
- {
- _stub.TestAddPrivilegeWithNull();
- }
- catch (ArgumentNullException)
- {
- Assert.Pass();
- }
- Assert.Fail();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Set trusted flag as true")]
- [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.SetTrusted M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task SetTrusted_RETURN1()
- {
- /* PRECONDITION */
-
- /* TEST CODE */
- _stub.TestSetTrusted(true);
- _stub.TestListen();
- var ctrl = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
-
- AppControl.SendLaunchRequest(ctrl);
- await Task.Delay(4000);
- Assert.False(_stub.Connected);
-
- /* POSTCONDITION */
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(2000);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Set trusted flag as false")]
- [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.SetTrusted M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public async Task SetTrusted_RETURN2()
- {
- /* PRECONDITION */
-
- /* TEST CODE */
- _stub.TestSetTrusted(false);
- _stub.TestListen();
- var ctrl = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
-
- AppControl.SendLaunchRequest(ctrl);
- await Task.Delay(4000);
- Assert.True(_stub.Connected);
-
- /* POSTCONDITION */
- var c = new AppControl()
- {
- ApplicationId = "org.tizen.example.RpcPortProxy"
- };
- c.ExtraData.Add("Test", "finish");
- AppControl.SendLaunchRequest(c);
- await Task.Delay(2000);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : PortName Property")]
- [Property("SPEC", "Tizen.Applications.RPCPort.StubBase.PortName A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Junghoon Park, jh9216.park@samsung.com")]
- public void PortName_PROPERTY_GET()
- {
- Assert.NotNull(_stub.PortName);
- Assert.True(_stub.PortName.Equals("Test"));
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.Applications.Messages;
-using System.Threading.Tasks;
-using System.Collections.Generic;
-
-namespace Tizen.Applications.Tests
-{
-
- [TestFixture]
- [Description("RemotePort information Test")]
- class RemotePortTests
- {
- public RemotePort _remotePort;
- private MessagePort _messagePort;
- public const string remoteAppId = "org.tizen.MsgPortApp.Tizen";
- public const string myRemotePort = "TestRemotePort";
- private Task<IEnumerable<ApplicationRunningContext>> _runningApps;
- private IEnumerable<ApplicationRunningContext> _list;
- private bool _flag;
-
- [SetUp]
- public void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
-
- _flag = false;
- if (_remotePort != null)
- {
- _remotePort.Dispose();
- }
- if (_messagePort != null)
- {
- _messagePort.Dispose();
- }
- if (_runningApps != null)
- {
- _runningApps = null;
- }
- }
- private void RemotePortStateChangedCallback(object sender, RemotePortStateChangedEventArgs e)
- {
- _flag = true;
- Log.Debug("REMOTEPORT", "@@# RemotePortStateChangedCallback : " + _flag);
- }
-
- [Test]
- [Category("P1")]
- [Description("RemotePort() constructor")]
- [Property("SPEC", "Tizen.Applications.Messages.RemotePort.RemotePort C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void RemotePort_INIT()
- {
- Log.Debug("REMOTEPORT", "@@# RemotePort_INIT");
- /* TEST CODE */
- _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
- Assert.IsNotNull(_remotePort, "_remotePort object should be not null after initializing");
- Assert.IsInstanceOf<RemotePort>(_remotePort, "_remotePort object must be RemotePort instance");
- }
-
- [Test]
- [Category("P1")]
- [Description("Gets RemotePort AppId")]
- [Property("SPEC", "Tizen.Applications.Messages.RemotePort.AppId A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void AppId_PROPERTY_GET()
- {
- Log.Debug("REMOTEPORT", "@@# AppId_PROPERTY_GET");
- /* TEST CODE */
- _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
-
- Assert.IsInstanceOf<string>(_remotePort.AppId);
- Assert.AreEqual(remoteAppId, _remotePort.AppId, "Value of _remotePort.AppId must be matched with remoteAppId");
- }
-
- [Test]
- [Category("P1")]
- [Description("RemotePort PortName.")]
- [Property("SPEC", "Tizen.Applications.Messages.RemotePort.PortName A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void PortName_PROPERTY_GET()
- {
- Log.Debug("REMOTEPORT", "@@# PortName_PROPERTY_GET");
- /* TEST CODE */
- _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
-
- Assert.IsInstanceOf<string>(_remotePort.PortName);
- Assert.AreEqual(myRemotePort, _remotePort.PortName, "Value of _remotePort.PortName must be matched with myRemotePort");
- }
-
- [Test]
- [Category("P1")]
- [Description("RemotePort PortName.")]
- [Property("SPEC", "Tizen.Applications.Messages.RemotePort.Trusted A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void Trusted_PROPERTY_GET()
- {
- Log.Debug("REMOTEPORT", "@@# Trusted_PROPERTY_GET");
- /* TEST CODE */
- _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
-
- Assert.IsInstanceOf<bool>(_remotePort.Trusted);
- Assert.IsFalse(_remotePort.Trusted, "Value of _remotePort.PortName must be false");
- }
-
- [Test]
- [Category("P1")]
- [Description("RemotePort PortName.")]
- [Property("SPEC", "Tizen.Applications.Messages.RemotePort.IsRunning M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public async Task IsRunning_CHECK_VALUE()
- {
- Log.Debug("REMOTEPORT", "@@# IsRunning_CHECK_VALUE");
- /* TEST CODE */
- bool appIsRunning = false;
- bool portIsRunning = false;
-
- _runningApps = ApplicationManager.GetRunningApplicationsAsync();
- _list = await _runningApps;
- foreach (var app in _list)
- {
- if (app.ApplicationId == remoteAppId)
- {
- appIsRunning = true;
- break;
- }
-
- }
- Assert.IsTrue(appIsRunning, remoteAppId + " should be running");
-
- _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
-
- portIsRunning = _remotePort.IsRunning();
-
- Assert.IsTrue(portIsRunning, "_remotePort must be running");
- }
-
- [Test]
- [Category("P1")]
- [Description("RemotePort RemotePortStateChanged.")]
- [Property("SPEC", "Tizen.Applications.Messages.RemotePort.RemotePortStateChanged E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public async Task RemotePortStateChanged_EVENT()
- {
- Log.Debug("REMOTEPORT", "@@# RemotePortStateChanged_EVENT");
- bool isRunning = false;
- _flag = false;
- string controlRemotePort = "ControlRemotePort";
-
- _runningApps = ApplicationManager.GetRunningApplicationsAsync();
- _list = await _runningApps;
- foreach (var app in _list)
- {
- if (app.ApplicationId == remoteAppId)
- {
- isRunning = true;
- break;
- }
-
- }
- Assert.IsTrue(isRunning, remoteAppId + " should be running");
-
- _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
- _remotePort.RemotePortStateChanged += RemotePortStateChangedCallback;
-
- _messagePort = new MessagePort(controlRemotePort, false);
- _messagePort.Listen();
-
- var msg = new Bundle();
- Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
-
- msg.AddItem("message", "ChangeState");
- _messagePort.Send(msg, remoteAppId, controlRemotePort);
- await Task.Delay(5000);
-
- Assert.IsTrue(_flag, "RemotePortStateChanged callback is not called");
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.Applications.Messages;
-using System.Threading.Tasks;
-using System.Collections.Generic;
-
-namespace Tizen.Applications.Tests
-{
-
- [TestFixture]
- [Description("RemotePortStateChangedEventArgs Test")]
- class RemotePortStateChangedEventArgsTests
- {
- public RemotePort _remotePort;
- private MessagePort _messagePort;
- public const string remoteAppId = "org.tizen.MsgPortApp.Tizen";
- public const string myRemotePort = "TestRemotePort";
- private Task<IEnumerable<ApplicationRunningContext>> _runningApps;
- private IEnumerable<ApplicationRunningContext> _list;
- private RemotePortStateChangedEventArgs _changeState;
- private bool _flag;
- private State _state;
-
- [SetUp]
- public void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
-
- _flag = false;
- if (_remotePort != null)
- {
- _remotePort.Dispose();
- }
- if (_messagePort != null)
- {
- _messagePort.Dispose();
- }
- if (_runningApps != null)
- {
- _runningApps = null;
- }
- if (_changeState != null)
- {
- _changeState = null;
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("RemotePortStateChangedEventArgs() constructor")]
- [Property("SPEC", "Tizen.Applications.Messages.RemotePortStateChangedEventArgs.RemotePortStateChangedEventArgs C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public void RemotePortStateChangedEventArgs_INIT()
- {
- Log.Debug("REMOTEPORT", "@@# RemotePortStateChangedEventArgs_INIT");
- /* TEST CODE */
- _changeState = new RemotePortStateChangedEventArgs();
- Assert.IsNotNull(_changeState, "_changeState object should be not null after initializing");
- Assert.IsInstanceOf<RemotePortStateChangedEventArgs>(_changeState, "_changeState object must be RemotePortStateChangedEventArgs instance");
- }
-
- private void RemotePortStateChangedCallback(object sender, RemotePortStateChangedEventArgs e)
- {
- _flag = true;
- _state = e.Status;
- Log.Debug("REMOTEPORT", "@@# RemotePortStateChangedCallback : " + _flag);
- }
-
- [Test]
- [Category("P1")]
- [Description("RemotePortStateChangedEventArgs Status check.")]
- [Property("SPEC", "Tizen.Applications.Messages.RemotePortStateChangedEventArgs.Status A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Sukhyung Kang, shine.kang@samsung.com")]
- public async Task Status_PROPERTY_GET()
- {
- Log.Debug("REMOTEPORT", "@@# Status_PROPERTY_GET");
- bool isRunning = false;
- _flag = false;
- string controlRemotePort = "ControlRemotePort";
-
- _runningApps = ApplicationManager.GetRunningApplicationsAsync();
- _list = await _runningApps;
- foreach (var app in _list)
- {
- if (app.ApplicationId == remoteAppId)
- {
- isRunning = true;
- break;
- }
-
- }
- Assert.IsTrue(isRunning, remoteAppId + " should be running");
-
- _remotePort = new RemotePort(remoteAppId, myRemotePort, false);
- _remotePort.RemotePortStateChanged += RemotePortStateChangedCallback;
-
- _messagePort = new MessagePort(controlRemotePort, false);
- _messagePort.Listen();
-
- var msg = new Bundle();
- Assert.IsNotNull(msg, "Object \"msg\" should not be null after initializing");
-
- msg.AddItem("message", "ChangeState");
- _messagePort.Send(msg, remoteAppId, controlRemotePort);
- await Task.Delay(5000);
-
- Assert.IsTrue(_flag, "RemotePortStateChanged callback is not called");
- Assert.IsNotNull(_state, "RemotePortStateChangedEventArgs must not be null");
-
- Log.Debug("REMOTEPORT", "@@# Status_PROPERTY_GET state : " + _state.ToString());
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-
-namespace Tizen.Applications.Tests
-{
-
- [TestFixture]
- [Description("Test : Remote Values ")]
- class RemoteValuesTests
- {
- public Tizen.Applications.Messages.RemoteValues _remoteValue;
- public const string MyRemoteAppId = "org.tizen.myRemoteAppId";
- public const string MyRemotePortName = "myRemotePortName";
-
- [SetUp]
- public void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
-
- _remoteValue = null;
- }
-
- [Test]
- [Category("P1")]
- [Description("RemoteValues() constructor.")]
- [Property("SPEC", "Tizen.Applications.Messages.RemoteValues.RemoteValues C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Dao Trong Hieu, tronghieu.d@samsung.com")]
- public void RemoteValues_INIT()
- {
- /* TEST CODE */
- _remoteValue = new Tizen.Applications.Messages.RemoteValues();
- Assert.IsNotNull(_remoteValue, "RemoteValues object should be not null after initializing");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : RemoteValues Properties.")]
- [Property("SPEC", "Tizen.Applications.Messages.RemoteValues.AppId A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- public void AppId_PROPERTY_SET_GET()
- {
- /* TEST CODE */
- _remoteValue = new Tizen.Applications.Messages.RemoteValues();
- Assert.IsNotNull(_remoteValue, "RemoteValues object should be not null after initializing");
-
- _remoteValue.AppId = MyRemoteAppId;
- Assert.IsInstanceOf<string>(_remoteValue.AppId);
- Assert.AreEqual(MyRemoteAppId, _remoteValue.AppId, "Propety \"AppId\": the set value and the get value are not equal");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : RemoteValues Properties.")]
- [Property("SPEC", "Tizen.Applications.Messages.RemoteValues.PortName A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- public void PortName_PROPERTY_SET_GET()
- {
- /* TEST CODE */
- _remoteValue = new Tizen.Applications.Messages.RemoteValues();
- Assert.IsNotNull(_remoteValue, "RemoteValues object should be not null after initializing");
-
- _remoteValue.PortName = MyRemotePortName;
- Assert.IsInstanceOf<string>(_remoteValue.PortName);
- Assert.AreEqual(MyRemotePortName, _remoteValue.PortName, "Property \"PortName\": the set value and the get value are not equal");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : RemoteValues Properties.")]
- [Property("SPEC", "Tizen.Applications.Messages.RemoteValues.Trusted A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Nguyen Tien Dung, dung.nt5@samsung.com")]
- public void Trusted_PROPERTY_SET_GET()
- {
- /* TEST CODE */
- _remoteValue = new Tizen.Applications.Messages.RemoteValues();
- Assert.IsNotNull(_remoteValue, "RemoteValues object should be not null after initializing");
-
- _remoteValue.Trusted = false;
- Assert.IsInstanceOf<bool>(_remoteValue.Trusted);
- Assert.IsFalse(_remoteValue.Trusted, "Property \"Trusted\": the set value and the get value are not equal");
- }
- }
-}
+++ /dev/null
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-
-namespace Tizen.Applications.Tests
-{
-
- [TestFixture]
- [Description("ServiceApplication init test")]
- public class ServiceApplicationTests
- {
- [SetUp]
- public void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
- }
-
- [TearDown]
- public void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("ServiceApplication() constructor.")]
- [Property("SPEC", "Tizen.Applications.ServiceApplication.ServiceApplication C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Nguyen Duc Han, duchan.ng.d@samsung.com")]
- public void ServiceApplication_INIT()
- {
- /* TEST CODE */
- Application App = new ServiceApplication();
- Assert.IsNotNull(App, "Application should be not null after init");
- }
- }
-}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using NUnitLite.TUnit;
+using AutoTemplate;
+
+namespace XamarinForTizen.Tizen
+{
+
+ class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
+ {
+ private static App _app;
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+
+ Console.WriteLine("TCT : OnCreate()");
+ _app = new App();
+ LoadApplication(_app);
+
+ TRunner t = new TRunner();
+ t.LoadTestsuite();
+ t.Execute();
+ }
+
+ public static App getApp()
+ {
+ return _app;
+ }
+ static void Main(string[] args)
+ {
+ Console.WriteLine("TCT : Main()");
+ var app = new Program();
+ global::Xamarin.Forms.Forms.Init(app);
+ app.Run(args);
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <!-- Property Group for .NET Core Project -->
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>tizen80</TargetFramework>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <!-- Property Group for Tizen Project -->
+ <PropertyGroup>
+ <TizenCreateTpkOnBuild>true</TizenCreateTpkOnBuild>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Folder Include="lib\" />
+ </ItemGroup>
+
+ <Import Project="..\Common\dependencies.props" />
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)">
+ <ExcludeAssets>Runtime</ExcludeAssets>
+ </PackageReference>
+ <PackageReference Include="Tizen.NET.Sdk" Version="$(TizenNETSdkVersion)" />
+ </ItemGroup>
+
+ <!-- Include Nuget Package for Tizen Project building -->
+ <ItemGroup>
+ <ProjectReference Include="..\Template\AutoTemplate\AutoTemplate.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio Version 16\r
+VisualStudioVersion = 16.0.30104.148\r
+MinimumVisualStudioVersion = 15.0.26124.0\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.UI.Tests", "Tizen.Applications.UI.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Debug|x64 = Debug|x64\r
+ Debug|x86 = Debug|x86\r
+ Release|Any CPU = Release|Any CPU\r
+ Release|x64 = Release|x64\r
+ Release|x86 = Release|x86\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+using NUnit.Framework;\r
+using NUnit.Framework.TUnit;\r
+using System.Collections.Generic;\r
+using System.Threading.Tasks;\r
+using System;\r
+\r
+namespace Tizen.Applications.Tests\r
+{\r
+\r
+ [TestFixture]\r
+ [Description("Tizen.Applications.AppControl Test launch other application")]\r
+ public class AppControlTests\r
+ {\r
+ private Task<IEnumerable<ApplicationRunningContext>> _runningApps;\r
+ private IEnumerable<ApplicationRunningContext> _list;\r
+ private const string MyUIAppId = "org.tizen.example.UIApp.Tizen";\r
+ private bool _flag;\r
+\r
+ [SetUp]\r
+ public void Init()\r
+ {\r
+ _flag = false;\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");\r
+ }\r
+\r
+ [TearDown]\r
+ public void Destroy()\r
+ {\r
+ _flag = false;\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");\r
+ }\r
+\r
+ public async Task waitFlag()\r
+ {\r
+ int count = 0;\r
+ while (true)\r
+ {\r
+ await Task.Delay(500);\r
+ count++;\r
+ if (_flag)\r
+ break;\r
+ if (count == 4)\r
+ break;\r
+ }\r
+ }\r
+\r
+ void AppControlReplyReceivedCallback(Tizen.Applications.AppControl launchRequest, Tizen.Applications.AppControl replyRequest, AppControlReplyResult result)\r
+ {\r
+ if (result >= 0)\r
+ _flag = true;\r
+ }\r
+\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Test : Send Terminate Request - UI app should be terminated")]\r
+ [Property("SPEC", "Tizen.Applications.AppControl.SendTerminateRequest M")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "MR")]\r
+ [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")]\r
+ public async Task SendTerminateRequest_TO_A_UI_APP()\r
+ {\r
+ /* PRECONDITION\r
+ * Install org.tizen.example.UIApp.Tizen.tpk <in folder res/>\r
+ * Privilege: http://tizen.org/privilege/appmanager.launch\r
+ * */\r
+\r
+ /* TEST CODE */\r
+ AppControl MyAppControl = new Tizen.Applications.AppControl(true);\r
+ Assert.IsNotNull(MyAppControl, "Object should not be null after initializing");\r
+\r
+ MyAppControl.Operation = AppControlOperations.Default;\r
+ MyAppControl.ApplicationId = MyUIAppId;\r
+ MyAppControl.LaunchMode = AppControlLaunchMode.Group;\r
+\r
+ Tizen.Applications.AppControl.SendLaunchRequest(MyAppControl, AppControlReplyReceivedCallback);\r
+ await waitFlag();\r
+ Assert.IsTrue(_flag, MyUIAppId + "should be running after launching request has sent");\r
+\r
+ bool IsRunning = false;\r
+ Tizen.Applications.AppControl.SendTerminateRequest(MyAppControl);\r
+ _runningApps = ApplicationManager.GetRunningApplicationsAsync();\r
+\r
+ _list = await _runningApps;\r
+ foreach (var app in _list)\r
+ {\r
+ if (app.ApplicationId == MyUIAppId)\r
+ IsRunning = true;\r
+ }\r
+ Assert.IsTrue(!IsRunning, MyUIAppId + "should not be running after terminating request has sent");\r
+ }\r
+ }\r
+}\r
--- /dev/null
+using NUnit.Framework;\r
+using NUnit.Framework.TUnit;\r
+\r
+namespace Tizen.Applications.Tests\r
+{\r
+ [TestFixture]\r
+ [Description("TSCoreUIApplication init test")]\r
+ public class CoreUIApplicationTests\r
+ {\r
+ [SetUp]\r
+ public void Init()\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");\r
+ }\r
+\r
+ [TearDown]\r
+ public void Destroy()\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("UIApplication() constructor.")]\r
+ [Property("SPEC", "Tizen.Applications.CoreUIApplication.CoreUIApplication C")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "CONSTR")]\r
+ [Property("AUTHOR", "Nguyen Duc Han, duchan.ng.d@samsung.com")]\r
+ public void CoreUIApplication_INIT()\r
+ {\r
+ /* TEST CODE */\r
+ Application app = new CoreUIApplication();\r
+ Assert.IsNotNull(app, "Application should be not null after init");\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Test : Check whether CurrentDeviceOrientation returns expected value or not")]\r
+ [Property("SPEC", "Tizen.Applications.CoreUIApplication.CurrentDeviceOrientation A")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "PRO")]\r
+ [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")]\r
+ public void CurrentDeviceOrientation_PROPERTY_GET()\r
+ {\r
+ CoreUIApplication app = new CoreUIApplication();\r
+ var deviceOrientation = app.CurrentDeviceOrientation;\r
+ Assert.IsInstanceOf<DeviceOrientation>(deviceOrientation);\r
+ Assert.IsTrue((deviceOrientation == DeviceOrientation.Orientation_0) ||\r
+ (deviceOrientation == DeviceOrientation.Orientation_90) ||\r
+ (deviceOrientation == DeviceOrientation.Orientation_180) ||\r
+ (deviceOrientation == DeviceOrientation.Orientation_270),\r
+ "Property \"CurrentDeviceOrientation\": should be Orientation_0 or Orientation_90 or Orientation_180 or Orientation_270");\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="8" package="Tizen.Applications.UI.Tests" version="1.0.0">
+ <profile name="common" />
+ <ui-application appid="Tizen.Applications.UI.Tests"
+ exec="Tizen.Applications.UI.Tests.dll"
+ type="dotnet"
+ multiple="false"
+ taskmanage="true"
+ launch_mode="single">
+ <icon>Tizen.Applications.UI.Tests.png</icon>
+ <label>Tizen.Applications.UI.Tests</label>
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ </privileges>
+</manifest>