[NUI] Add TCs of WebView & Update some TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / WebView / TSWebPasswordData.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6
7 namespace Tizen.NUI.Devel.Tests 
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("internal/WebView/WebPasswordData")]
13     public class InternalWebPasswordDataTest
14     {
15         private const string tag = "NUITEST";
16         private string url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
17
18         [SetUp]
19         public void Init()
20         {
21             tlog.Info(tag, "Init() is called!");
22         }
23
24         [TearDown]
25         public void Destroy()
26         {
27             tlog.Info(tag, "Destroy() is called!");
28         }
29
30         [Test]
31         [Category("P1")]
32         [Description("WebPasswordData constructor.")]
33         [Property("SPEC", "Tizen.NUI.WebPasswordData.WebPasswordData C")]
34         [Property("SPEC_URL", "-")]
35         [Property("CRITERIA", "CONSTR")]
36         [Property("COVPARAM", "")]
37         [Property("AUTHOR", "guowei.wang@samsung.com")]
38         public void WebPasswordDataConstructor()
39         {
40             tlog.Debug(tag, $"WebPasswordDataConstructor START");
41
42             using (Tizen.NUI.BaseComponents.WebView webview = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai"))
43             {
44                 var testingTarget = new WebPasswordData(webview.SwigCPtr.Handle, false);
45                 Assert.IsNotNull(testingTarget, "null handle");
46                 Assert.IsInstanceOf<WebPasswordData>(testingTarget, "Should return WebPasswordData instance.");
47
48                 testingTarget.Dispose();
49             }
50
51             tlog.Debug(tag, $"WebPasswordDataConstructor END (OK)");
52         }
53
54         [Test]
55         [Category("P1")]
56         [Description("WebPasswordData FingerprintUsed.")]
57         [Property("SPEC", "Tizen.NUI.WebPasswordData.FingerprintUsed A")]
58         [Property("SPEC_URL", "-")]
59         [Property("CRITERIA", "PRO")]
60         [Property("COVPARAM", "")]
61         [Property("AUTHOR", "guowei.wang@samsung.com")]
62         public void WebPasswordDataFingerprintUsed()
63         {
64             tlog.Debug(tag, $"WebPasswordDataFingerprintUsed START");
65
66             using (Tizen.NUI.BaseComponents.WebView webview = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai"))
67             {
68                 webview.LoadUrl("http://www.baidu.com");
69
70                 var testingTarget = new WebPasswordData(webview.SwigCPtr.Handle, false);
71                 Assert.IsNotNull(testingTarget, "null handle");
72                 Assert.IsInstanceOf<WebPasswordData>(testingTarget, "Should return WebPasswordData instance.");
73
74                 var result = testingTarget.FingerprintUsed;
75                 tlog.Debug(tag, "FingerprintUsed : " + result);
76
77                 webview.ClearCache();
78                 webview.ClearCookies();
79
80                 testingTarget.Dispose();
81             }
82
83             tlog.Debug(tag, $"WebPasswordDataFingerprintUsed END (OK)");
84         }
85     }
86 }