From: Junghoon Park Date: Thu, 19 Jul 2018 06:12:20 +0000 (+0900) Subject: [Tizen.Applications.RPCPort][TCSACR-159] Add TCs for RPCPort X-Git-Tag: tct5.0_m2~105^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F97%2F184597%2F34;p=test%2Ftct%2Fcsharp%2Fapi.git [Tizen.Applications.RPCPort][TCSACR-159] Add TCs for RPCPort Change-Id: I039d8a22723a31ea0f082f609e855f0233fdd205 Signed-off-by: Junghoon Park --- diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy.sln b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy.sln new file mode 100755 index 0000000..c937842 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2035 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortProxy", "RpcPortProxy\RpcPortProxy.csproj", "{B4C8261C-D74F-43D1-A075-B9E242851D31}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B4C8261C-D74F-43D1-A075-B9E242851D31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4C8261C-D74F-43D1-A075-B9E242851D31}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4C8261C-D74F-43D1-A075-B9E242851D31}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4C8261C-D74F-43D1-A075-B9E242851D31}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3E5007AD-1998-4272-8437-26CDC3729698} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/RpcPortProxy.csproj b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/RpcPortProxy.csproj new file mode 100755 index 0000000..bfbbbf8 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/RpcPortProxy.csproj @@ -0,0 +1,44 @@ + + + + + + $(MSBuildExtensionsPath)\Tizen\VisualStudio\ + + + + + + + + Exe + netcoreapp2.0 + + + + portable + + + None + + + + + + + + + + + + + + + + + + + + + + diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/RpcPortProxy_App.cs b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/RpcPortProxy_App.cs new file mode 100755 index 0000000..552e0ca --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/RpcPortProxy_App.cs @@ -0,0 +1,125 @@ +using System.Threading; +using Tizen; +using Tizen.Applications; +using Tizen.Applications.RPCPort; + +namespace RpcPortProxy +{ + class App : ServiceApplication + { + private Proxy _proxy; + + class Proxy : ProxyBase + { + private Timer _timer; + private bool _send; + + public Proxy(bool send) + { + _timer = new Timer(new TimerCallback(OnTimeout)); + _timer.Change(100, 0); + _send = send; + } + + private void OnTimeout(object state) + { + Connect("Tizen.Applications.Tests", "Test"); + _timer.Dispose(); + _timer = null; + } + + protected override void OnConnectedEvent(string endPoint, string portName, Port port) + { + Log.Debug("RPCPortProxy", "OnConnectedEvent: endPoint:" + endPoint + " port:" + portName); + if (_send) + { + using (var p = new Parcel()) + { + p.WriteString("hello"); + p.Send(port); + } + } + } + + protected override void OnDisconnectedEvent(string endPoint, string portName) + { + Log.Debug("RPCPortProxy", "OnDisconnectedEvent: endPoint:" + endPoint + " port:" + portName); + } + + protected override void OnReceivedEvent(string endPoint, string portName) + { + Log.Debug("RPCPortProxy", "OnReceivedEvent: endPoint:" + endPoint + " port:" + portName); + } + + protected override void OnRejectedEvent(string endPoint, string portName) + { + Log.Debug("RPCPortProxy", "OnRejectedEvent: endPoint:" + endPoint + " port:" + portName); + } + } + + protected override void OnCreate() + { + base.OnCreate(); + } + + protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + { + base.OnAppControlReceived(e); + if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val)) + { + if (val.Equals("finish")) + { + Log.Debug("RPCPortProxy", "Finish"); + Exit(); + } + } + else + { + Log.Debug("RPCPortProxy", "Connecting"); + _proxy?.Dispose(); + if (e.ReceivedAppControl.ExtraData.TryGet("send", out string v)) + _proxy = new Proxy(true); + else + _proxy = new Proxy(false); + } + } + + protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e) + { + base.OnDeviceOrientationChanged(e); + } + + protected override void OnLocaleChanged(LocaleChangedEventArgs e) + { + base.OnLocaleChanged(e); + } + + protected override void OnLowBattery(LowBatteryEventArgs e) + { + base.OnLowBattery(e); + } + + protected override void OnLowMemory(LowMemoryEventArgs e) + { + base.OnLowMemory(e); + } + + protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e) + { + base.OnRegionFormatChanged(e); + } + + protected override void OnTerminate() + { + _proxy?.Dispose(); + _proxy = null; + base.OnTerminate(); + } + + static void Main(string[] args) + { + App app = new App(); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/shared/res/RpcPortProxy.png b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/shared/res/RpcPortProxy.png new file mode 100755 index 0000000..9f3cb98 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/shared/res/RpcPortProxy.png differ diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/tizen-manifest.xml b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/tizen-manifest.xml new file mode 100755 index 0000000..14e26a9 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy/RpcPortProxy/tizen-manifest.xml @@ -0,0 +1,16 @@ + + + + + + RpcPortProxy.png + + + + + + http://tizen.org/privilege/appmanager.launch + http://tizen.org/privilege/datasharing + + + diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2.sln b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2.sln new file mode 100755 index 0000000..df07963 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2035 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortProxy2", "RpcPortProxy2\RpcPortProxy2.csproj", "{E877EB41-209D-417B-9E72-7095BBBF7604}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E877EB41-209D-417B-9E72-7095BBBF7604}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E877EB41-209D-417B-9E72-7095BBBF7604}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E877EB41-209D-417B-9E72-7095BBBF7604}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E877EB41-209D-417B-9E72-7095BBBF7604}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E8C497F1-5425-439D-8021-3A6D9BF04ED4} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/RpcPortProxy2.csproj b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/RpcPortProxy2.csproj new file mode 100755 index 0000000..490b33f --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/RpcPortProxy2.csproj @@ -0,0 +1,44 @@ + + + + + + $(MSBuildExtensionsPath)\Tizen\VisualStudio\ + + + + + + + + Exe + netcoreapp2.0 + + + + portable + + + None + + + + + + + + + + + + + + + + + + + + + + diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/RpcPortProxy2_App.cs b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/RpcPortProxy2_App.cs new file mode 100755 index 0000000..0d79ff4 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/RpcPortProxy2_App.cs @@ -0,0 +1,116 @@ +using System; +using System.Threading; +using Tizen; +using Tizen.Applications; +using Tizen.Applications.RPCPort; + +namespace RpcPortProxy +{ + class App : ServiceApplication + { + private Proxy _proxy; + + class Proxy : ProxyBase + { + public Proxy() + { + Connect("org.tizen.example.RpcPortStub", "Test"); + } + + protected override void OnConnectedEvent(string endPoint, string portName, Port port) + { + Log.Debug("RPCPortProxy", "OnConnectedEvent: endPoint:" + endPoint + " port:" + portName); + } + + protected override void OnDisconnectedEvent(string endPoint, string portName) + { + Log.Debug("RPCPortProxy", "OnDisconnectedEvent: endPoint:" + endPoint + " port:" + portName); + } + + protected override void OnReceivedEvent(string endPoint, string portName) + { + Log.Debug("RPCPortProxy", "OnReceivedEvent: endPoint:" + endPoint + " port:" + portName); + } + + protected override void OnRejectedEvent(string endPoint, string portName) + { + Log.Debug("RPCPortProxy", "OnRejectedEvent: endPoint:" + endPoint + " port:" + portName); + } + } + + protected override void OnCreate() + { + base.OnCreate(); + } + + protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + { + base.OnAppControlReceived(e); + if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val)) + { + if (val.Equals("finish")) + { + Log.Debug("RPCPortProxy", "Finish"); + Exit(); + } + } + else + { + Log.Debug("RPCPortProxy", "Connecting"); + _proxy?.Dispose(); + + try + { + _proxy = new Proxy(); + } + catch (PermissionDeniedException) + { + Log.Debug("RPCPortProxy", "PermissionDeniedException happened"); + e.ReceivedAppControl.ReplyToLaunchRequest(new AppControl(), AppControlReplyResult.Succeeded); + } + catch (Exception ex) + { + Log.Debug("RPCPortProxy", "Uncatched exception " + ex.ToString()); + } + } + } + + protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e) + { + base.OnDeviceOrientationChanged(e); + } + + protected override void OnLocaleChanged(LocaleChangedEventArgs e) + { + base.OnLocaleChanged(e); + } + + protected override void OnLowBattery(LowBatteryEventArgs e) + { + base.OnLowBattery(e); + } + + protected override void OnLowMemory(LowMemoryEventArgs e) + { + base.OnLowMemory(e); + } + + protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e) + { + base.OnRegionFormatChanged(e); + } + + protected override void OnTerminate() + { + _proxy?.Dispose(); + _proxy = null; + base.OnTerminate(); + } + + static void Main(string[] args) + { + App app = new App(); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/shared/res/RpcPortProxy2.png b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/shared/res/RpcPortProxy2.png new file mode 100755 index 0000000..9f3cb98 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/shared/res/RpcPortProxy2.png differ diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/tizen-manifest.xml b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/tizen-manifest.xml new file mode 100755 index 0000000..d597d54 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortProxy2/RpcPortProxy2/tizen-manifest.xml @@ -0,0 +1,15 @@ + + + + + + RpcPortProxy2.png + + + + + + http://tizen.org/privilege/appmanager.launch + + + diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub.sln b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub.sln new file mode 100755 index 0000000..4d59ee9 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2035 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortStub", "RpcPortStub\RpcPortStub.csproj", "{FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FE0280FD-12A8-4B3D-A035-D73CFF4C2ECF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C6927ABD-FBB9-450E-BD87-9152B5AD5C22} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/RpcPortStub.csproj b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/RpcPortStub.csproj new file mode 100755 index 0000000..bfbbbf8 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/RpcPortStub.csproj @@ -0,0 +1,44 @@ + + + + + + $(MSBuildExtensionsPath)\Tizen\VisualStudio\ + + + + + + + + Exe + netcoreapp2.0 + + + + portable + + + None + + + + + + + + + + + + + + + + + + + + + + diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/RpcPortStub_App.cs b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/RpcPortStub_App.cs new file mode 100755 index 0000000..e1a8e4a --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/RpcPortStub_App.cs @@ -0,0 +1,105 @@ +using Tizen; +using Tizen.Applications; +using Tizen.Applications.RPCPort; + +namespace RpcPortStub +{ + class App : ServiceApplication + { + private Stub _stub; + + private class Stub : StubBase + { + public Stub(string portName) : base(portName) + { + Listen(); + } + + protected override void OnConnectedEvent(string sender, string instance) + { + Log.Debug("RPCPortStub", "OnConnectedEvent: sender::" + sender + " instance::" + instance); + } + + protected override void OnDisconnectedEvent(string sender, string instance) + { + Log.Debug("RPCPortStub", "OnDisconnectedEvent: sender::" + sender + " instance::" + instance); + } + + protected override bool OnReceivedEvent(string sender, string instance, Port port) + { + Log.Debug("RPCPortStub", "OnReceivedEvent: sender::" + sender + " instance::" + instance); + using (Parcel p = new Parcel(port)) + { + string str = p.ReadString(); + using (Parcel ret = new Parcel()) + { + ret.WriteString(str); + ret.Send(GetPort(Port.Type.Callback, instance)); + } + } + + return true; + } + + protected override void OnTerminatedEvent() + { + Log.Debug("RPCPortStub", "OnTerminatedEvent"); + } + } + + protected override void OnCreate() + { + base.OnCreate(); + _stub = new Stub("Test"); + } + + protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + { + base.OnAppControlReceived(e); + if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val)) + { + if (val.Equals("finish")) { + Log.Debug("RPCPortStub", "Finish"); + Exit(); + } + } + } + + protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e) + { + base.OnDeviceOrientationChanged(e); + } + + protected override void OnLocaleChanged(LocaleChangedEventArgs e) + { + base.OnLocaleChanged(e); + } + + protected override void OnLowBattery(LowBatteryEventArgs e) + { + base.OnLowBattery(e); + } + + protected override void OnLowMemory(LowMemoryEventArgs e) + { + base.OnLowMemory(e); + } + + protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e) + { + base.OnRegionFormatChanged(e); + } + + protected override void OnTerminate() + { + base.OnTerminate(); + _stub?.Dispose(); + } + + static void Main(string[] args) + { + App app = new App(); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/shared/res/RpcPortStub.png b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/shared/res/RpcPortStub.png new file mode 100755 index 0000000..9f3cb98 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/shared/res/RpcPortStub.png differ diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/tizen-manifest.xml b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/tizen-manifest.xml new file mode 100755 index 0000000..8c3e00c --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub/RpcPortStub/tizen-manifest.xml @@ -0,0 +1,12 @@ + + + + + + RpcPortStub.png + + + + + + diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2.sln b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2.sln new file mode 100755 index 0000000..dc36126 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2035 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RpcPortStub2", "RpcPortStub2\RpcPortStub2.csproj", "{D84E03B5-7EFF-40B6-981A-BC0316180DAE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D84E03B5-7EFF-40B6-981A-BC0316180DAE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {934AC992-DE63-472C-AD51-4386E224BCD4} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/RpcPortStub2.csproj b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/RpcPortStub2.csproj new file mode 100755 index 0000000..e6d2acd --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/RpcPortStub2.csproj @@ -0,0 +1,44 @@ + + + + + + $(MSBuildExtensionsPath)\Tizen\VisualStudio\ + + + + + + + + Exe + netcoreapp2.0 + + + + portable + + + None + + + + + + + + + + + + + + + + + + + + + + diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/RpcPortStub2_App.cs b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/RpcPortStub2_App.cs new file mode 100755 index 0000000..ba8a2b5 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/RpcPortStub2_App.cs @@ -0,0 +1,101 @@ +using Tizen; +using Tizen.Applications; +using Tizen.Applications.RPCPort; + +namespace RpcPortStub +{ + class App : ServiceApplication + { + private Stub _stub; + + private class Stub : StubBase + { + public Stub(string portName) : base(portName) + { + AddPrivilege("my.privilege"); + Listen(); + } + + protected override void OnConnectedEvent(string sender, string instance) + { + Log.Debug("RPCPortStub2", "OnConnectedEvent: sender::" + sender + " instance::" + instance); + } + + protected override void OnDisconnectedEvent(string sender, string instance) + { + Log.Debug("RPCPortStub2", "OnDisconnectedEvent: sender::" + sender + " instance::" + instance); + } + + protected override bool OnReceivedEvent(string sender, string instance, Port port) + { + Log.Debug("RPCPortStub2", "OnReceivedEvent: sender::" + sender + " instance::" + instance); + using (Parcel p = new Parcel(port)) + { + } + + return true; + } + + protected override void OnTerminatedEvent() + { + Log.Debug("RPCPortStub2", "OnTerminatedEvent"); + } + } + + protected override void OnCreate() + { + base.OnCreate(); + _stub = new Stub("Test"); + } + + protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + { + base.OnAppControlReceived(e); + if (e.ReceivedAppControl.ExtraData.TryGet("Test", out string val)) + { + if (val.Equals("finish")) + { + Log.Debug("RPCPortStub2", "Finish"); + Exit(); + } + } + } + + protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e) + { + base.OnDeviceOrientationChanged(e); + } + + protected override void OnLocaleChanged(LocaleChangedEventArgs e) + { + base.OnLocaleChanged(e); + } + + protected override void OnLowBattery(LowBatteryEventArgs e) + { + base.OnLowBattery(e); + } + + protected override void OnLowMemory(LowMemoryEventArgs e) + { + base.OnLowMemory(e); + } + + protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e) + { + base.OnRegionFormatChanged(e); + } + + protected override void OnTerminate() + { + base.OnTerminate(); + _stub?.Dispose(); + } + + static void Main(string[] args) + { + App app = new App(); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/shared/res/RpcPortStub2.png b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/shared/res/RpcPortStub2.png new file mode 100755 index 0000000..9f3cb98 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/shared/res/RpcPortStub2.png differ diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/tizen-manifest.xml b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/tizen-manifest.xml new file mode 100755 index 0000000..19d1292 --- /dev/null +++ b/tct-suite-vs/Resource/Tizen.Applications.Tests/code/org.tizen.example.RpcPortStub2/RpcPortStub2/tizen-manifest.xml @@ -0,0 +1,12 @@ + + + + + + RpcPortStub2.png + + + + + + diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortProxy-1.0.0.tpk b/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortProxy-1.0.0.tpk new file mode 100755 index 0000000..13c3956 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortProxy-1.0.0.tpk differ diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortProxy2-1.0.0.tpk b/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortProxy2-1.0.0.tpk new file mode 100755 index 0000000..156e826 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortProxy2-1.0.0.tpk differ diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortStub-1.0.0.tpk b/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortStub-1.0.0.tpk new file mode 100755 index 0000000..8ab0bd2 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortStub-1.0.0.tpk differ diff --git a/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortStub2-1.0.0.tpk b/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortStub2-1.0.0.tpk new file mode 100755 index 0000000..393e8e3 Binary files /dev/null and b/tct-suite-vs/Resource/Tizen.Applications.Tests/org.tizen.example.RpcPortStub2-1.0.0.tpk differ diff --git a/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.Exceptions.cs b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.Exceptions.cs new file mode 100755 index 0000000..1d824f0 --- /dev/null +++ b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.Exceptions.cs @@ -0,0 +1,121 @@ +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 static void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + } + + [TearDown] + public static 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 static void InvalidIOException_INIT() + { + /* TEST CODE */ + var e = new InvalidIOException(); + + Assert.IsNotNull(e, "InvalidIOException shouldn't be null after init"); + Assert.IsInstanceOf(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 static void InvalidIDException_INIT() + { + /* TEST CODE */ + var e = new InvalidIDException(); + + Assert.IsNotNull(e, "InvalidIDException shouldn't be null after init"); + Assert.IsInstanceOf(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 static void PermissionDeniedException_INIT() + { + /* TEST CODE */ + var e = new PermissionDeniedException(); + + Assert.IsNotNull(e, "PermissionDeniedException shouldn't be null after init"); + Assert.IsInstanceOf(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 static void InvalidProtocolException_INIT() + { + /* TEST CODE */ + var e = new InvalidProtocolException(); + + Assert.IsNotNull(e, "InvalidProtocolException shouldn't be null after init"); + Assert.IsInstanceOf(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 static void NotConnectedSocketException_INIT() + { + /* TEST CODE */ + var e = new NotConnectedSocketException(); + + Assert.IsNotNull(e, "NotConnectedSocketException shouldn't be null after init"); + Assert.IsInstanceOf(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 static void InvalidCallbackException_INIT() + { + /* TEST CODE */ + var e = new InvalidCallbackException(); + + Assert.IsNotNull(e, "InvalidCallbackException shouldn't be null after init"); + Assert.IsInstanceOf(e); + } + } +} diff --git a/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.Parcel.cs b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.Parcel.cs new file mode 100755 index 0000000..e89da0e --- /dev/null +++ b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.Parcel.cs @@ -0,0 +1,699 @@ +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(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 static Proxy _proxy; + + [SetUp] + public static void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + _proxy = new Proxy(); + _proxy.TestConnect(); + } + + [TearDown] + public static 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 static void Parcel_INIT() + { + /* TEST CODE */ + using (var p = new Parcel()) + { + Assert.IsInstanceOf(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 static async Task Parcel_INIT_WITH_PARAMETER() + { + /* PRECONDITION + * */ + await Task.Delay(2000); + 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 static 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 static 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 static 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 static void ReadByte_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void ReadShort_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void ReadInt_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void ReadLong_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void ReadFloat_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void ReadDouble_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void ReadString_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void ReadBool_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void ReadBundle_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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("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 static void ReadArrayCount_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void Read_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void WriteByte_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void WriteShort_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void WriteInt_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void WriteLong_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void WriteFloat_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void WriteDouble_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void WriteString_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void WriteBool_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void WriteBundle_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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("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 static void WriteArrayCount_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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 static void Write_RETURN() + { + using (var p = new Parcel()) + { + /* PRECONDITION */ + Assert.IsInstanceOf(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"); + } + } + } + } +} diff --git a/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.ProxyBase.cs b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.ProxyBase.cs new file mode 100755 index 0000000..803871e --- /dev/null +++ b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.ProxyBase.cs @@ -0,0 +1,400 @@ +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 static 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 static void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + _proxy = new Proxy(); + _proxy.TestConnect(); + } + + [TearDown] + public static 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 static void ProxyBase_INIT() + { + var p = new Proxy(); + + Assert.IsInstanceOf(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 static async Task Connect_RETURN() + { + /* PRECONDITION */ + await Task.Delay(2000); + + /* 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 static async Task Connect_CHECK_INVALID_ID_EXCEPTION() + { + /* PRECONDITION */ + await Task.Delay(2000); + 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 static 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 static 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(2000); + + /* 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 static async Task OnConnectedEvent_CHECK_CB() + { + /* PRECONDITION */ + await Task.Delay(2000); + + /* 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 static async Task OnDisconnectedEvent_CHECK_CB() + { + /* PRECONDITION */ + await Task.Delay(2000); + Assert.True(_proxy.Connected); + var c = new AppControl() + { + ApplicationId = "org.tizen.example.RpcPortStub" + }; + c.ExtraData.Add("Test", "finish"); + AppControl.SendLaunchRequest(c); + await Task.Delay(2000); + + /* 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 static 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 static async Task OnReceivedEvent_CHECK_CB() + { + /* PRECONDITION */ + await Task.Delay(2000); + Assert.True(_proxy.Connected); + _proxy.SendHello(); + await Task.Delay(2000); + + /* 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 static async Task GetPort_CHECK_EXCEPTION() + { + /* PRECONDITION */ + await Task.Delay(2000); + 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 static async Task GetPort_RETURN() + { + /* PRECONDITION */ + await Task.Delay(2000); + 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 static async Task Port_PROPERTY_GET() + { + /* PRECONDITION */ + await Task.Delay(2000); + 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 static async Task CallbackPort_PROPERTY_GET() + { + /* PRECONDITION */ + await Task.Delay(2000); + Assert.True(_proxy.Connected); + + /* TEST CODE */ + Assert.NotNull(_proxy.GetCallbackPort()); + } + } +} diff --git a/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.StubBase.cs b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.StubBase.cs new file mode 100755 index 0000000..ddae7b5 --- /dev/null +++ b/tct-suite-vs/Tizen.Applications.Tests/testcase/TSRPCPort.StubBase.cs @@ -0,0 +1,554 @@ +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 static 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 static void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + _stub = new Stub("Test"); + } + + [TearDown] + public static 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 static void StubBase_INIT() + { + Assert.IsInstanceOf(_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 static 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 static 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 static 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 static 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 static 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 static 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 static 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 static 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 static 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 static 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 static 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 static 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 static 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 static void PortName_PROPERTY_GET() + { + Assert.NotNull(_stub.PortName); + Assert.True(_stub.PortName.Equals("Test")); + } + } +} diff --git a/tct-suite-vs/Tizen.Applications.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.Applications.Tests/tizen-manifest.xml index 04e10fb..8a92d2b 100755 --- a/tct-suite-vs/Tizen.Applications.Tests/tizen-manifest.xml +++ b/tct-suite-vs/Tizen.Applications.Tests/tizen-manifest.xml @@ -1,17 +1,16 @@  - - - - Tizen.Applications.Tests.png - - - - http://tizen.org/privilege/appmanager.launch - http://tizen.org/privilege/appdir.shareddata - + + + + Tizen.Applications.Tests.png + + + + + + http://tizen.org/privilege/appmanager.launch + http://tizen.org/privilege/appdir.shareddata + http://tizen.org/privilege/datasharing + +