[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 / TSWebSecurityOriginList.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/WebSecurityOriginList")]
13     public class InternalWebSecurityOriginListTest
14     {
15         private const string tag = "NUITEST";
16
17         [SetUp]
18         public void Init()
19         {
20             tlog.Info(tag, "Init() is called!");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             tlog.Info(tag, "Destroy() is called!");
27         }
28
29         [Test]
30         [Category("P1")]
31         [Description("WebSecurityOriginList constructor.")]
32         [Property("SPEC", "Tizen.NUI.WebSecurityOriginList.WebSecurityOriginList C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("COVPARAM", "")]
36         [Property("AUTHOR", "guowei.wang@samsung.com")]
37         public void WebSecurityOriginListConstructor()
38         {
39             tlog.Debug(tag, $"WebSecurityOriginListConstructor START");
40
41             using (Tizen.NUI.BaseComponents.WebView webview = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai"))
42             {
43                 var testingTarget = new WebSecurityOriginList(webview.SwigCPtr.Handle, false);
44                 Assert.IsNotNull(testingTarget, "null handle");
45                 Assert.IsInstanceOf<WebSecurityOriginList>(testingTarget, "Should return WebSecurityOriginList instance.");
46
47                 testingTarget.Dispose();
48             }
49
50             tlog.Debug(tag, $"WebSecurityOriginListConstructor END (OK)");
51         }
52
53         [Test]
54         [Category("P1")]
55         [Description("WebSecurityOriginList ItemCount.")]
56         [Property("SPEC", "Tizen.NUI.WebSecurityOriginList.ItemCount A")]
57         [Property("SPEC_URL", "-")]
58         [Property("CRITERIA", "PRO")]
59         [Property("COVPARAM", "")]
60         [Property("AUTHOR", "guowei.wang@samsung.com")]
61         public void WebSecurityOriginListItemCount()
62         {
63             tlog.Debug(tag, $"WebSecurityOriginListItemCount START");
64
65             using (Tizen.NUI.BaseComponents.WebView webview = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai"))
66             {
67                 var testingTarget = new WebSecurityOriginList(webview.SwigCPtr.Handle, false);
68                 Assert.IsNotNull(testingTarget, "null handle");
69                 Assert.IsInstanceOf<WebSecurityOriginList>(testingTarget, "Should return WebSecurityOriginList instance.");
70
71                 tlog.Debug(tag, "ItemCount : " + testingTarget.ItemCount);
72
73                 testingTarget.Dispose();
74             }
75
76             tlog.Debug(tag, $"WebSecurityOriginListItemCount END (OK)");
77         }
78
79         [Test]
80         [Category("P1")]
81         [Description("WebSecurityOriginList GetItemAtIndex.")]
82         [Property("SPEC", "Tizen.NUI.WebSecurityOriginList.GetItemAtIndex A")]
83         [Property("SPEC_URL", "-")]
84         [Property("CRITERIA", "PRO")]
85         [Property("COVPARAM", "")]
86         [Property("AUTHOR", "guowei.wang@samsung.com")]
87         public void WebSecurityOriginListGetItemAtIndex()
88         {
89             tlog.Debug(tag, $"WebSecurityOriginListGetItemAtIndex START");
90
91             using (Tizen.NUI.BaseComponents.WebView webview = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai"))
92             {
93                 webview.LoadUrl("http://www.baidu.com");
94
95                 var testingTarget = new WebSecurityOriginList(webview.SwigCPtr.Handle, false);
96                 Assert.IsNotNull(testingTarget, "null handle");
97                 Assert.IsInstanceOf<WebSecurityOriginList>(testingTarget, "Should return WebSecurityOriginList instance.");
98
99                 var result = testingTarget.GetItemAtIndex(0);
100                 tlog.Debug(tag, "GetItemAtIndex : " + result);
101
102                 webview.ClearCache();
103                 webview.ClearCookies();
104
105                 testingTarget.Dispose();
106             }
107
108             tlog.Debug(tag, $"WebSecurityOriginListGetItemAtIndex END (OK)");
109         }
110     }
111 }