Microsoft Visual Studio Solution File, Format Version 12.00\r
-# Visual Studio Version 16\r
-VisualStudioVersion = 16.0.30225.117\r
+# Visual Studio Version 17\r
+VisualStudioVersion = 17.6.33829.357\r
MinimumVisualStudioVersion = 10.0.40219.1\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Tests", "Tizen.Applications.Tests\Tizen.Applications.Tests.csproj", "{F0D122C4-48E1-4037-A97D-F7BC75365C81}"\r
EndProject\r
EndProject\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Nlp.Tests", "Tizen.Nlp.Tests\Tizen.Nlp.Tests.csproj", "{12D898B5-41E2-4E2E-9697-70C7501E33EC}"\r
EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.WebView.Tests", "Tizen.WebView.Tests\Tizen.WebView.Tests.csproj", "{CB2C92D4-36B8-445F-8090-082AD62137EE}"\r
+EndProject\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Connection.Tests", "Tizen.Connection.Tests\Tizen.Connection.Tests.csproj", "{13A7BAD5-3C3C-4385-A4F9-09E8DA2935F4}"\r
EndProject\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Connection.Manual.Tests", "Tizen.Connection.Manual.Tests\Tizen.Connection.Manual.Tests.csproj", "{9374FA38-9FB6-4FFB-A42C-48DBA8078F3A}"\r
EndProject\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.EventManager.Manual.Tests", "Tizen.Applications.EventManager.Manual.Tests\Tizen.Applications.EventManager.Manual.Tests.csproj", "{C8796F73-3BF9-485B-8616-92B7E140A6BA}"\r
EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.WebView.Manual.Tests", "Tizen.WebView.Manual.Tests\Tizen.WebView.Manual.Tests.csproj", "{0E4F1A1C-40DE-42E3-9D8E-DB148E70D981}"\r
+EndProject\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.Components.Tests", "Tizen.NUI.Components.Tests\Tizen.NUI.Components.Tests.csproj", "{76F45553-4F99-4605-8746-E315F6AF9614}"\r
EndProject\r
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI.Components.Manual.Tests", "Tizen.NUI.Components.Manual.Tests\Tizen.NUI.Components.Manual.Tests.csproj", "{6B88A41D-1DD9-416F-9B51-84189E7A1232}"\r
{0C5D3A30-65AD-4419-9584-67D3D596131A}.NUI|Any CPU.ActiveCfg = Release|Any CPU\r
{0C5D3A30-65AD-4419-9584-67D3D596131A}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{0C5D3A30-65AD-4419-9584-67D3D596131A}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B0360617-24BA-4449-85A5-80420150C84F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B0360617-24BA-4449-85A5-80420150C84F}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B0360617-24BA-4449-85A5-80420150C84F}.NUI|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B0360617-24BA-4449-85A5-80420150C84F}.NUI|Any CPU.Build.0 = Release|Any CPU\r
+ {B0360617-24BA-4449-85A5-80420150C84F}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B0360617-24BA-4449-85A5-80420150C84F}.Release|Any CPU.Build.0 = Release|Any CPU\r
{B4408568-4DBB-41F8-BB41-508A07614129}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{B4408568-4DBB-41F8-BB41-508A07614129}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{B4408568-4DBB-41F8-BB41-508A07614129}.NUI|Any CPU.ActiveCfg = Release|Any CPU\r
{D09A0ACE-E070-4694-9E3C-F81F54C27A69}.NUI|Any CPU.ActiveCfg = Release|Any CPU\r
{D09A0ACE-E070-4694-9E3C-F81F54C27A69}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{D09A0ACE-E070-4694-9E3C-F81F54C27A69}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {552E1436-AF4D-4DAA-BA0A-CA43A050DEB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {552E1436-AF4D-4DAA-BA0A-CA43A050DEB0}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {552E1436-AF4D-4DAA-BA0A-CA43A050DEB0}.NUI|Any CPU.ActiveCfg = Release|Any CPU\r
+ {552E1436-AF4D-4DAA-BA0A-CA43A050DEB0}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {552E1436-AF4D-4DAA-BA0A-CA43A050DEB0}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {22673A2C-2B03-4114-ADF3-B6B952F758C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {22673A2C-2B03-4114-ADF3-B6B952F758C9}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {22673A2C-2B03-4114-ADF3-B6B952F758C9}.NUI|Any CPU.ActiveCfg = Release|Any CPU\r
+ {22673A2C-2B03-4114-ADF3-B6B952F758C9}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {22673A2C-2B03-4114-ADF3-B6B952F758C9}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {6BA4E0F6-A125-4A12-AE89-30604126C90D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {6BA4E0F6-A125-4A12-AE89-30604126C90D}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {6BA4E0F6-A125-4A12-AE89-30604126C90D}.NUI|Any CPU.ActiveCfg = Release|Any CPU\r
+ {6BA4E0F6-A125-4A12-AE89-30604126C90D}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {6BA4E0F6-A125-4A12-AE89-30604126C90D}.Release|Any CPU.Build.0 = Release|Any CPU\r
{D23C0C2B-2361-42CA-8BC6-F2F9325A8158}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{D23C0C2B-2361-42CA-8BC6-F2F9325A8158}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{D23C0C2B-2361-42CA-8BC6-F2F9325A8158}.NUI|Any CPU.ActiveCfg = Release|Any CPU\r
{12D898B5-41E2-4E2E-9697-70C7501E33EC}.NUI|Any CPU.Build.0 = Debug|Any CPU\r
{12D898B5-41E2-4E2E-9697-70C7501E33EC}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{12D898B5-41E2-4E2E-9697-70C7501E33EC}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {CB2C92D4-36B8-445F-8090-082AD62137EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {CB2C92D4-36B8-445F-8090-082AD62137EE}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {CB2C92D4-36B8-445F-8090-082AD62137EE}.NUI|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {CB2C92D4-36B8-445F-8090-082AD62137EE}.NUI|Any CPU.Build.0 = Debug|Any CPU\r
+ {CB2C92D4-36B8-445F-8090-082AD62137EE}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {CB2C92D4-36B8-445F-8090-082AD62137EE}.Release|Any CPU.Build.0 = Release|Any CPU\r
{13A7BAD5-3C3C-4385-A4F9-09E8DA2935F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{13A7BAD5-3C3C-4385-A4F9-09E8DA2935F4}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{13A7BAD5-3C3C-4385-A4F9-09E8DA2935F4}.NUI|Any CPU.ActiveCfg = Debug|Any CPU\r
{C8796F73-3BF9-485B-8616-92B7E140A6BA}.NUI|Any CPU.Build.0 = Debug|Any CPU\r
{C8796F73-3BF9-485B-8616-92B7E140A6BA}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
{C8796F73-3BF9-485B-8616-92B7E140A6BA}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {0E4F1A1C-40DE-42E3-9D8E-DB148E70D981}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {0E4F1A1C-40DE-42E3-9D8E-DB148E70D981}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {0E4F1A1C-40DE-42E3-9D8E-DB148E70D981}.NUI|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {0E4F1A1C-40DE-42E3-9D8E-DB148E70D981}.NUI|Any CPU.Build.0 = Debug|Any CPU\r
+ {0E4F1A1C-40DE-42E3-9D8E-DB148E70D981}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {0E4F1A1C-40DE-42E3-9D8E-DB148E70D981}.Release|Any CPU.Build.0 = Release|Any CPU\r
{76F45553-4F99-4605-8746-E315F6AF9614}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
{76F45553-4F99-4605-8746-E315F6AF9614}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
{76F45553-4F99-4605-8746-E315F6AF9614}.NUI|Any CPU.ActiveCfg = Debug|Any CPU\r
--- /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.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>net6.0-tizen8.0</TargetFramework>
+ <DisableImplicitTizenReferences>True</DisableImplicitTizenReferences>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <!-- Property Group for Tizen Project -->
+ <PropertyGroup>
+ <TizenCreateTpkOnBuild>true</TizenCreateTpkOnBuild>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Folder Include="lib\" />
+ </ItemGroup>
+
+ <Import Project="..\Common\dependencies.props" />
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)">
+ <ExcludeAssets>Runtime</ExcludeAssets>
+ </PackageReference>
+ </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 both TV and Wearable profile. So the testcase will be passed automatically after run if the profile is TV or Wearable.")]
+ [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() || WebViewCommon.IsWearableProfile())
+ {
+ Assert.Pass("Context menu is not supported on both TV and Wearable 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 both TV and Wearable profile. So the testcase will be passed automatically after run if the profile is TV or Wearable.")]
+ [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() || WebViewCommon.IsWearableProfile())
+ {
+ Assert.Pass("Context menu is not supported on both TV and Wearable 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 both TV and Wearable profile. So the testcase will be passed automatically after run if the profile is TV or Wearable.")]
+ [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() || WebViewCommon.IsWearableProfile())
+ {
+ Assert.Pass("Context menu is not supported on both TV and Wearable 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 both TV and Wearable profile. So the testcase will be passed automatically after run if the profile is TV or Wearable.")]
+ [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() || WebViewCommon.IsWearableProfile())
+ {
+ Assert.Pass("Context menu is not supported on both TV and Wearable 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 both TV and Wearable profile. So the testcase will be passed automatically after run if the profile is TV or Wearable.")]
+ [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() || WebViewCommon.IsWearableProfile())
+ {
+ Assert.Pass("Context menu is not supported on both TV and Wearable 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 both TV and Wearable profile. So the testcase will be passed automatically after run if the profile is TV or Wearable.")]
+ [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() || WebViewCommon.IsWearableProfile())
+ {
+ Assert.Pass("Context menu is not supported on both TV and Wearable 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 both TV and Wearable profile. So the testcase will be passed automatically after run if the profile is TV or Wearable.")]
+ [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() || WebViewCommon.IsWearableProfile())
+ {
+ Assert.Pass("Context menu is not supported on both TV and Wearable 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 both TV and Wearable profile. So the testcase will be passed automatically after run if the profile is TV or Wearable.")]
+ [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() || WebViewCommon.IsWearableProfile())
+ {
+ Assert.Pass("Context menu is not supported on both TV and Wearable 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"?>\r
+<manifest xmlns="http://tizen.org/ns/packages" api-version="8.0" package="Tizen.WebView.Manual.Tests" version="1.0.0">\r
+ <profile name="common" />\r
+ <ui-application appid="Tizen.WebView.Manual.Tests"\r
+ exec="Tizen.WebView.Manual.Tests.dll"\r
+ type="dotnet"\r
+ multiple="false"\r
+ taskmanage="true"\r
+ launch_mode="single">\r
+ <icon>Tizen.WebView.Manual.Tests.png</icon>\r
+ <label>Tizen.WebView.Manual.Tests</label>\r
+ </ui-application>\r
+ <privileges>\r
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>\r
+ </privileges>\r
+</manifest>\r
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using NUnitLite.TUnit;
+using AutoTemplate;
+using System.Collections.Generic;
+using Tizen.WebView;
+
+namespace XamarinForTizen.Tizen
+{
+
+ class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
+ {
+ private static App _app;
+ private static string[] _chromiumArgv = { "--renderer-process-limit=1" };
+
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+
+ Console.WriteLine("TCT : OnCreate()");
+ _app = new App();
+ LoadApplication(_app);
+
+ TRunner t = new TRunner();
+ t.LoadTestsuite();
+ t.Execute();
+ }
+
+ public static App getApp()
+ {
+ return _app;
+ }
+ static void Main(string[] args)
+ {
+ Console.WriteLine("TCT : Main()");
+ var app = new Program();
+ global::Xamarin.Forms.Forms.Init(app);
+ Chromium.Initialize();
+ List<string> argv = new List<string>(_chromiumArgv);
+ argv.Insert(0, app.Name);
+ Chromium.SetArguments(argv.ToArray());
+ app.Run(args);
+ Chromium.Shutdown();
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <!-- Property Group for .NET Core Project -->
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net6.0-tizen8.0</TargetFramework>
+ <DisableImplicitTizenReferences>True</DisableImplicitTizenReferences>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <!-- Property Group for Tizen Project -->
+ <PropertyGroup>
+ <TizenCreateTpkOnBuild>true</TizenCreateTpkOnBuild>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Folder Include="lib\" />
+ </ItemGroup>
+
+ <Import Project="..\Common\dependencies.props" />
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)">
+ <ExcludeAssets>Runtime</ExcludeAssets>
+ </PackageReference>
+ </ItemGroup>
+
+ <!-- Include Nuget Package for Tizen Project building -->
+ <ItemGroup>
+ <ProjectReference Include="..\Template\AutoTemplate\AutoTemplate.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 15\r
+VisualStudioVersion = 15.0.26730.15\r
+MinimumVisualStudioVersion = 15.0.26124.0\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.WebView.Tests", "Tizen.WebView.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Debug|x64 = Debug|x64\r
+ Debug|x86 = Debug|x86\r
+ Release|Any CPU = Release|Any CPU\r
+ Release|x64 = Release|x64\r
+ Release|x86 = Release|x86\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680}\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+<html>
+<!--
+This test file is common file and can be used by EWK APIs to load web pages.
+-->
+<head>
+ <title>Testing Sample Page for Add JavaScript Interface</title>
+ <script type="text/javascript">
+ function callForCommon() {
+ window.MyJavaScriptInterfaceForCommon.postMessage("Test message");
+ }
+
+ function callForName() {
+ window.MyJavaScriptInterfaceForName.postMessage("");
+ }
+
+ function callWithInteger() {
+ window.MyJavaScriptInterfaceWithInteger.postMessage(10);
+ }
+
+ function callWithDouble() {
+ window.MyJavaScriptInterfaceWithDouble.postMessage(0.1);
+ }
+
+ function callWithBoolean() {
+ window.MyJavaScriptInterfaceWithBoolean.postMessage(true);
+ }
+
+ function callWithString() {
+ window.MyJavaScriptInterfaceWithString.postMessage("Test message");
+ }
+
+ function sendResult(param_result) {
+ console.log("Executed test script : " + param_result);
+ document.getElementById("result").innerHTML
+ += "- Message received : <br>" + param_result + "<br>";
+ }
+ </script>
+</head>
+<body>
+ <h1>Sample HTML for Add JavaScript Interface</h1>
+ <br>
+ <p id="result"></p>
+</body>
+</html>
--- /dev/null
+<html>\r
+<!--\r
+This test file is common file and can be used by EWK APIs to load web pages.\r
+-->\r
+<head>\r
+ <title>Testing Sample Page</title>\r
+ <script>\r
+ function submitForm() {\r
+ document.forms[0].submit();\r
+ }\r
+ </script>\r
+</head>\r
+<body>\r
+ <form action="form_submit_sample.html" method="post">\r
+ <input name="a" value="b">\r
+ <input id="mysubmit" type="submit" name="Submit" value="Submit">\r
+ </form>\r
+</body>\r
+</html>\r
--- /dev/null
+<html>\r
+<!--\r
+This test file is common file and can be used by EWK APIs to load web pages.\r
+-->\r
+<head>\r
+ <title>Testing Sample Page</title>\r
+ <script>\r
+ function clickLink() {\r
+ document.getElementById('linkContent').click();\r
+ }\r
+ </script>\r
+</head>\r
+<body onload="clickLink()">\r
+ <h1>Sample HTML</h1>\r
+ <p>This is sample html page to be used in test suite when loading of a page is required.</p>\r
+ <a id="linkContent" href="http://www.google.com">link content</a>\r
+</body>\r
+</html>\r
--- /dev/null
+<html>
+<!--
+This test file is common file and can be used by EWK APIs to load web pages.
+-->
+<head>
+ <title>Testing Sample Page</title>
+</head>
+<body>
+ <h1>Sample HTML</h1>
+ <p>This is sample html page to be used in test suite when loading of a page is required.</p>
+ <p id="getParaContent">test content</p>
+</body>
+</html>
--- /dev/null
+<html>
+<!--
+This test file is common file and can be used by EWK APIs to load web pages.
+-->
+<head>
+ <title>Testing Sample Page 1</title>
+</head>
+<body>
+ <h1>Sample HTML 1</h1>
+</body>
+</html>
--- /dev/null
+<html>
+<!--
+This test file is common file and can be used by EWK APIs to load web pages.
+-->
+<head>
+ <title>Testing Sample Page 2</title>
+</head>
+<body>
+ <h1>Sample HTML 2</h1>
+</body>
+</html>
--- /dev/null
+<html>
+<!--
+This test file is common file and can be used by EWK APIs to load web pages.
+-->
+<head>
+ <title>Testing Sample Page</title>
+ <script>
+ function windowOpen() {
+ window.open("http://www.google.com/");
+ }
+ </script>
+</head>
+<body onload="windowOpen()">
+ <h1>Sample HTML</h1>
+ <p>This is sample html page to be used in test suite when loading of a page is required.</p>
+ <p id="getParaContent">test content</p>
+</body>
+</html>
--- /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 NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+
+namespace Tizen.WebView.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.WebView.BackForwardList Tests")]
+ public class BackForwardListTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.BackForwardList Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.BackForwardList Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Back Forward List Count")]
+ [Property("SPEC", "Tizen.WebView.BackForwardList.Count A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task Count_READ_ONLY()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ var backforwardlist = _webView.GetBackForwardList();
+ Assert.IsInstanceOf<BackForwardList>(backforwardlist, "Get BackForwardList method failed");
+
+ Assert.AreEqual(1, backforwardlist.Count, "Fail to get BackForwardList Count");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Current Item of Back Forward List")]
+ [Property("SPEC", "Tizen.WebView.BackForwardList.CurrentItem A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task CurrentItem_READ_ONLY()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ var backforwardlist = _webView.GetBackForwardList();
+ Assert.IsInstanceOf<BackForwardList>(backforwardlist, "GetBackForwardList method failed");
+
+ var currentItem = backforwardlist.CurrentItem;
+ Assert.IsInstanceOf<BackForwardListItem>(currentItem, "Get Current BackForwardListItem property failed");
+ Assert.AreEqual(WebViewCommon.SampleHtml, currentItem.Url, "URL should be same");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets Previous Item of Back Forward List")]
+ [Property("SPEC", "Tizen.WebView.BackForwardList.PreviousItem A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task PreviousItem_READ_ONLY()
+ {
+ /* PRECONDITION */
+ TaskCompletionSource<bool> tcsFisrt = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedFirst = (s, e) => { tcsFisrt.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorFirst = (s, e) => { tcsFisrt.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedFirst;
+ _webView.LoadError += onLoadErrorFirst;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml1);
+ var result = await tcsFisrt.Task;
+
+ _webView.LoadFinished -= onLoadFinishedFirst;
+ _webView.LoadError -= onLoadErrorFirst;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the first page");
+
+ TaskCompletionSource<bool> tcsSecond = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedSecond = (s, e) => { tcsSecond.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorSecond = (s, e) => { tcsSecond.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedSecond;
+ _webView.LoadError += onLoadErrorSecond;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml2);
+ result = await tcsSecond.Task;
+
+ _webView.LoadFinished -= onLoadFinishedSecond;
+ _webView.LoadError -= onLoadErrorSecond;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the second page");
+
+ /* TEST CODE */
+ var backforwardlist = _webView.GetBackForwardList();
+ Assert.IsInstanceOf<BackForwardList>(backforwardlist, "GetBackForwardList method failed");
+
+ var previousItem = backforwardlist.PreviousItem;
+ Assert.IsInstanceOf<BackForwardListItem>(previousItem, "Get Previous BackForwardList Item property failed");
+ Assert.AreEqual(WebViewCommon.SampleHtml1, previousItem.Url, "URL should be same with the first page");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the copy of Back Items")]
+ [Property("SPEC", "Tizen.WebView.BackForwardList.BackItems M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task BackItems_RETURN_VALUE()
+ {
+ /* PRECONDITION */
+ TaskCompletionSource<bool> tcsFisrt = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedFirst = (s, e) => { tcsFisrt.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorFirst = (s, e) => { tcsFisrt.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedFirst;
+ _webView.LoadError += onLoadErrorFirst;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml1);
+ var result = await tcsFisrt.Task;
+
+ _webView.LoadFinished -= onLoadFinishedFirst;
+ _webView.LoadError -= onLoadErrorFirst;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the first page");
+
+ TaskCompletionSource<bool> tcsSecond = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedSecond = (s, e) => { tcsSecond.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorSecond = (s, e) => { tcsSecond.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedSecond;
+ _webView.LoadError += onLoadErrorSecond;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml2);
+ result = await tcsSecond.Task;
+
+ _webView.LoadFinished -= onLoadFinishedSecond;
+ _webView.LoadError -= onLoadErrorSecond;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the second page");
+
+ /* TEST CODE */
+ var backforwardlist = _webView.GetBackForwardList();
+ Assert.IsInstanceOf<BackForwardList>(backforwardlist, "GetBackForwardList method failed");
+
+ var backItems = backforwardlist.BackItems(-1);
+ Assert.AreEqual(1, backItems.Count, "The count of backItems should be 1");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the copy of Forward Items")]
+ [Property("SPEC", "Tizen.WebView.BackForwardList.ForwardItems M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task ForwardItems_RETURN_VALUE()
+ {
+ /* PRECONDITION */
+ TaskCompletionSource<bool> tcsFisrt = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedFirst = (s, e) => { tcsFisrt.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorFirst = (s, e) => { tcsFisrt.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedFirst;
+ _webView.LoadError += onLoadErrorFirst;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml1);
+ var result = await tcsFisrt.Task;
+
+ _webView.LoadFinished -= onLoadFinishedFirst;
+ _webView.LoadError -= onLoadErrorFirst;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the first page");
+
+ TaskCompletionSource<bool> tcsSecond = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedSecond = (s, e) => { tcsSecond.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorSecond = (s, e) => { tcsSecond.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedSecond;
+ _webView.LoadError += onLoadErrorSecond;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml2);
+ result = await tcsSecond.Task;
+
+ _webView.LoadFinished -= onLoadFinishedSecond;
+ _webView.LoadError -= onLoadErrorSecond;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the second page");
+
+ TaskCompletionSource<bool> tcsGoBack = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedGoBack = (s, e) => { tcsGoBack.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorGoBack = (s, e) => { tcsGoBack.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedGoBack;
+ _webView.LoadError += onLoadErrorGoBack;
+
+ _webView.GoBack();
+ result = await tcsGoBack.Task;
+
+ _webView.LoadFinished -= onLoadFinishedGoBack;
+ _webView.LoadError -= onLoadErrorGoBack;
+
+ Assert.IsTrue(result, "GoBack method failed");
+
+ /* TEST CODE */
+ var backforwardlist = _webView.GetBackForwardList();
+ Assert.IsInstanceOf<BackForwardList>(backforwardlist, "GetBackForwardList method failed");
+
+ var forwardItems = backforwardlist.ForwardItems(-1);
+ Assert.AreEqual(1, forwardItems.Count, "The count of forwardItems should be 1");
+ }
+ }
+}
--- /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 NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+
+namespace Tizen.WebView.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.WebView.BackForwardListItem Tests")]
+ class BackForwardListItemTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.BackForwardListItem Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.BackForwardListItem Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the url of Current Back Forward List Item")]
+ [Property("SPEC", "Tizen.WebView.BackForwardListItem.Url A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task Url_READ_ONLY()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ var backforwardlist = _webView.GetBackForwardList();
+ Assert.IsInstanceOf<BackForwardList>(backforwardlist, "GetBackForwardList method failed");
+
+ var currentItem = backforwardlist.CurrentItem;
+ Assert.IsInstanceOf<BackForwardListItem>(currentItem, "Get Current BackForwardListItem property failed");
+ Assert.AreEqual(WebViewCommon.SampleHtml, currentItem.Url, "URL should be same");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the original url of Current Back Forward List Item")]
+ [Property("SPEC", "Tizen.WebView.BackForwardListItem.OriginalUrl A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task OriginalUrl_READ_ONLY()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ var backforwardlist = _webView.GetBackForwardList();
+ Assert.IsInstanceOf<BackForwardList>(backforwardlist, "GetBackForwardList method failed");
+
+ var currentItem = backforwardlist.CurrentItem;
+ Assert.IsInstanceOf<BackForwardListItem>(currentItem, "Get Current BackForwardListItem property failed");
+ Assert.AreEqual(WebViewCommon.SampleHtml, currentItem.OriginalUrl, "Original URL should be same");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Title of Current Back Forward List Item")]
+ [Property("SPEC", "Tizen.WebView.BackForwardListItem.Title A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task Title_READ_ONLY()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ var backforwardlist = _webView.GetBackForwardList();
+ Assert.IsInstanceOf<BackForwardList>(backforwardlist, "GetBackForwardList method failed");
+
+ var currentItem = backforwardlist.CurrentItem;
+ Assert.IsInstanceOf<BackForwardListItem>(currentItem, "Get Current BackForwardListItem property failed");
+ Assert.AreEqual(WebViewCommon.SampleHtmlTitle, currentItem.Title, "Title should be same");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+
+namespace Tizen.WebView.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.WebView.Chromium Tests")]
+ public class ChromiumTests {
+ private static int _init = 0;
+ private static int _shutdown = 0;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.Chromium Tests");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.Chromium Tests");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Initializes Chromium's instance")]
+ [Property("SPEC", "Tizen.WebView.Chromium.Initialize M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void Initialize_RETURN_VALUE()
+ {
+ _init = Chromium.Initialize();
+ Assert.IsTrue(_init > 0, "Initialize method failed, reference count: " + _init);
+
+ _shutdown = Chromium.Shutdown();
+ Assert.AreEqual(_shutdown, _init - 1, "Shutdown method failed, Initialize: " + _init + " Shutdown: " + _shutdown);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Shutdown Chromium's instance")]
+ [Property("SPEC", "Tizen.WebView.Chromium.Shutdown M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void Shutdown_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ _init = Chromium.Initialize();
+ Assert.IsTrue(_init > 0, "Initialize method failed, reference count: " + _init);
+
+ _shutdown = Chromium.Shutdown();
+ Assert.AreEqual(_shutdown, _init - 1, "Shutdown method failed, Initialize: " + _init + " Shutdown: " + _shutdown);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+
+namespace Tizen.WebView.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.WebView.Context Tests")]
+ public class ContextTests {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.Context Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.Context Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Checks default cache model for the context")]
+ [Property("SPEC", "Tizen.WebView.Context.CacheModel A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PDV")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void CacheModel_CHECK_DEFAULT()
+ {
+ /* TEST CODE */
+ var context = _webView.GetContext();
+ Assert.IsInstanceOf<Context>(context, "GetContext method failed");
+
+ Assert.IsInstanceOf<CacheModel>(context.CacheModel);
+ Assert.AreEqual((int)CacheModel.DocumentViewer, (int)context.CacheModel, "Default cache model should be DocumentViewer");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets and sets cache model for the context")]
+ [Property("SPEC", "Tizen.WebView.Context.CacheModel A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW, PRE")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void CacheModel_GET_SET_ALL()
+ {
+ /* TEST CODE */
+ var context = _webView.GetContext();
+ Assert.IsInstanceOf<Context>(context, "GetContext method failed");
+
+ context.CacheModel = CacheModel.DocumentViewer;
+ Assert.IsInstanceOf<CacheModel>(context.CacheModel);
+ Assert.AreEqual((int)CacheModel.DocumentViewer, (int)context.CacheModel, "CacheModel should be DocumentViewer");
+
+ context.CacheModel = CacheModel.DocumentBrowser;
+ Assert.IsInstanceOf<CacheModel>(context.CacheModel);
+ Assert.AreEqual((int)CacheModel.DocumentBrowser, (int)context.CacheModel, "CacheModel should be DocumentBrowser");
+
+ context.CacheModel = CacheModel.PrimaryWebBrowser;
+ Assert.IsInstanceOf<CacheModel>(context.CacheModel);
+ Assert.AreEqual((int)CacheModel.PrimaryWebBrowser, (int)context.CacheModel, "CacheModel should be PrimaryWebBrowser");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets cookie manager instance for the context")]
+ [Property("SPEC", "Tizen.WebView.Context.GetCookieManager M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void GetCookieManager_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ var context = _webView.GetContext();
+ Assert.IsInstanceOf<Context>(context, "GetContext method failed");
+
+ var cookieManager = context.GetCookieManager();
+ Assert.IsInstanceOf<CookieManager>(cookieManager, "GetCookieManager method failed");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Clears the resource cache for the context")]
+ [Property("SPEC", "Tizen.WebView.Context.ClearResourceCache M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public void ClearResourceCache_CHANGE_STATUS()
+ {
+ /* TEST CODE */
+ var context = _webView.GetContext();
+ Assert.IsInstanceOf<Context>(context, "GetContext method failed");
+
+ try
+ {
+ context.ClearResourceCache();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+
+namespace Tizen.WebView.Tests
+{
+ [TestFixture]
+ [Description("Tizen.WebView.CookieManager Tests")]
+ public class CookieManagerTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.CookieManager Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.CookieManager Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets the cookie acceptance policy")]
+ [Property("SPEC", "Tizen.WebView.CookieManager.SetCookieAcceptPolicy M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MAE")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void SetCookieAcceptPolicy_ENUM_ALL()
+ {
+ /* TEST CODE */
+ var cookieManager = _webView.GetContext().GetCookieManager();
+ Assert.IsNotNull(cookieManager, "GetCookieManager returns NULL");
+ Assert.IsInstanceOf<CookieManager>(cookieManager, "GetCookieManager method failed");
+
+ // TODO: GetCookieAcceptPolicyAsync is not implemented yet.
+ // Need verification after we've implemented it.
+ try
+ {
+ cookieManager.SetCookieAcceptPolicy(CookieAcceptPolicy.Always);
+
+ cookieManager.SetCookieAcceptPolicy(CookieAcceptPolicy.Never);
+
+ cookieManager.SetCookieAcceptPolicy(CookieAcceptPolicy.NoThirdParty);
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Deletes all the cookies of a manager")]
+ [Property("SPEC", "Tizen.WebView.CookieManager.ClearCookies M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task ClearCookies_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.TestUrl);
+ await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(tcs.Task.Result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ var cookieManager = _webView.GetContext().GetCookieManager();
+ Assert.IsNotNull(cookieManager, "GetCookieManager returns NULL");
+ Assert.IsInstanceOf<CookieManager>(cookieManager, "GetCookieManager method failed");
+
+ try
+ {
+ cookieManager.ClearCookies();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets the storage where non-session cookies are stored persistently")]
+ [Property("SPEC", "Tizen.WebView.CookieManager.SetPersistentStorage M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MAE")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void SetPersistentStorage_ENUM_ALL()
+ {
+ /* TEST CODE */
+ var cookieManager = _webView.GetContext().GetCookieManager();
+ Assert.IsInstanceOf<CookieManager>(cookieManager, "GetCookieManager method failed");
+ string path = Applications.Application.Current.DirectoryInfo.Data + "mycookiestoragedir";
+
+ try
+ {
+ cookieManager.SetPersistentStorage(path, CookiePersistentStorage.Text);
+
+ cookieManager.SetPersistentStorage(path, CookiePersistentStorage.SqlLite);
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+
+namespace Tizen.WebView.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.WebView.JavaScriptMessage Tests")]
+ public class JavaScriptMessageTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.JavaScriptMessage Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.JavaScriptMessage Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the name of JavaScript message")]
+ [Property("SPEC", "Tizen.WebView.JavaScriptMessage.Name A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Name_READ_ONLY()
+ {
+ /* TEST CODE */
+ 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;
+
+ TaskCompletionSource<bool> tcsForCallback = new TaskCompletionSource<bool>(false);
+ JavaScriptMessageHandler handler = (message) =>
+ {
+ if (message.Name is string && message.Name.Equals("MyJavaScriptInterfaceForName"))
+ {
+ tcsForCallback.TrySetResult(true);
+ }
+ tcsForCallback.TrySetResult(false);
+ };
+ _webView.AddJavaScriptMessageHandler("MyJavaScriptInterfaceForName", handler);
+
+ _webView.LoadUrl(WebViewCommon.AddJavaScriptInterfaceSampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ _webView.Eval("callForName();");
+ result = await tcsForCallback.Task;
+
+ Assert.IsTrue(result, "JavaScript handler should be invoked with valid name");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the body of JavaScript message as integer type")]
+ [Property("SPEC", "Tizen.WebView.JavaScriptMessage.GetBodyAsInteger M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task GetBodyAsInteger_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ 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;
+
+ TaskCompletionSource<bool> tcsForCallback = new TaskCompletionSource<bool>(false);
+ JavaScriptMessageHandler handler = (message) =>
+ {
+ if (message.Name.Equals("MyJavaScriptInterfaceWithInteger"))
+ {
+ var body = message.GetBodyAsInteger();
+ if (body.GetType() == typeof(int) && body == 10)
+ {
+ tcsForCallback.TrySetResult(true);
+ }
+ }
+ tcsForCallback.TrySetResult(false);
+ };
+ _webView.AddJavaScriptMessageHandler("MyJavaScriptInterfaceWithInteger", handler);
+
+ _webView.LoadUrl(WebViewCommon.AddJavaScriptInterfaceSampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ _webView.Eval("callWithInteger();");
+ result = await tcsForCallback.Task;
+
+ Assert.IsTrue(result, "GetBodyAsInteger should return valid body value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the body of JavaScript message as double type")]
+ [Property("SPEC", "Tizen.WebView.JavaScriptMessage.GetBodyAsDouble M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task GetBodyAsDouble_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ 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;
+
+ TaskCompletionSource<bool> tcsForCallback = new TaskCompletionSource<bool>(false);
+ JavaScriptMessageHandler handler = (message) =>
+ {
+ if (message.Name.Equals("MyJavaScriptInterfaceWithDouble"))
+ {
+ var body = message.GetBodyAsDouble();
+ if (body.GetType() == typeof(double) && body == 0.1)
+ {
+ tcsForCallback.TrySetResult(true);
+ }
+ }
+ tcsForCallback.TrySetResult(false);
+ };
+ _webView.AddJavaScriptMessageHandler("MyJavaScriptInterfaceWithDouble", handler);
+
+ _webView.LoadUrl(WebViewCommon.AddJavaScriptInterfaceSampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ _webView.Eval("callWithDouble();");
+ result = await tcsForCallback.Task;
+
+ Assert.IsTrue(result, "GetBodyAsDouble should return valid body value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the body of JavaScript message as boolean type")]
+ [Property("SPEC", "Tizen.WebView.JavaScriptMessage.GetBodyAsBoolean M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task GetBodyAsBoolean_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ 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;
+
+ TaskCompletionSource<bool> tcsForCallback = new TaskCompletionSource<bool>(false);
+ JavaScriptMessageHandler handler = (message) =>
+ {
+ if (message.Name.Equals("MyJavaScriptInterfaceWithBoolean"))
+ {
+ var body = message.GetBodyAsBoolean();
+ if (body.GetType() == typeof(bool) && body == true)
+ {
+ tcsForCallback.TrySetResult(true);
+ }
+ }
+ tcsForCallback.TrySetResult(false);
+ };
+ _webView.AddJavaScriptMessageHandler("MyJavaScriptInterfaceWithBoolean", handler);
+
+ _webView.LoadUrl(WebViewCommon.AddJavaScriptInterfaceSampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ _webView.Eval("callWithBoolean();");
+ result = await tcsForCallback.Task;
+
+ Assert.IsTrue(result, "GetBodyAsBoolean should return valid body value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the body of JavaScript message as string type")]
+ [Property("SPEC", "Tizen.WebView.JavaScriptMessage.GetBodyAsString M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task GetBodyAsString_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ 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;
+
+ TaskCompletionSource<bool> tcsForCallback = new TaskCompletionSource<bool>(false);
+ JavaScriptMessageHandler handler = (message) =>
+ {
+ if (message.Name.Equals("MyJavaScriptInterfaceWithString"))
+ {
+ var body = message.GetBodyAsString();
+ if (body.GetType() == typeof(string) && body.Equals("Test message"))
+ {
+ tcsForCallback.TrySetResult(true);
+ }
+ }
+ tcsForCallback.TrySetResult(false);
+ };
+ _webView.AddJavaScriptMessageHandler("MyJavaScriptInterfaceWithString", handler);
+
+ _webView.LoadUrl(WebViewCommon.AddJavaScriptInterfaceSampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ _webView.Eval("callWithString();");
+ result = await tcsForCallback.Task;
+
+ Assert.IsTrue(result, "GetBodyAsString should return valid body value");
+ }
+ }
+}
--- /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 NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.WebView.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.WebView.NavigationPolicyEventArgs Tests")]
+ class NavigationPolicyEventArgsTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.NavigationPolicyEventArgs Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.NavigationPolicyEventArgs Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Cookie of Navigation Policy event")]
+ [Property("SPEC", "Tizen.WebView.NavigationPolicyEventArgs.Cookie A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Cookie_READ_ONLY()
+ {
+ /* TEST CODE */
+ string cookie = string.Empty;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ cookie = e.Cookie;
+ cookie = cookie.Replace(WebViewCommon.HeaderTerminator, "");
+ e.Use();
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ var httpHeaders = new Dictionary<string, string>();
+ httpHeaders.Add("Cookie", WebViewCommon.TestCookie);
+ _webView.SetUrlRequest(WebViewCommon.TestUrl, HttpMethod.Get, httpHeaders, null);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ Assert.AreEqual(WebViewCommon.TestCookie, cookie, "Cookie should be valid string object");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Checks whether the NavigationType of Navigation Policy event is NavigationType.Other")]
+ [Property("SPEC", "Tizen.WebView.NavigationPolicyEventArgs.NavigationType A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRE")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task NavigationType_GET_OTHER()
+ {
+ /* TEST CODE */
+ NavigationType type = NavigationType.BackForward;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ type = e.NavigationType;
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ Assert.AreEqual(NavigationType.Other, type, "NavigationType should be NavigationType.Other");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Checks whether the NavigationType of Navigation Policy event is NavigationType.BackForward")]
+ [Property("SPEC", "Tizen.WebView.NavigationPolicyEventArgs.NavigationType A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRE")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task NavigationType_GET_BACKFOWARD()
+ {
+ /* PRECONDITION */
+ TaskCompletionSource<bool> tcsFisrt = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedFirst = (s, e) => { tcsFisrt.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorFirst = (s, e) => { tcsFisrt.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedFirst;
+ _webView.LoadError += onLoadErrorFirst;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml1);
+ var result = await tcsFisrt.Task;
+
+ _webView.LoadFinished -= onLoadFinishedFirst;
+ _webView.LoadError -= onLoadErrorFirst;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the first page");
+
+ TaskCompletionSource<bool> tcsSecond = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedSecond = (s, e) => { tcsSecond.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorSecond = (s, e) => { tcsSecond.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedSecond;
+ _webView.LoadError += onLoadErrorSecond;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml2);
+ result = await tcsSecond.Task;
+
+ _webView.LoadFinished -= onLoadFinishedSecond;
+ _webView.LoadError -= onLoadErrorSecond;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the second page");
+
+ /* TEST CODE */
+ NavigationType type = NavigationType.Other;
+ TaskCompletionSource<bool> tcsGoBack = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedGoBack = (s, e) => { tcsGoBack.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorGoBack = (s, e) => { tcsGoBack.TrySetResult(false); };
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ type = e.NavigationType;
+ };
+
+ _webView.LoadFinished += onLoadFinishedGoBack;
+ _webView.LoadError += onLoadErrorGoBack;
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ _webView.GoBack();
+ result = await tcsGoBack.Task;
+
+ _webView.LoadFinished -= onLoadFinishedGoBack;
+ _webView.LoadError -= onLoadErrorGoBack;
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "GoBack method failed");
+ Assert.AreEqual(NavigationType.BackForward, type, "NavigationType should be NavigationType.BackForward");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Checks whether the NavigationType of Navigation Policy event is NavigationType.Reload")]
+ [Property("SPEC", "Tizen.WebView.NavigationPolicyEventArgs.NavigationType A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRE")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task NavigationType_GET_RELOAD()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml1);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ NavigationType type = NavigationType.Other;
+ TaskCompletionSource<bool> tcsReload = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedReload = (s, e) => { tcsReload.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorReload = (s, e) => { tcsReload.TrySetResult(false); };
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ type = e.NavigationType;
+ };
+
+ _webView.LoadFinished += onLoadFinishedReload;
+ _webView.LoadError += onLoadErrorReload;
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ _webView.Reload();
+ result = await tcsReload.Task;
+
+ _webView.LoadFinished -= onLoadFinishedReload;
+ _webView.LoadError -= onLoadErrorReload;
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "Reload method failed");
+ Assert.AreEqual(NavigationType.Reload, type, "NavigationType should be NavigationType.Reload");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Checks whether the NavigationType of Navigation Policy event is NavigationType.LinkClicked")]
+ [Property("SPEC", "Tizen.WebView.NavigationPolicyEventArgs.NavigationType A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRE")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task NavigationType_GET_LINKCLICKED()
+ {
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ if (e.NavigationType == NavigationType.LinkClicked)
+ {
+ tcs.TrySetResult(true);
+ }
+ };
+
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.LinkClickSampleHtml);
+ var result = await tcs.Task;
+
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "NavigationType should be NavigationType.LinkClicked");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Checks whether the NavigationType of Navigation Policy event is NavigationType.FormSubmitted")]
+ [Property("SPEC", "Tizen.WebView.NavigationPolicyEventArgs.NavigationType A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRE")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task NavigationType_GET_FORMSUBMITTED()
+ {
+ /* PRECONDITION */
+ TaskCompletionSource<bool> tcsForm = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedForm = (s, e) => { tcsForm.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorForm = (s, e) => { tcsForm.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedForm;
+ _webView.LoadError += onLoadErrorForm;
+
+ _webView.LoadUrl(WebViewCommon.FormSubmitSampleHtml);
+ var result = await tcsForm.Task;
+
+ _webView.LoadFinished -= onLoadFinishedForm;
+ _webView.LoadError -= onLoadErrorForm;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ if (e.NavigationType == NavigationType.FormSubmitted)
+ {
+ tcs.TrySetResult(true);
+ }
+ };
+
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ _webView.Eval("submitForm()");
+ result = await tcs.Task;
+
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "NavigationType should be NavigationType.FormSubmitted");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Checks whether the NavigationType of Navigation Policy event is NavigationType.FormResubmitted")]
+ [Property("SPEC", "Tizen.WebView.NavigationPolicyEventArgs.NavigationType A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRE")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task NavigationType_GET_FORMRESUBMITTED()
+ {
+ /* PRECONDITION */
+ TaskCompletionSource<bool> tcsForm = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedForm = (s, e) => { tcsForm.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorForm = (s, e) => { tcsForm.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedForm;
+ _webView.LoadError += onLoadErrorForm;
+
+ _webView.LoadUrl(WebViewCommon.FormSubmitSampleHtml);
+ var result = await tcsForm.Task;
+
+ _webView.LoadFinished -= onLoadFinishedForm;
+ _webView.LoadError -= onLoadErrorForm;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ TaskCompletionSource<bool> tcsEval = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedEval = (s, e) => { tcsEval.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorEval = (s, e) => { tcsEval.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedEval;
+ _webView.LoadError += onLoadErrorEval;
+
+ _webView.Eval("submitForm()");
+ result = await tcsEval.Task;
+
+ _webView.LoadFinished -= onLoadFinishedEval;
+ _webView.LoadError -= onLoadErrorEval;
+
+ Assert.IsTrue(result, "Eval method failed");
+
+ TaskCompletionSource<bool> tcsGoBack = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedGoBack = (s, e) => { tcsGoBack.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorGoBack = (s, e) => { tcsGoBack.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedGoBack;
+ _webView.LoadError += onLoadErrorGoBack;
+
+ _webView.GoBack();
+ result = await tcsGoBack.Task;
+
+ _webView.LoadFinished -= onLoadFinishedGoBack;
+ _webView.LoadError -= onLoadErrorGoBack;
+
+ Assert.IsTrue(result, "GoBack method failed");
+
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ Log.Debug("TCT", "NavigationType: " + e.NavigationType.ToString());
+ if (e.NavigationType == NavigationType.FormResubmitted)
+ {
+ tcs.TrySetResult(true);
+ }
+ };
+
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ _webView.GoForward();
+ result = await tcs.Task;
+
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "NavigationType should be NavigationType.FormResubmitted");
+ }
+ }
+}
--- /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 NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+
+namespace Tizen.WebView.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.WebView.PolicyDecisionEventArgs Tests")]
+ public class PolicyDecisionEventArgsTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.PolicyDecisionEventArgs Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.PolicyDecisionEventArgs Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Ask to ignore the current Policy Decision event")]
+ [Property("SPEC", "Tizen.WebView.PolicyDecisionEventArgs.Ignore M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Ignore_CHANGE_STATUS()
+ {
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ try
+ {
+ e.Ignore();
+ }
+ catch
+ {
+ tcs.TrySetResult(false);
+ }
+ tcs.TrySetResult(true);
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "Page loading should be finished without any error");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Ask to use the current Policy Decision event")]
+ [Property("SPEC", "Tizen.WebView.PolicyDecisionEventArgs.Use M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Use_CHANGE_STATUS()
+ {
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ try
+ {
+ e.Use();
+ }
+ catch
+ {
+ tcs.TrySetResult(false);
+ }
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "Page loading should be finished without any error");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Scheme of Policy Decision event")]
+ [Property("SPEC", "Tizen.WebView.PolicyDecisionEventArgs.Scheme A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Scheme_READ_ONLY()
+ {
+ /* TEST CODE */
+ string scheme = string.Empty;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ scheme = e.Scheme;
+ e.Use();
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ Assert.AreEqual(WebViewCommon.FileScheme, scheme, "Scheme should be valid string object");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Url of Policy Decision event")]
+ [Property("SPEC", "Tizen.WebView.PolicyDecisionEventArgs.Url A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Url_READ_ONLY()
+ {
+ /* TEST CODE */
+ string url = string.Empty;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ url = e.Url;
+ e.Use();
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ Assert.AreEqual(WebViewCommon.SampleHtml, url, "Url should be valid string object");
+ }
+ }
+}
--- /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 NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+
+namespace Tizen.WebView.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.WebView.ResponsePolicyEventArgs Tests")]
+ class ResponsePolicyEventArgsTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.ResponsePolicyEventArgs Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.ResponsePolicyEventArgs Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Cookie of Response Policy event")]
+ [Property("SPEC", "Tizen.WebView.ResponsePolicyEventArgs.Cookie A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Cookie_READ_ONLY()
+ {
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<ResponsePolicyEventArgs> onResponsePolicyDecide = (s, e) =>
+ {
+ var cookie = e.Cookie;
+ if (cookie.GetType() != typeof(string))
+ {
+ tcs.TrySetResult(false);
+ }
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.ResponsePolicyDecideRequested += onResponsePolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.TestUrl);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.ResponsePolicyDecideRequested -= onResponsePolicyDecide;
+
+ Assert.IsTrue(result, "Cookie should be valid string object");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the IsDownload of Response Policy event")]
+ [Property("SPEC", "Tizen.WebView.ResponsePolicyEventArgs.IsDownload A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task IsDownload_READ_ONLY()
+ {
+ /* TEST CODE */
+ bool isDownload = true;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<ResponsePolicyEventArgs> onResponsePolicyDecide = (s, e) =>
+ {
+ isDownload = e.IsDownload;
+ e.Use();
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.ResponsePolicyDecideRequested += onResponsePolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.ResponsePolicyDecideRequested -= onResponsePolicyDecide;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ Assert.IsFalse(isDownload, "IsDownload should be false");
+
+ TaskCompletionSource<bool> tcsDownload = new TaskCompletionSource<bool>(false);
+ EventHandler<ResponsePolicyEventArgs> onResponsePolicyDecideDownload = (s, e) =>
+ {
+ isDownload = e.IsDownload;
+ e.Use();
+ tcsDownload.TrySetResult(true);
+ };
+
+ _webView.ResponsePolicyDecideRequested += onResponsePolicyDecideDownload;
+
+ _webView.LoadUrl(WebViewCommon.TestUrlForDownload);
+ result = await tcsDownload.Task;
+
+ _webView.ResponsePolicyDecideRequested -= onResponsePolicyDecideDownload;
+
+ Assert.IsTrue(result, "ResponsePolicyDecideRequested should be invoked");
+ Assert.IsTrue(isDownload, "IsDownload should be true");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the StatusCode of Response Policy event")]
+ [Property("SPEC", "Tizen.WebView.ResponsePolicyEventArgs.StatusCode A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task StatusCode_READ_ONLY()
+ {
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<ResponsePolicyEventArgs> onResponsePolicyDecide = (s, e) =>
+ {
+ if (e.StatusCode != 200)
+ {
+ tcs.TrySetResult(false);
+ }
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.ResponsePolicyDecideRequested += onResponsePolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.TestUrl);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.ResponsePolicyDecideRequested -= onResponsePolicyDecide;
+
+ Assert.IsTrue(result, "StatusCode should be 200 OK");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+
+namespace Tizen.WebView.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.WebView.Settings Tests")]
+ public class SettingsTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.Settings Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.Settings Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets and sets whether JavaScript can be executable")]
+ [Property("SPEC", "Tizen.WebView.Settings.JavaScriptEnabled A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void JavaScriptEnabled_READ_WRITE()
+ {
+ /* TEST CODE */
+ var settings = _webView.GetSettings();
+ Assert.IsInstanceOf<Settings>(settings, "GetSettings method failed");
+
+
+ settings.JavaScriptEnabled = false;
+ Assert.IsFalse(settings.JavaScriptEnabled, "Fail to get/set JavaScriptEnabled as false");
+
+ settings.JavaScriptEnabled = true;
+ Assert.IsTrue(settings.JavaScriptEnabled, "Fail to get/set JavaScriptEnabled as true");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets and sets whether images can be loaded automatically")]
+ [Property("SPEC", "Tizen.WebView.Settings.LoadImageAutomatically A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void LoadImageAutomatically_READ_WRITE()
+ {
+ /* TEST CODE */
+ var settings = _webView.GetSettings();
+ Assert.IsInstanceOf<Settings>(settings, "GetSettings method failed");
+
+ settings.LoadImageAutomatically = true;
+ Assert.IsTrue(settings.LoadImageAutomatically, "Fail to get/set LoadImageAutomatically");
+
+ settings.LoadImageAutomatically = false;
+ Assert.IsFalse(settings.LoadImageAutomatically, "Fail to get/set LoadImageAutomatically");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets and sets default text encoding name")]
+ [Property("SPEC", "Tizen.WebView.Settings.DefaultTextEncodingName A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void DefaultTextEncodingName_READ_WRITE()
+ {
+ /* TEST CODE */
+ var settings = _webView.GetSettings();
+ Assert.IsInstanceOf<Settings>(settings, "GetSettings method failed");
+
+ const string encodingName = "utf-8";
+ settings.DefaultTextEncodingName = encodingName;
+ Assert.True(settings.DefaultTextEncodingName.Length > 0, "Fail to get/set DefaultTextEncodingName");
+ Assert.AreEqual(encodingName, settings.DefaultTextEncodingName, "Fail to get/set DefaultTextEncodingName");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets and sets default font size of a pixel")]
+ [Property("SPEC", "Tizen.WebView.Settings.DefaultFontSize A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void DefaultFontSize_READ_WRITE()
+ {
+ /* TEST CODE */
+ var settings = _webView.GetSettings();
+ Assert.IsInstanceOf<Settings>(settings, "GetSettings method failed");
+
+ const int fontSize = 10;
+ settings.DefaultFontSize = fontSize;
+ Assert.AreEqual(fontSize, settings.DefaultFontSize, "Fail to get/set DefaultFontSize");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets and sets scripts can open windows")]
+ [Property("SPEC", "Tizen.WebView.Settings.ScriptsCanOpenWindows A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public void ScriptsCanOpenWindows_READ_WRITE()
+ {
+ /* TEST CODE */
+ var settings = _webView.GetSettings();
+ Assert.IsInstanceOf<Settings>(settings, "GetSettings method failed");
+
+ settings.ScriptsCanOpenWindows = true;
+ Assert.IsTrue(settings.ScriptsCanOpenWindows, "Fail to get/set ScriptCanOpenWindows");
+
+ settings.ScriptsCanOpenWindows = false;
+ Assert.IsFalse(settings.ScriptsCanOpenWindows, "Fail to get/set ScriptCanOpenWindows");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+
+namespace Tizen.WebView.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.WebView.SmartCallbackArgs Tests")]
+ public class SmartCallbackArgsTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.SmartCallbackArgs Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.SmartCallbackArgs Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the parameter of callback as boolean type")]
+ [Property("SPEC", "Tizen.WebView.SmartCallbackArgs.GetAsBoolean M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task GetAsBoolean_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ bool arg = false;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler<SmartCallbackArgs> onTitleChanged = (s, e) => {
+ arg = e.GetAsBoolean();
+ };
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.TitleChanged += onTitleChanged;
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.TitleChanged -= onTitleChanged;
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ Assert.IsTrue(arg, "GetAsBoolean should return valid value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the parameter of callback as double type")]
+ [Property("SPEC", "Tizen.WebView.SmartCallbackArgs.GetAsDouble M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task GetAsDouble_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ double arg = 0d;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler<SmartCallbackArgs> onTitleChanged = (s, e) => {
+ arg = e.GetAsDouble();
+ };
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.TitleChanged += onTitleChanged;
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.TitleChanged -= onTitleChanged;
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ Assert.AreNotEqual(0d, arg, "GetAsDouble should return valid value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the parameter of callback as integer type")]
+ [Property("SPEC", "Tizen.WebView.SmartCallbackArgs.GetAsInteger M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task GetAsInteger_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ int arg = 0;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler<SmartCallbackArgs> onTitleChanged = (s, e) => {
+ arg = e.GetAsInteger();
+ };
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.TitleChanged += onTitleChanged;
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.TitleChanged -= onTitleChanged;
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ Assert.AreNotEqual(0, arg, "GetAsInteger should return valid value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the parameter of callback as string type")]
+ [Property("SPEC", "Tizen.WebView.SmartCallbackArgs.GetAsString M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task GetAsString_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ string arg = string.Empty;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler<SmartCallbackArgs> onTitleChanged = (s, e) => {
+ arg = e.GetAsString();
+ };
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.TitleChanged += onTitleChanged;
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.TitleChanged -= onTitleChanged;
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ Assert.AreEqual(WebViewCommon.SampleHtmlTitle, arg, "GetAsString should return valid value");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Threading.Tasks;
+
+namespace Tizen.WebView.Tests
+{
+
+ [TestFixture]
+ [Description("Tizen.WebView.SmartCallbackLoadErrorArgs Tests")]
+ public class SmartCallbackLoadErrorArgsTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.SmartCallbackLoadErrorArgs Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for Tizen.WebView.SmartCallbackLoadErrorArgs Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the URL of load error callback")]
+ [Property("SPEC", "Tizen.WebView.SmartCallbackLoadErrorArgs.Url A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Url_READ_ONLY()
+ {
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) =>
+ {
+ var url = e.Url;
+ if (url is string && url.Equals(WebViewCommon.TestUrlForError))
+ {
+ tcs.TrySetResult(true);
+ }
+ tcs.TrySetResult(false);
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.TestUrlForError);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "Url should be valid value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the error code of load error callback")]
+ [Property("SPEC", "Tizen.WebView.SmartCallbackLoadErrorArgs.Code A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Code_READ_ONLY()
+ {
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) =>
+ {
+ var code = e.Code;
+ if (code.GetType() == typeof(LoadErrorCode) && (code.Equals(LoadErrorCode.CantLookupHost) || code.Equals(LoadErrorCode.Unknown)))
+ {
+ tcs.TrySetResult(true);
+ }
+ tcs.TrySetResult(false);
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.TestUrlForError);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "Code should be valid value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the description of load error callback")]
+ [Property("SPEC", "Tizen.WebView.SmartCallbackLoadErrorArgs.Description A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Description_READ_ONLY()
+ {
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) =>
+ {
+ var description = e.Description;
+ if (description is string)
+ {
+ tcs.TrySetResult(true);
+ }
+ tcs.TrySetResult(false);
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.TestUrlForError);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "Description should be valid value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the cancellation or not of load error callback")]
+ [Property("SPEC", "Tizen.WebView.SmartCallbackLoadErrorArgs.Cancellation A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Cancellation_READ_ONLY()
+ {
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) =>
+ {
+ var cancellation = e.Cancellation;
+ if (cancellation.GetType() == typeof(bool))
+ {
+ tcs.TrySetResult(true);
+ }
+ tcs.TrySetResult(false);
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.TestUrlForError);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "Cancellation should be valid value");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using ElmSharp;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Tizen.WebView.Tests
+{
+ [TestFixture]
+ [Description("Tizen.WebView.WebView Tests")]
+ public class WebViewTests
+ {
+ private WebView _webView;
+
+ [SetUp]
+ public void Init()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for Tizen.WebView.WebView Tests");
+ _webView = new WebView(WebViewCommon.GetMainWindow());
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions forTizen.WebView.WebView Tests");
+ _webView = null;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Event that occurs when load started")]
+ [Property("SPEC", "Tizen.WebView.WebView.LoadStarted E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task LoadStarted_CHECK_EVENT()
+ {
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadStarted = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.LoadStarted += onLoadStarted;
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadStarted -= onLoadStarted;
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadStarted event should be invoked");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Event that occurs when load finished")]
+ [Property("SPEC", "Tizen.WebView.WebView.LoadFinished E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task LoadFinished_CHECK_EVENT()
+ {
+ /* TEST CODE */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadFinished event should be invoked");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Event that occurs when load error")]
+ [Property("SPEC", "Tizen.WebView.WebView.LoadError E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task LoadError_CHECK_EVENT()
+ {
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(true); };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.TestUrlForError);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadError event should be invoked");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Event that occurs when title of main frame was changed")]
+ [Property("SPEC", "Tizen.WebView.WebView.TitleChanged E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task TitleChanged_CHECK_EVENT()
+ {
+ /* TEST CODE */
+ string title = string.Empty;
+ EventHandler<SmartCallbackArgs> onTitleChanged = (s, e) => {
+ title = e.GetAsString();
+ };
+
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.TitleChanged += onTitleChanged;
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.TitleChanged -= onTitleChanged;
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ Assert.AreEqual(_webView.Title, title, "Received title should be same with WebView.Title");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Event that occurs when navigation policy decide requested")]
+ [Property("SPEC", "Tizen.WebView.WebView.NavigationPolicyDecideRequested E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task NavigationPolicyDecideRequested_CHECK_EVENT()
+ {
+ /* TEST CODE */
+ bool occurred = false;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<NavigationPolicyEventArgs> onNavigationPolicyDecide = (s, e) =>
+ {
+ try
+ {
+ occurred = true;
+ e.Use();
+ }
+ catch
+ {
+ tcs.TrySetResult(false);
+ }
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.NavigationPolicyDecideRequested += onNavigationPolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.NavigationPolicyDecideRequested -= onNavigationPolicyDecide;
+
+ Assert.IsTrue(result, "Page loading should be finished without any error");
+ Assert.IsTrue(occurred, "Event should be occured");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Event that occurs when response policy decide requested")]
+ [Property("SPEC", "Tizen.WebView.WebView.ResponsePolicyDecideRequested E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task ResponsePolicyDecideRequested_CHECK_EVENT()
+ {
+ /* TEST CODE */
+ bool occurred = false;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<ResponsePolicyEventArgs> onResponsePolicyDecide = (s, e) =>
+ {
+ try
+ {
+ occurred = true;
+ e.Use();
+ }
+ catch
+ {
+ tcs.TrySetResult(false);
+ }
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.ResponsePolicyDecideRequested += onResponsePolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.ResponsePolicyDecideRequested -= onResponsePolicyDecide;
+
+ Assert.IsTrue(result, "Page loading should be finished without any error");
+ Assert.IsTrue(occurred, "Event should be occured");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Event that occurs when new window policy decide requested")]
+ [Property("SPEC", "Tizen.WebView.WebView.NewWindowPolicyDecideRequested E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task NewWindowPolicyDecideRequested_CHECK_EVENT()
+ {
+ /* TEST CODE */
+ bool occurred = false;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<NewWindowPolicyEventArgs> onNewWindowPolicyDecide = (s, e) =>
+ {
+ try
+ {
+ occurred = true;
+ e.Use();
+ }
+ catch
+ {
+ tcs.TrySetResult(false);
+ }
+ };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+ _webView.NewWindowPolicyDecideRequested += onNewWindowPolicyDecide;
+
+ _webView.LoadUrl(WebViewCommon.WindowOpenSampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+ _webView.NewWindowPolicyDecideRequested -= onNewWindowPolicyDecide;
+
+ Assert.IsTrue(result, "Page loading should be finished without any error");
+ Assert.IsTrue(occurred, "Event should be occured");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Event that occurs when URL of main frame was changed")]
+ [Property("SPEC", "Tizen.WebView.WebView.UrlChanged E")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "EVL")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task UrlChanged_CHECK_EVENT()
+ {
+ /* TEST CODE */
+ string url = string.Empty;
+ EventHandler<SmartCallbackArgs> onUrlChanged = (s, e) => {
+ url = e.GetAsString();
+ };
+
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.UrlChanged += onUrlChanged;
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.UrlChanged -= onUrlChanged;
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ Assert.AreEqual(_webView.Url, url, "Received URL should be same with WebView.Url");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets current URL of the main frame")]
+ [Property("SPEC", "Tizen.WebView.WebView.Url A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Url_READ_ONLY()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ var url = _webView.Url;
+ Assert.IsInstanceOf<string>(url, "Get Url should return object string");
+ Assert.AreEqual(WebViewCommon.SampleHtml, url, "Fail to get Url should return valid url");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets current title of the main frame")]
+ [Property("SPEC", "Tizen.WebView.WebView.Title A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Title_READ_ONLY()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ var title = _webView.Title;
+ Assert.IsInstanceOf<string>(title, "Get Title should return object string");
+ Assert.AreEqual(WebViewCommon.SampleHtmlTitle, title, "Get Title should return valid title");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets and sets user agent string of this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.UserAgent A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void UserAgent_READ_WRITE()
+ {
+ /* TEST CODE */
+ _webView.UserAgent = WebViewCommon.TestUserAgent;
+ var userAgent = _webView.UserAgent;
+ Assert.IsInstanceOf<string>(userAgent, "Get UserAgent should return object string");
+ Assert.AreEqual(WebViewCommon.TestUserAgent, userAgent, "Get UserAgent should return valid user agent");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Checks whether a view has the focus")]
+ [Property("SPEC", "Tizen.WebView.WebView.HasFocus A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task HasFocus_READ_ONLY()
+ {
+ /* PRECONDITION */
+
+
+ /* TEST CODE */
+ var hasFocus = _webView.HasFocus;
+ Assert.IsInstanceOf<bool>(hasFocus, "Get HasFocus should return object bool");
+ Assert.IsFalse(hasFocus, "HasFocus should be false before load content");
+
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinished = (s, e) =>
+ {
+ _webView.SetFocus(true);
+ tcs.TrySetResult(true);
+ };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ hasFocus = _webView.HasFocus;
+ Assert.IsInstanceOf<bool>(hasFocus, "Get HasFocus should return object bool");
+ Assert.IsTrue(hasFocus, "HasFocus should be true after load content");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Create a WebView object")]
+ [Property("SPEC", "Tizen.WebView.WebView.WebView C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void WebView_INIT_WITH_PARENT()
+ {
+ /* TEST CODE */
+ var webView = new WebView(WebViewCommon.GetMainWindow());
+ Assert.IsNotNull(webView, "WebView object is null after initialization");
+ Assert.IsInstanceOf<WebView>(webView, "Should return WebView instance");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Context object of this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.GetContext M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void GetContext_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ var context = _webView.GetContext();
+ Assert.IsInstanceOf<Context>(context, "GetContext method failed");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Settings object of this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.GetSettings M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public void GetSettings_RETURN_VALUE()
+ {
+ /* TEST CODE */
+ var settings = _webView.GetSettings();
+ Assert.IsInstanceOf<Settings>(settings, "GetSettings method failed");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the BackForwardList object of this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.GetBackForwardList M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task GetBackForwardList_RETURN_VALUE()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ var backforwardlist = _webView.GetBackForwardList();
+ Assert.IsInstanceOf<BackForwardList>(backforwardlist, "GetBackForwardList method failed");
+
+ var currentItem = backforwardlist.CurrentItem;
+ Assert.IsInstanceOf<BackForwardListItem>(currentItem, "Get Current BackForwardListItem property failed");
+ Assert.AreEqual(WebViewCommon.SampleHtml, currentItem.Url, "URL should be same");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Clears the BackForwardList of this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.ClearBackForwardList M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task ClearBackForwardList_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ TaskCompletionSource<bool> tcsFisrt = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedFirst = (s, e) => { tcsFisrt.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorFirst = (s, e) => { tcsFisrt.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedFirst;
+ _webView.LoadError += onLoadErrorFirst;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml1);
+ var result = await tcsFisrt.Task;
+
+ _webView.LoadFinished -= onLoadFinishedFirst;
+ _webView.LoadError -= onLoadErrorFirst;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the first page");
+
+ TaskCompletionSource<bool> tcsSecond = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedSecond = (s, e) => { tcsSecond.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorSecond = (s, e) => { tcsSecond.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedSecond;
+ _webView.LoadError += onLoadErrorSecond;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml2);
+ result = await tcsSecond.Task;
+
+ _webView.LoadFinished -= onLoadFinishedSecond;
+ _webView.LoadError -= onLoadErrorSecond;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the second page");
+
+ /* TEST CODE */
+ _webView.ClearBackForwardList();
+
+ var backForwardList = _webView.GetBackForwardList();
+ Assert.IsInstanceOf<BackForwardList>(backForwardList, "GetBackForwardList method failed");
+ Assert.AreEqual(1, backForwardList.Count, "Fail to Clear BackForwardList");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Asks the object to load the given URL")]
+ [Property("SPEC", "Tizen.WebView.WebView.LoadUrl M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task LoadUrl_CHANGE_STATUS()
+ {
+ /* TEST CODE */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Loads the specified html string as the content of the view")]
+ [Property("SPEC", "Tizen.WebView.WebView.LoadHtml M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task LoadHtml_CHANGE_STATUS()
+ {
+ /* TEST CODE */
+ 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.LoadHtml(WebViewCommon.TestHtml, WebViewCommon.TestUrl);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadHtml method failed");
+ Assert.AreEqual(WebViewCommon.TestUrl, _webView.Title, "Title should be same with base URL");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Asks the main frame to stop loading")]
+ [Property("SPEC", "Tizen.WebView.WebView.StopLoading M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task StopLoading_CHANGE_STATUS()
+ {
+ /* TEST CODE */
+ var isCancellation = false;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadStarted = (s, e) => { _webView.StopLoading(); };
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(false); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => {
+ isCancellation = e.Cancellation;
+ tcs.TrySetResult(true);
+ };
+
+ _webView.LoadStarted += onLoadStarted;
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.TestUrl);
+ var result = await tcs.Task;
+
+ _webView.LoadStarted -= onLoadStarted;
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadError should be invoked");
+ Assert.IsTrue(isCancellation, "Cancellation should be true");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Asks the main frame to reload the current document")]
+ [Property("SPEC", "Tizen.WebView.WebView.Reload M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Reload_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcsReload = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedReload = (s, e) => { tcsReload.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorReload = (s, e) => { tcsReload.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedReload;
+ _webView.LoadError += onLoadErrorReload;
+
+ _webView.Reload();
+ result = await tcsReload.Task;
+
+ _webView.LoadFinished -= onLoadFinishedReload;
+ _webView.LoadError -= onLoadErrorReload;
+
+ Assert.IsTrue(result, "Reload method failed");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Asks the main frame to navigate back in history")]
+ [Property("SPEC", "Tizen.WebView.WebView.GoBack M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task GoBack_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ TaskCompletionSource<bool> tcsFisrt = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedFirst = (s, e) => { tcsFisrt.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorFirst = (s, e) => { tcsFisrt.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedFirst;
+ _webView.LoadError += onLoadErrorFirst;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml1);
+ var result = await tcsFisrt.Task;
+
+ _webView.LoadFinished -= onLoadFinishedFirst;
+ _webView.LoadError -= onLoadErrorFirst;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the first page");
+
+ TaskCompletionSource<bool> tcsSecond = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedSecond = (s, e) => { tcsSecond.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorSecond = (s, e) => { tcsSecond.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedSecond;
+ _webView.LoadError += onLoadErrorSecond;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml2);
+ result = await tcsSecond.Task;
+
+ _webView.LoadFinished -= onLoadFinishedSecond;
+ _webView.LoadError -= onLoadErrorSecond;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the second page");
+
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcsGoBack = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedGoBack = (s, e) => { tcsGoBack.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorGoBack = (s, e) => { tcsGoBack.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedGoBack;
+ _webView.LoadError += onLoadErrorGoBack;
+
+ _webView.GoBack();
+ result = await tcsGoBack.Task;
+
+ _webView.LoadFinished -= onLoadFinishedGoBack;
+ _webView.LoadError -= onLoadErrorGoBack;
+
+ Assert.IsTrue(result, "GoBack method failed");
+ Assert.AreEqual(WebViewCommon.SampleHtml1, _webView.Url, "URL should be same with the first page");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Asks the main frame to navigate forward in history")]
+ [Property("SPEC", "Tizen.WebView.WebView.GoForward M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task GoForward_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ TaskCompletionSource<bool> tcsFisrt = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedFirst = (s, e) => { tcsFisrt.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorFirst = (s, e) => { tcsFisrt.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedFirst;
+ _webView.LoadError += onLoadErrorFirst;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml1);
+ var result = await tcsFisrt.Task;
+
+ _webView.LoadFinished -= onLoadFinishedFirst;
+ _webView.LoadError -= onLoadErrorFirst;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the first page");
+
+ TaskCompletionSource<bool> tcsSecond = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedSecond = (s, e) => { tcsSecond.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorSecond = (s, e) => { tcsSecond.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedSecond;
+ _webView.LoadError += onLoadErrorSecond;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml2);
+ result = await tcsSecond.Task;
+
+ _webView.LoadFinished -= onLoadFinishedSecond;
+ _webView.LoadError -= onLoadErrorSecond;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the second page");
+
+ TaskCompletionSource<bool> tcsGoBack = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedGoBack = (s, e) => { tcsGoBack.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorGoBack = (s, e) => { tcsGoBack.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedGoBack;
+ _webView.LoadError += onLoadErrorGoBack;
+
+ _webView.GoBack();
+ result = await tcsGoBack.Task;
+
+ _webView.LoadFinished -= onLoadFinishedGoBack;
+ _webView.LoadError -= onLoadErrorGoBack;
+
+ Assert.IsTrue(result, "GoBack method failed");
+
+ /* TEST CODE */
+ TaskCompletionSource<bool> tcsGoForward = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedGoForward = (s, e) => { tcsGoForward.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorGoForward = (s, e) => { tcsGoForward.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedGoForward;
+ _webView.LoadError += onLoadErrorGoForward;
+
+ _webView.GoForward();
+ result = await tcsGoForward.Task;
+
+ _webView.LoadFinished -= onLoadFinishedGoForward;
+ _webView.LoadError -= onLoadErrorGoForward;
+
+ Assert.IsTrue(result, "GoForward method failed");
+ Assert.AreEqual(WebViewCommon.SampleHtml2, _webView.Url, "URL should be same with the second page");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Checks whether it is possible to navigate backwards one item in history")]
+ [Property("SPEC", "Tizen.WebView.WebView.CanGoBack M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task CanGoBack_RETURN_VALUE()
+ {
+ /* PRECONDITION */
+ TaskCompletionSource<bool> tcsFisrt = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedFirst = (s, e) => { tcsFisrt.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorFirst = (s, e) => { tcsFisrt.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedFirst;
+ _webView.LoadError += onLoadErrorFirst;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml1);
+ var result = await tcsFisrt.Task;
+
+ _webView.LoadFinished -= onLoadFinishedFirst;
+ _webView.LoadError -= onLoadErrorFirst;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the first page");
+
+ TaskCompletionSource<bool> tcsSecond = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedSecond = (s, e) => { tcsSecond.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorSecond = (s, e) => { tcsSecond.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedSecond;
+ _webView.LoadError += onLoadErrorSecond;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml2);
+ result = await tcsSecond.Task;
+
+ _webView.LoadFinished -= onLoadFinishedSecond;
+ _webView.LoadError -= onLoadErrorSecond;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the second page");
+
+ /* TEST CODE */
+ var canGoBack = _webView.CanGoBack();
+ Assert.IsInstanceOf<bool>(canGoBack, "CanGoBack should return object boolean");
+ Assert.IsTrue(canGoBack, "CanGoBack should return valid value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Checks whether it is possible to navigate forwards one item in history")]
+ [Property("SPEC", "Tizen.WebView.WebView.CanGoForward M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task CanGoForward_RETURN_VALUE()
+ {
+ /* PRECONDITION */
+ TaskCompletionSource<bool> tcsFisrt = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedFirst = (s, e) => { tcsFisrt.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorFirst = (s, e) => { tcsFisrt.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedFirst;
+ _webView.LoadError += onLoadErrorFirst;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml1);
+ var result = await tcsFisrt.Task;
+
+ _webView.LoadFinished -= onLoadFinishedFirst;
+ _webView.LoadError -= onLoadErrorFirst;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the first page");
+
+ TaskCompletionSource<bool> tcsSecond = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedSecond = (s, e) => { tcsSecond.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorSecond = (s, e) => { tcsSecond.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedSecond;
+ _webView.LoadError += onLoadErrorSecond;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml2);
+ result = await tcsSecond.Task;
+
+ _webView.LoadFinished -= onLoadFinishedSecond;
+ _webView.LoadError -= onLoadErrorSecond;
+
+ Assert.IsTrue(result, "LoadUrl method failed for the second page");
+
+ TaskCompletionSource<bool> tcsGoBack = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadFinishedGoBack = (s, e) => { tcsGoBack.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadErrorGoBack = (s, e) => { tcsGoBack.TrySetResult(false); };
+
+ _webView.LoadFinished += onLoadFinishedGoBack;
+ _webView.LoadError += onLoadErrorGoBack;
+
+ _webView.GoBack();
+ result = await tcsGoBack.Task;
+
+ _webView.LoadFinished -= onLoadFinishedGoBack;
+ _webView.LoadError -= onLoadErrorGoBack;
+
+ Assert.IsTrue(result, "GoBack method failed");
+
+ /* TEST CODE */
+ var canGoForward = _webView.CanGoForward();
+ Assert.IsInstanceOf<bool>(canGoForward, "CanGoForward should return object boolean");
+ Assert.IsTrue(canGoForward, "CanGoForward should return valid value");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Injects the supplied javascript message handler into the view")]
+ [Property("SPEC", "Tizen.WebView.WebView.AddJavaScriptMessageHandler M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR, MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task AddJavaScriptMessageHandler_RETURN_VALUE_CHANGE_STATUS()
+ {
+ /* TEST CODE */
+ 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;
+
+ TaskCompletionSource<bool> tcsForCallback = new TaskCompletionSource<bool>(false);
+ JavaScriptMessageHandler handler = (message) =>
+ {
+ if (message.Name.Equals("MyJavaScriptInterfaceForCommon") && message.GetBodyAsString().Equals("Test message"))
+ {
+ tcsForCallback.TrySetResult(true);
+ }
+ tcsForCallback.TrySetResult(false);
+ };
+ var ret = _webView.AddJavaScriptMessageHandler("MyJavaScriptInterfaceForCommon", handler);
+ Assert.IsInstanceOf<bool>(ret, "AddJavaScriptMessageHandler should return object bool");
+ Assert.IsTrue(ret, "AddJavaScriptMessageHandler method failed");
+
+ _webView.LoadUrl(WebViewCommon.AddJavaScriptInterfaceSampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ _webView.Eval("callForCommon();");
+ result = await tcsForCallback.Task;
+
+ Assert.IsTrue(result, "JavaScript handler should be invoked with valid name");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Requests the execution of given name and result to the JavaScript runtime")]
+ [Property("SPEC", "Tizen.WebView.WebView.EvalWithResult M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task EvalWithResult_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.AddJavaScriptInterfaceSampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ try
+ {
+ _webView.EvalWithResult("sendResult", "Result");
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Requests the execution of the given script")]
+ [Property("SPEC", "Tizen.WebView.WebView.Eval M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task Eval_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ try
+ {
+ _webView.Eval(WebViewCommon.TestScript);
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Requests the execution of the given script and gets the result of evaluation")]
+ [Property("SPEC", "Tizen.WebView.WebView.EvalAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task EvalAsync_RETURN_VALUE()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ string returnValue = "";
+ try
+ {
+ returnValue = await _webView.EvalAsync(WebViewCommon.TestScript);
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+
+ Assert.AreEqual("test content", returnValue, WebViewCommon.ReturnOfTestScript);
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Checks whether EvalAsync throws ArgumentException when script is null")]
+ [Property("SPEC", "Tizen.WebView.WebView.EvalAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task EvalAsync_ARGUMENT_EXCEPTION_NULL_SCRIPT()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ Assert.ThrowsAsync<ArgumentException>(async () => await _webView.EvalAsync(null), "ArgumentException should be thrown");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Checks whether EvalAsync throws ArgumentException when script is empty")]
+ [Property("SPEC", "Tizen.WebView.WebView.EvalAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MEX")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task EvalAsync_ARGUMENT_EXCEPTION_EMPTY_SCRIPT()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ Assert.ThrowsAsync<ArgumentException>(async () => await _webView.EvalAsync(""), "ArgumentException should be thrown");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Requests to set or unset a view as the currently focused one")]
+ [Property("SPEC", "Tizen.WebView.WebView.SetFocus M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Youngha Jung, yh106.jung@samsung.com")]
+ public async Task SetFocus_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ _webView.SetFocus(true);
+ Assert.IsTrue(_webView.HasFocus, "Fail to set focus as true");
+ _webView.SetFocus(false);
+ Assert.IsFalse(_webView.HasFocus, "Fail to set focus as false");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Contents Size of this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.ContentsSize A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task ContentsSize_READ_ONLY()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ await Task.Delay(2000);
+
+ /* TEST CODE */
+ var contentSize = _webView.ContentsSize;
+ Assert.AreNotEqual(0, contentSize.Height, "Height of content size should be nonzero");
+ Assert.AreNotEqual(0, contentSize.Width, "Width of content size should be nonzero");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Exits the Full Screen of this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.ExitFullscreen M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task ExitFullscreen_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ try
+ {
+ _webView.ExitFullscreen();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sends the orientation of the device")]
+ [Property("SPEC", "Tizen.WebView.WebView.SendOrientation M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MAE")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task SendOrientation_ENUM_ALL()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+
+ try
+ {
+ foreach(Orientation orientation in Enum.GetValues(typeof(Orientation)))
+ {
+ _webView.SendOrientation(orientation);
+ }
+
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Suspends the operation associated with the view")]
+ [Property("SPEC", "Tizen.WebView.WebView.Suspend M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task Suspend_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ try
+ {
+ _webView.Suspend();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Resumes the operation associated with the view")]
+ [Property("SPEC", "Tizen.WebView.WebView.Resume M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task Resume_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ try
+ {
+ _webView.Resume();
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Load Progress of this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.LoadProgress A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task LoadProgress_READ_ONLY()
+ {
+ /* TEST CODE */
+ double progress = 0;
+ TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
+ EventHandler onLoadStarted = (s, e) => { progress = _webView.LoadProgress; };
+ EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
+ EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => { tcs.TrySetResult(false); };
+
+ _webView.LoadStarted += onLoadStarted;
+ _webView.LoadFinished += onLoadFinished;
+ _webView.LoadError += onLoadError;
+
+ _webView.LoadUrl(WebViewCommon.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadStarted -= onLoadStarted;
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ Assert.AreNotEqual(0, progress, "Fail to get Load Progress");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets the Scale of this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.Scale A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task Scale_READ_ONLY()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ Assert.AreNotEqual(0, _webView.Scale, "Fail to get scale");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets the Scale for this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.SetScale M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task SetScale_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ double scaleFactor = 2.0;
+ Point scrollTo;
+ scrollTo.X = 5;
+ scrollTo.Y = 5;
+
+ _webView.SetScale(scaleFactor, scrollTo);
+ await Task.Delay(1000);
+
+ Assert.AreEqual(2.0, _webView.Scale, "Fail to set scale");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Enables the visibility of this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.SetViewVisibility M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task SetViewVisibility_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ try
+ {
+ _webView.SetViewVisibility(true);
+
+ _webView.SetViewVisibility(false);
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Gets and sets user agent string of this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.ScrollPosition A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task ScrollPosition_READ_WRITE()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ Point scrollPos;
+ scrollPos.X = 5;
+ scrollPos.Y = 10;
+
+ _webView.ScrollPosition = scrollPos;
+ await Task.Delay(1000);
+
+ Assert.AreEqual(scrollPos, _webView.ScrollPosition, "Get ScrollPos should return valid scroll position");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets the Scroll By for this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.ScrollBy M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task ScrollBy_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ Point initialPos = _webView.ScrollPosition;
+ Point scrollBy;
+ scrollBy.X = 5;
+ scrollBy.Y = 10;
+
+ _webView.ScrollBy(scrollBy);
+ await Task.Delay(1000);
+
+ Point scrollPos = _webView.ScrollPosition;
+ Assert.AreEqual(initialPos.X + scrollBy.X, scrollPos.X, "X of scroll position should be valid");
+ Assert.AreEqual(initialPos.Y + scrollBy.Y, scrollPos.Y, "Y of scroll position should be valid");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Finds the text entered for this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.FindText M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MAE")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public async Task FindText_ENUM_ALL()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ var result = await tcs.Task;
+
+ _webView.LoadFinished -= onLoadFinished;
+ _webView.LoadError -= onLoadError;
+
+ Assert.IsTrue(result, "LoadUrl method failed");
+
+ /* TEST CODE */
+ try
+ {
+ foreach (FindOption option in Enum.GetValues(typeof(FindOption)))
+ {
+ _webView.FindText("sample", option, 0);
+ }
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Sets the url request for this view")]
+ [Property("SPEC", "Tizen.WebView.WebView.SetUrlRequest M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MAE")]
+ [Property("AUTHOR", "Basavaraj P S, basavaraj.ps@samsung.com")]
+ public void SetUrlRequest_ENUM_ALL()
+ {
+ /* TEST CODE */
+ var httpHeaders = new Dictionary<string, string>();
+ httpHeaders.Add("Accept", "*/*");
+ try
+ {
+ foreach(HttpMethod method in Enum.GetValues(typeof(HttpMethod)))
+ {
+ _webView.SetUrlRequest(WebViewCommon.TestUrl, method, httpHeaders, null);
+ }
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("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")]
+ public async Task SetContextMenuCustomizeDelegate_CHANGE_STATUS()
+ {
+ /* PRECONDITION */
+ 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.SampleHtml);
+ 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.True(false, "Delegate must not be invoked in this testcase");
+ };
+ try
+ {
+ _webView.SetContextMenuCustomizeDelegate(contextMenuCustomize);
+ }
+ catch (Exception e)
+ {
+ Assert.True(false, e.Message);
+ }
+
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using ElmSharp;
+
+namespace Tizen.WebView.Tests
+{
+ internal static class WebViewCommon
+ {
+ public const string SampleHtml = "file:///opt/usr/home/owner/share/res/sample.html";
+ public const string SampleHtml1 = "file:///opt/usr/home/owner/share/res/sample_1.html";
+ public const string SampleHtml2 = "file:///opt/usr/home/owner/share/res/sample_2.html";
+ public const string AddJavaScriptInterfaceSampleHtml = "file:///opt/usr/home/owner/share/res/add_js_interface_sample.html";
+ public const string WindowOpenSampleHtml = "file:///opt/usr/home/owner/share/res/window_open_sample.html";
+ public const string LinkClickSampleHtml = "file:///opt/usr/home/owner/share/res/link_click_sample.html";
+ public const string FormSubmitSampleHtml = "file:///opt/usr/home/owner/share/res/form_submit_sample.html";
+ public const string SampleHtmlTitle = "Testing Sample Page";
+ public const string HeaderTerminator = "\r\r";
+ public const string FileScheme = "file";
+
+ public const string TestUrl = "https://www.tizen.org/";
+ public const string TestUrlForError = "http://page_that_does_not_exist/";
+ public const string TestUrlForDownload = "http://download.tizen.org/sdk/samples/online/Native/MN_app-common/MN_app-common.zip";
+ public const string TestUserAgent = "Mozilla/5.0 (Unknown; Linux armv7l) AppleWebKit/538.1 (KHTML, like Gecko) Version/5.0 Safari/538.1";
+ public const string TestHtml = "<html><body onload='document.title=document.URL'></body></html>";
+ public const string TestScript = "document.getElementById('getParaContent').innerHTML";
+ public const string ReturnOfTestScript = "The result of evaluation should be same with expected value";
+ public const string TestCookie = "foo=bar";
+
+ private static Window _instance;
+
+ public static Window GetMainWindow()
+ {
+ if (_instance == null)
+ {
+ _instance = new Window("WebView Auto Tests");
+ }
+ return _instance;
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<manifest package="Tizen.WebView.Tests" version="1.0.0" api-version="8.0" xmlns="http://tizen.org/ns/packages">\r
+ <profile name="common" />\r
+ <ui-application appid="Tizen.WebView.Tests" exec="Tizen.WebView.Tests.dll" multiple="false" taskmanage="true" type="dotnet" launch_mode="single">\r
+ <icon>Tizen.WebView.Tests.png</icon>\r
+ <label>Tizen.WebView.Tests</label>\r
+ <splash-screens />\r
+ </ui-application>\r
+ <shortcut-list />\r
+ <privileges>\r
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>\r
+ <privilege>http://tizen.org/privilege/internet</privilege>\r
+ </privileges>\r
+ <provides-appdefined-privileges />\r
+</manifest>\r