This patch adds manual TCT for Tizen.WebView.
Change-Id: I29193b9d12352ae0f1d9f0b4b3abe07429e47e63
Signed-off-by: yh106.jung <yh106.jung@samsung.com>
--- /dev/null
+/*
+ * Copyright (c) 2019 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 NUnit.Framework;
+using Xamarin.Forms;
+using Tizen.WebView;
+
+namespace XamarinApplication.Tizen
+{
+ class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
+ {
+ private Application _app;
+ protected override void OnCreate()
+ {
+ Console.WriteLine("TCT : OnCreate()");
+ base.OnCreate();
+ if (ManualTest.IsWearable())
+ {
+ _app = new WearableTemplate.MainPage();
+ }
+ else
+ {
+ _app = new ManualTemplate.MainPage();
+ }
+ LoadApplication(_app);
+ }
+
+ static void Main(string[] args)
+ {
+ Console.WriteLine("TCT : Main()");
+ var app = new Program();
+ global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);
+ Chromium.Initialize();
+ app.Run(args);
+ Chromium.Shutdown();
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <!-- Property Group for .NET Core Project -->
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>tizen60</TargetFramework>
+ </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\ManualTemplate\ManualTemplate.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 15\r
+VisualStudioVersion = 15.0.26730.15\r
+MinimumVisualStudioVersion = 15.0.26124.0\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.WebView.Manual.Tests", "Tizen.WebView.Manual.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}") = "ManualTemplate", "..\Template\ManualTemplate\ManualTemplate.csproj", "{269F89A7-E648-4811-8421-844E00ACF5F0}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplateForWearable", "..\Template\ManualTemplateForWearable\ManualTemplateForWearable.csproj", "{D36CED01-29BD-4EB3-8903-62E0BF2A822D}"\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
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x64.Build.0 = Release|Any CPU\r
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x86.Build.0 = Release|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x64.Build.0 = Release|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.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
+<html>
+<head>
+ <title>Testing Context Menu</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
+ <style>
+ body {
+ margin-top: 15%;
+ text-align: center;
+ }
+ </style>
+</head>
+<body>
+ <h2>Context Menu Test Page</h2>
+ <p>Please <b>long press</b> below image.</p>
+ <img src="tizen.png" alt="Test image">
+</body>
+</html>
--- /dev/null
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+
+namespace Tizen.WebView.Manual.Tests
+{
+ [TestFixture]
+ [Description("Tizen.WebView.ContextMenu test")]
+ class ContextMenuTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for Tizen.WebView.ContextMenu TEST");
+ _webView = WebViewCommon.GetWebViewPage();
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for Tizen.WebView.ContextMenu TEST");
+ WebViewCommon.RemoveWebViewPage();
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Append new item to context menu.")]
+ [Property("SPEC", "Tizen.WebView.ContextMenu.AppendItem M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MAE")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ [Precondition(1, "Context menu is not supported on TV profile. So the testcase will be passed automatically after run if the profile is TV.")]
+ [Step(1, "Click run TC.")]
+ [Step(2, "Long press image of test page.")]
+ [Step(3, "If there is no exception, test will be automatically passed.")]
+ [Postcondition(1, "NA")]
+ public async Task AppendItem_ENUM_ALL()
+ {
+ /* PRECONDITION */
+ if (WebViewCommon.IsTVProfile())
+ {
+ Assert.Pass("Context menu is not supported on TV profile");
+ }
+
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.ContextMenuHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ WebView.ContextMenuCustomize contextMenuCustomize = (ContextMenu menu) =>
+ {
+ bool isFailed = false;
+ foreach (ContextMenuItemTag tag in Enum.GetValues(typeof(ContextMenuItemTag)))
+ {
+ var count = menu.ItemCount;
+ var newItem = menu.AppendItem(tag, tag.ToString(), null, true);
+
+ if (newItem == null || tag != newItem.ItemTag || menu.ItemCount - count != 1)
+ {
+ isFailed = true;
+ break;
+ }
+ }
+
+ if (isFailed)
+ {
+ ManualTest.ConfirmFail("Failed to append item");
+ }
+ else
+ {
+ ManualTest.Confirm();
+ }
+ };
+ _webView.SetContextMenuCustomizeDelegate(contextMenuCustomize);
+
+ await ManualTest.WaitForConfirm();
+
+ /* POSTCONDITION */
+ _webView.SetContextMenuCustomizeDelegate(null);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Gets the item of the context menu.")]
+ [Property("SPEC", "Tizen.WebView.ContextMenu.GetItemAtIndex M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ [Precondition(1, "Context menu is not supported on TV profile. So the testcase will be passed automatically after run if the profile is TV.")]
+ [Step(1, "Click run TC.")]
+ [Step(2, "Long press image of test page.")]
+ [Step(3, "If there is no exception, test will be automatically passed.")]
+ [Postcondition(1, "NA")]
+ public async Task GetItemAtIndex_RETURN_VALUE()
+ {
+ /* PRECONDITION */
+ if (WebViewCommon.IsTVProfile())
+ {
+ Assert.Pass("Context menu is not supported on TV profile");
+ }
+
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.ContextMenuHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ WebView.ContextMenuCustomize contextMenuCustomize = (ContextMenu menu) =>
+ {
+ Assert.IsTrue(menu.ItemCount > 0, "ContextMenu has no item");
+ var item = menu.GetItemAtIndex(0);
+ if (item != null && item.GetType() == typeof(ContextMenuItem))
+ {
+ ManualTest.Confirm();
+ }
+ else
+ {
+ ManualTest.ConfirmFail("Item is invalid object");
+ }
+ };
+ _webView.SetContextMenuCustomizeDelegate(contextMenuCustomize);
+
+ await ManualTest.WaitForConfirm();
+
+ /* POSTCONDITION */
+ _webView.SetContextMenuCustomizeDelegate(null);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Removes the item from the context menu.")]
+ [Property("SPEC", "Tizen.WebView.ContextMenu.RemoveItem M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ [Precondition(1, "Context menu is not supported on TV profile. So the testcase will be passed automatically after run if the profile is TV.")]
+ [Step(1, "Click run TC.")]
+ [Step(2, "Long press image of test page.")]
+ [Step(3, "If there is no exception, test will be automatically passed.")]
+ [Postcondition(1, "NA")]
+ public async Task RemoveItem_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ if (WebViewCommon.IsTVProfile())
+ {
+ Assert.Pass("Context menu is not supported on TV profile");
+ }
+
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.ContextMenuHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ WebView.ContextMenuCustomize contextMenuCustomize = (ContextMenu menu) =>
+ {
+ var count = menu.ItemCount;
+ Assert.IsTrue(count > 0, "There are no items in the context menu");
+ menu.RemoveItem(menu.GetItemAtIndex(0));
+ if (menu.ItemCount - count == -1)
+ {
+ ManualTest.Confirm();
+ }
+ else
+ {
+ ManualTest.ConfirmFail("Failed to remove item");
+ }
+ };
+ _webView.SetContextMenuCustomizeDelegate(contextMenuCustomize);
+
+ await ManualTest.WaitForConfirm();
+
+ /* POSTCONDITION */
+ _webView.SetContextMenuCustomizeDelegate(null);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Gets the count of items in the context menu.")]
+ [Property("SPEC", "Tizen.WebView.ContextMenu.ItemCount A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ [Precondition(1, "Context menu is not supported on TV profile. So the testcase will be passed automatically after run if the profile is TV.")]
+ [Step(1, "Click run TC.")]
+ [Step(2, "Long press image of test page.")]
+ [Step(3, "If there is no exception, test will be automatically passed.")]
+ [Postcondition(1, "NA")]
+ public async Task ItemCount_READ_ONLY()
+ {
+ /* PRECONDITION */
+ if (WebViewCommon.IsTVProfile())
+ {
+ Assert.Pass("Context menu is not supported on TV profile");
+ }
+
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.ContextMenuHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ WebView.ContextMenuCustomize contextMenuCustomize = (ContextMenu menu) =>
+ {
+ if (menu.ItemCount > 0)
+ {
+ ManualTest.Confirm();
+ }
+ else
+ {
+ ManualTest.ConfirmFail("There are no items in the context menu");
+ }
+ };
+ _webView.SetContextMenuCustomizeDelegate(contextMenuCustomize);
+
+ await ManualTest.WaitForConfirm();
+
+ /* POSTCONDITION */
+ _webView.SetContextMenuCustomizeDelegate(null);
+ }
+ };
+}
--- /dev/null
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+
+namespace Tizen.WebView.Manual.Tests
+{
+ [TestFixture]
+ [Description("Tizen.WebView.ContextMenuItem test")]
+ class ContextMenuItemTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for Tizen.WebView.ContextMenuItem TEST");
+ _webView = WebViewCommon.GetWebViewPage();
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for Tizen.WebView.ContextMenuItem TEST");
+ WebViewCommon.RemoveWebViewPage();
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Gets ItemTag property of ContextMenuItem.")]
+ [Property("SPEC", "Tizen.WebView.ContextMenuItem.ItemTag A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ [Precondition(1, "Context menu is not supported on TV profile. So the testcase will be passed automatically after run if the profile is TV.")]
+ [Step(1, "Click run TC.")]
+ [Step(2, "Long press image of test page.")]
+ [Step(3, "If there is no exception, test will be automatically passed.")]
+ [Postcondition(1, "NA")]
+ public async Task ItemTag_READ_ONLY()
+ {
+ /* PRECONDITION */
+ if (WebViewCommon.IsTVProfile())
+ {
+ Assert.Pass("Context menu is not supported on TV profile");
+ }
+
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.ContextMenuHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ WebView.ContextMenuCustomize contextMenuCustomize = (ContextMenu menu) =>
+ {
+ Assert.IsTrue(menu.ItemCount > 0, "ContextMenu has no item");
+ var item = menu.GetItemAtIndex(0);
+ if (item != null && item.ItemTag.GetType() == typeof(ContextMenuItemTag))
+ {
+ ManualTest.Confirm();
+ }
+ else
+ {
+ ManualTest.ConfirmFail("ItemTag is invalid object");
+ }
+ };
+ _webView.SetContextMenuCustomizeDelegate(contextMenuCustomize);
+
+ await ManualTest.WaitForConfirm();
+
+ /* POSTCONDITION */
+ _webView.SetContextMenuCustomizeDelegate(null);
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+
+namespace Tizen.WebView.Manual.Tests
+{
+ [TestFixture]
+ [Description("Tizen.WebView.ContextMenuItemEventArgs test")]
+ class ContextMenuItemEventArgsTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for Tizen.WebView.ContextMenuItemEventArgs TEST");
+ _webView = WebViewCommon.GetWebViewPage();
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for Tizen.WebView.ContextMenuItemEventArgs TEST");
+ WebViewCommon.RemoveWebViewPage();
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Gets Item property of ContextMenuItemEventArgs.")]
+ [Property("SPEC", "Tizen.WebView.ContextMenuItemEventArgs.Item A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ [Precondition(1, "Context menu is not supported on TV profile. So the testcase will be passed automatically after run if the profile is TV.")]
+ [Step(1, "Click run TC.")]
+ [Step(2, "Long press image of test page.")]
+ [Step(3, "Select item of the context menu.")]
+ [Step(4, "If there is no exception, test will be automatically passed.")]
+ [Postcondition(1, "NA")]
+ public async Task Item_READ_ONLY()
+ {
+ /* PRECONDITION */
+ if (WebViewCommon.IsTVProfile())
+ {
+ Assert.Pass("Context menu is not supported on TV profile");
+ }
+
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.ContextMenuHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ WebView.ContextMenuCustomize contextMenuCustomize = (ContextMenu menu) =>
+ {
+ var count = menu.ItemCount;
+ for (int i = 0; i < count; i++)
+ {
+ menu.RemoveItem(menu.GetItemAtIndex(0));
+ }
+
+ var newItem = menu.AppendItem(WebViewCommon.CustomItemTag, "Select me!!!", null, true);
+ if (newItem == null)
+ {
+ ManualTest.ConfirmFail("Failed to append item");
+ }
+ };
+ _webView.SetContextMenuCustomizeDelegate(contextMenuCustomize);
+
+ /* TEST CODE */
+ EventHandler<ContextMenuItemEventArgs> onContextMenuItemSelected = (s, e) =>
+ {
+ var item = e.Item;
+ if (item != null && item.GetType() == typeof(ContextMenuItem))
+ {
+ ManualTest.Confirm();
+ }
+ else
+ {
+ ManualTest.ConfirmFail("Seleted item is invalid object");
+ }
+ };
+ _webView.ContextMenuItemSelected += onContextMenuItemSelected;
+
+ await ManualTest.WaitForConfirm();
+
+ /* POSTCONDITION */
+ _webView.SetContextMenuCustomizeDelegate(null);
+ _webView.ContextMenuItemSelected -= onContextMenuItemSelected;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+
+namespace Tizen.WebView.Manual.Tests
+{
+ [TestFixture]
+ [Description("Tizen.WebView.WebView test")]
+ class WebViewTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for Tizen.WebView.WebView TEST");
+ _webView = WebViewCommon.GetWebViewPage();
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for Tizen.WebView.WebView TEST");
+ WebViewCommon.RemoveWebViewPage();
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Sets the delegate for context menu customization.")]
+ [Property("SPEC", "Tizen.WebView.WebView.SetContextMenuCustomizeDelegate M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ [Precondition(1, "Context menu is not supported on TV profile. So the testcase will be passed automatically after run if the profile is TV.")]
+ [Step(1, "Click run TC.")]
+ [Step(2, "Long press image of test page.")]
+ [Step(3, "If there is no exception, test will be automatically passed.")]
+ [Postcondition(1, "NA")]
+ public async Task SetContextMenuCustomizeDelegate_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ if (WebViewCommon.IsTVProfile())
+ {
+ Assert.Pass("Context menu is not supported on TV profile");
+ }
+
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.ContextMenuHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ WebView.ContextMenuCustomize contextMenuCustomize = (ContextMenu menu) =>
+ {
+ ManualTest.Confirm();
+ };
+ _webView.SetContextMenuCustomizeDelegate(contextMenuCustomize);
+
+ await ManualTest.WaitForConfirm();
+
+ /* POSTCONDITION */
+ _webView.SetContextMenuCustomizeDelegate(null);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Checks event that occurs when customized item is selected.")]
+ [Property("SPEC", "Tizen.WebView.WebView.ContextMenuItemSelected E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ [Precondition(1, "Context menu is not supported on TV profile. So the testcase will be passed automatically after run if the profile is TV.")]
+ [Step(1, "Click run TC.")]
+ [Step(2, "Long press image of test page.")]
+ [Step(3, "Select item of the context menu.")]
+ [Step(4, "If there is no exception, test will be automatically passed.")]
+ [Postcondition(1, "NA")]
+ public async Task ContextMenuItemSelected_CHECK_EVENT()
+ {
+ /* PRECONDITION */
+ if (WebViewCommon.IsTVProfile())
+ {
+ Assert.Pass("Context menu is not supported on TV profile");
+ }
+
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.ContextMenuHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ WebView.ContextMenuCustomize contextMenuCustomize = (ContextMenu menu) =>
+ {
+ var count = menu.ItemCount;
+ for (int i = 0; i < count; i++)
+ {
+ menu.RemoveItem(menu.GetItemAtIndex(0));
+ }
+
+ var newItem = menu.AppendItem(WebViewCommon.CustomItemTag, "Select me!!!", null, true);
+ if (newItem == null)
+ {
+ ManualTest.ConfirmFail("Failed to append item");
+ }
+ };
+ _webView.SetContextMenuCustomizeDelegate(contextMenuCustomize);
+
+ /* TEST CODE */
+ EventHandler<ContextMenuItemEventArgs> onContextMenuItemSelected = (s, e) =>
+ {
+ ManualTest.Confirm();
+ };
+ _webView.ContextMenuItemSelected += onContextMenuItemSelected;
+
+ await ManualTest.WaitForConfirm();
+
+ /* POSTCONDITION */
+ _webView.SetContextMenuCustomizeDelegate(null);
+ _webView.ContextMenuItemSelected -= onContextMenuItemSelected;
+ }
+ }
+}
--- /dev/null
+using ElmSharp;\r
+using Tizen.WebView;\r
+using Tizen.System;\r
+\r
+namespace Tizen.WebView.Manual.Tests\r
+{\r
+ internal static class WebViewCommon\r
+ {\r
+ private static Window _window;\r
+ private static Box _box;\r
+ private static WebView _webView;\r
+ private static string _profile;\r
+\r
+ public const string ContextMenuHtml = "file:///opt/usr/home/owner/share/res/context_menu.html";\r
+ public const ContextMenuItemTag CustomItemTag = ContextMenuItemTag.BaseApplicationTag + 1;\r
+\r
+ public static WebView GetWebViewPage()\r
+ {\r
+ if (_window == null)\r
+ {\r
+ Elementary.Initialize();\r
+\r
+ _window = new Window("Tizen.WebView.Test");\r
+ _window.KeyGrab(EvasKeyEventArgs.PlatformBackButtonName, false);\r
+ _window.KeyUp += (s, e) =>\r
+ {\r
+ if (e.KeyName == EvasKeyEventArgs.PlatformBackButtonName)\r
+ RemoveWebViewPage();\r
+\r
+ };\r
+ _window.Show();\r
+\r
+ Background background = new Background(_window)\r
+ {\r
+ AlignmentX = -1,\r
+ AlignmentY = -1,\r
+ WeightX = 1,\r
+ WeightY = 1,\r
+ Color = Color.White\r
+ };\r
+ background.Show();\r
+ _window.AddResizeObject(background);\r
+\r
+ Conformant conformant = new Conformant(_window);\r
+ conformant.Show();\r
+\r
+ _box = new Box(_window)\r
+ {\r
+ AlignmentX = -1,\r
+ AlignmentY = -1,\r
+ WeightX = 1,\r
+ WeightY = 1\r
+ };\r
+ _box.Show();\r
+ conformant.SetContent(_box);\r
+ }\r
+ else\r
+ {\r
+ _window.Show();\r
+ }\r
+\r
+ _webView = new WebView(_window)\r
+ {\r
+ AlignmentX = -1,\r
+ AlignmentY = -1,\r
+ WeightX = 1,\r
+ WeightY = 1\r
+ };\r
+ _webView.Show();\r
+\r
+ _box.PackEnd(_webView);\r
+\r
+ return _webView;\r
+ }\r
+\r
+ public static void RemoveWebViewPage()\r
+ {\r
+ if (_webView != null)\r
+ {\r
+ _box.UnPack(_webView);\r
+ _webView.Unrealize();\r
+ _webView = null;\r
+ }\r
+ _window.Hide();\r
+ }\r
+\r
+ public static bool IsTVProfile()\r
+ {\r
+ return string.Compare("tv", GetProfile()) == 0 ? true : false;\r
+ }\r
+\r
+ public static bool IsMobileProfile()\r
+ {\r
+ return string.Compare("mobile", GetProfile()) == 0 ? true : false;\r
+ }\r
+\r
+ public static bool IsWearableProfile()\r
+ {\r
+ return string.Compare("wearable", GetProfile()) == 0 ? true : false;\r
+ }\r
+\r
+ private static string GetProfile()\r
+ {\r
+ if (string.IsNullOrEmpty(_profile))\r
+ {\r
+ Information.TryGetValue<string>("http://tizen.org/feature/profile", out _profile);\r
+ }\r
+\r
+ return _profile;\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="6" package="Tizen.WebView.Manual.Tests" version="1.0.0">
+ <profile name="common" />
+ <ui-application appid="Tizen.WebView.Manual.Tests"
+ exec="Tizen.WebView.Manual.Tests.dll"
+ type="dotnet"
+ multiple="false"
+ taskmanage="true"
+ launch_mode="single">
+ <icon>Tizen.WebView.Manual.Tests.png</icon>
+ <label>Tizen.WebView.Manual.Tests</label>
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ </privileges>
+</manifest>