[NUI] Update webview TCs.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / WebView / TSWebHttpAuthHandler.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 using System.Threading.Tasks;
7
8 namespace Tizen.NUI.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("internal/WebView/WebHttpAuthHandler")]
14     public class InternalWebHttpAuthHandlerTest
15     {
16         private const string tag = "NUITEST";
17         private string urlForHttpAuth = "https://review.tizen.org/gerrit/#/";
18         private BaseComponents.WebView webview_;
19
20         [SetUp]
21         public void Init()
22         {
23             tlog.Info(tag, "Init() is called!");
24             webview_ = new BaseComponents.WebView()
25             {
26                 Size = new Size(500, 200),
27             };
28         }
29
30         [TearDown]
31         public void Destroy()
32         {
33             tlog.Info(tag, "Destroy() is being called!");
34             webview_.Dispose();
35             tlog.Info(tag, "Destroy() is called!");
36         }
37
38         //TODO... This TC will be blocked because web engine does not support it any longer.
39         //[Test]
40         //[Category("P1")]
41         //[Description("WebHttpAuthHandler CancelCredential.")]
42         //[Property("SPEC", "Tizen.NUI.WebHttpAuthHandler.CancelCredential M")]
43         //[Property("SPEC_URL", "-")]
44         //[Property("CRITERIA", "PRO")]
45         //[Property("COVPARAM", "")]
46         //[Property("AUTHOR", "guowei.wang@samsung.com")]
47         //public async Task WebHttpAuthHandlerCancelCredential()
48         //{
49         //    tlog.Debug(tag, $"WebHttpAuthHandlerRealm START");
50
51         //    TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
52         //    EventHandler<WebViewHttpAuthRequestedEventArgs> onHttpAuthRequested = (s, e) =>
53         //    {
54         //        tlog.Info(tag, $"HttpAuthRequested, Url: {e.HttpAuthHandler.Realm}");
55         //        e.HttpAuthHandler.CancelCredential();
56         //        tcs.TrySetResult(true);
57         //    };
58
59         //    webview_.HttpAuthRequested += onHttpAuthRequested;
60
61         //    webview_.LoadUrl(urlForHttpAuth);
62         //    var result = await tcs.Task;
63         //    Assert.IsTrue(result, "HttpAuthRequested event should be invoked.");
64
65         //    // Make current thread (CPU) sleep...
66         //    await Task.Delay(1);
67
68         //    webview_.HttpAuthRequested -= onHttpAuthRequested;
69
70         //    tlog.Debug(tag, $"WebHttpAuthHandlerRealm END (OK)");
71         //}
72
73         //TODO... This TC will be blocked because web engine does not support it any longer.
74         //[Test]
75         //[Category("P1")]
76         //[Description("WebHttpAuthHandler UseCredential.")]
77         //[Property("SPEC", "Tizen.NUI.WebHttpAuthHandler.UseCredential M")]
78         //[Property("SPEC_URL", "-")]
79         //[Property("CRITERIA", "PRO")]
80         //[Property("COVPARAM", "")]
81         //[Property("AUTHOR", "guowei.wang@samsung.com")]
82         //public async Task WebHttpAuthHandlerUseCredential()
83         //{
84         //    tlog.Debug(tag, $"WebHttpAuthHandlerRealm START");
85
86         //    TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
87         //    EventHandler<WebViewHttpAuthRequestedEventArgs> onHttpAuthRequested = (s, e) =>
88         //    {
89         //        tlog.Info(tag, $"HttpAuthRequested, Url: {e.HttpAuthHandler.Realm}");
90         //        e.HttpAuthHandler.UseCredential("tizen", "samsung");
91         //        tcs.TrySetResult(true);
92         //    };
93
94         //    webview_.HttpAuthRequested += onHttpAuthRequested;
95
96         //    webview_.LoadUrl(urlForHttpAuth);
97         //    var result = await tcs.Task;
98         //    Assert.IsTrue(result, "HttpAuthRequested event should be invoked.");
99
100         //    // Make current thread (CPU) sleep...
101         //    await Task.Delay(1);
102
103         //    webview_.HttpAuthRequested -= onHttpAuthRequested;
104
105         //    tlog.Debug(tag, $"WebHttpAuthHandlerRealm END (OK)");
106         //}
107
108         //TODO... This TC will be blocked because web engine does not support it any longer.
109         //[Test]
110         //[Category("P1")]
111         //[Description("WebHttpAuthHandler Suspend.")]
112         //[Property("SPEC", "Tizen.NUI.WebHttpAuthHandler.Suspend M")]
113         //[Property("SPEC_URL", "-")]
114         //[Property("CRITERIA", "PRO")]
115         //[Property("COVPARAM", "")]
116         //[Property("AUTHOR", "guowei.wang@samsung.com")]
117         //public async Task WebHttpAuthHandlerSuspend()
118         //{
119         //    tlog.Debug(tag, $"WebHttpAuthHandlerRealm START");
120
121         //    TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
122         //    EventHandler<WebViewHttpAuthRequestedEventArgs> onHttpAuthRequested = (s, e) =>
123         //    {
124         //        tlog.Info(tag, $"HttpAuthRequested, Url: {e.HttpAuthHandler.Realm}");
125         //        e.HttpAuthHandler.Suspend();
126         //        tcs.TrySetResult(true);
127         //    };
128
129         //    webview_.HttpAuthRequested += onHttpAuthRequested;
130
131         //    webview_.LoadUrl(urlForHttpAuth);
132         //    var result = await tcs.Task;
133         //    Assert.IsTrue(result, "HttpAuthRequested event should be invoked.");
134
135         //    // Make current thread (CPU) sleep...
136         //    await Task.Delay(1);
137
138         //    webview_.HttpAuthRequested -= onHttpAuthRequested;
139
140         //    tlog.Debug(tag, $"WebHttpAuthHandlerRealm END (OK)");
141         //}
142     }   
143 }