[NUI] Update WebView TCs.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / WebView / TSWebView.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("public/WebView/WebView")]
14     public class PublicWebViewTest
15     {
16         private const string tag = "NUITEST";
17         private string url = Applications.Application.Current.DirectoryInfo.Resource + "webview/index.html"; // its size is 150x150.
18         private string secondUrl = Applications.Application.Current.DirectoryInfo.Resource + "webview/second.html";
19         private string urlForNavigationPolicyTest = "http://www.google.com";
20         private string urlForCertificateConfirmTest = "https://wrong.host.badssl.com/";
21         private string urlForResponsePolicyTest = "http://www.samsung.com";
22         private string urlForConsoleMessageTest = Applications.Application.Current.DirectoryInfo.Resource + "webview/console_info.html";
23
24         private static string[] runtimeArgs = { "--enable-dali-window", "--enable-spatial-navigation" };
25         private const string USER_AGENT = "Mozilla/5.0 (SMART-TV; Linux; Tizen 6.0) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/76.0.3809.146 TV Safari/537.36";
26         private BaseComponents.WebView webView = null;
27
28         private void JsCallback(string arg) { }
29         private void VideoCallback(bool arg) { }
30         private void GeolocationCallback(string arg1, string arg2) { }
31         private void PromptCallback(string arg1, string arg2) { }
32         private void PlainReceivedCallback(string arg2) { }
33         private void ScreenshotAcquiredCallbackCase(ImageView image) { }
34
35         internal class MyWebView : Tizen.NUI.BaseComponents.WebView
36         {
37             public MyWebView() : base()
38             { }
39
40             public void OnDispose(DisposeTypes type)
41             {
42                 base.Dispose(type);
43             }
44         }
45
46         [SetUp]
47         public void Init()
48         {
49             webView = new BaseComponents.WebView(runtimeArgs)
50             {
51                 Size = new Size(150, 100), //For scrolling to edge...
52             };
53             tlog.Info(tag, "Init() is called!");
54         }
55
56         [TearDown]
57         public void Destroy()
58         {
59             tlog.Info(tag, "Destroy() is being called!");
60             webView.Dispose();
61             tlog.Info(tag, "Destroy() is called!");
62         }
63
64         [Test]
65         [Category("P1")]
66         [Description("WebView constructor.")]
67         [Property("SPEC", "Tizen.NUI.WebView.WebView C")]
68         [Property("SPEC_URL", "-")]
69         [Property("CRITERIA", "CONSTR")]
70         [Property("COVPARAM", "")]
71         [Property("AUTHOR", "guowei.wang@samsung.com")]
72         public void WebViewConstructor()
73         {
74             tlog.Debug(tag, $"WebViewConstructor START");
75
76             Assert.IsNotNull(webView, "null handle");
77             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(webView, "Should return WebView instance.");
78
79             tlog.Debug(tag, $"WebViewConstructor END (OK)");
80         }
81
82         [Test]
83         [Category("P1")]
84         [Description("WebView constructor.")]
85         [Property("SPEC", "Tizen.NUI.WebView.WebView C")]
86         [Property("SPEC_URL", "-")]
87         [Property("CRITERIA", "CONSTR")]
88         [Property("COVPARAM", "")]
89         [Property("AUTHOR", "guowei.wang@samsung.com")]
90         public void WebViewConstructorWithLocaleAndTimezone()
91         {
92             tlog.Debug(tag, $"WebViewConstructorWithLocaleAndTimezone START");
93
94             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
95             Assert.IsNotNull(testingTarget, "null handle");
96             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
97
98             testingTarget?.Dispose();
99             tlog.Debug(tag, $"WebViewConstructorWithLocaleAndTimezone END (OK)");
100         }
101
102         [Test]
103         [Category("P1")]
104         [Description("WebView constructor.")]
105         [Property("SPEC", "Tizen.NUI.WebView.WebView C")]
106         [Property("SPEC_URL", "-")]
107         [Property("CRITERIA", "CONSTR")]
108         [Property("COVPARAM", "")]
109         [Property("AUTHOR", "guowei.wang@samsung.com")]
110         public void WebViewConstructorWithWebView()
111         {
112             tlog.Debug(tag, $"WebViewConstructorWithWebView START");
113
114             var testingTarget = new Tizen.NUI.BaseComponents.WebView(webView);
115             Assert.IsNotNull(testingTarget, "null handle");
116             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
117
118             testingTarget.Dispose();
119             tlog.Debug(tag, $"WebViewConstructorWithWebView END (OK)");
120         }
121
122         [Test]
123         [Category("P1")]
124         [Description("WebView PageLoadStarted.")]
125         [Property("SPEC", "Tizen.NUI.WebView.PageLoadStarted E")]
126         [Property("SPEC_URL", "-")]
127         [Property("CRITERIA", "PRW")]
128         [Property("COVPARAM", "")]
129         [Property("AUTHOR", "guowei.wang@samsung.com")]
130         public async Task WebViewPageLoadStarted()
131         {
132             tlog.Debug(tag, $"WebViewPageLoadStarted START");
133
134             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
135             EventHandler<WebViewPageLoadEventArgs> onLoadStarted = (s, e) => { tcs.TrySetResult(true); };
136             webView.PageLoadStarted += onLoadStarted;
137
138             webView.LoadUrl(url);
139             var result = await tcs.Task;
140             Assert.IsTrue(result, "PageLoadStarted event should be invoked");
141
142             webView.PageLoadStarted -= onLoadStarted;
143
144             tlog.Debug(tag, $"WebViewPageLoadStarted END (OK)");
145         }
146
147         [Test]
148         [Category("P1")]
149         [Description("WebView PageLoading.")]
150         [Property("SPEC", "Tizen.NUI.WebView.PageLoading E")]
151         [Property("SPEC_URL", "-")]
152         [Property("CRITERIA", "PRW")]
153         [Property("COVPARAM", "")]
154         [Property("AUTHOR", "guowei.wang@samsung.com")]
155         public async Task WebViewPageLoading()
156         {
157             tlog.Debug(tag, $"WebViewPageLoading START");
158
159             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
160             EventHandler<WebViewPageLoadEventArgs> onLoading = (s, e) => { tcs.TrySetResult(true); };
161             webView.PageLoading += onLoading;
162
163             webView.LoadUrl(url);
164             var result = await tcs.Task;
165             Assert.IsTrue(result, "PageLoading event should be invoked");
166
167             webView.PageLoading -= onLoading;
168
169             tlog.Debug(tag, $"WebViewPageLoading END (OK)");
170         }
171
172         [Test]
173         [Category("P1")]
174         [Description("WebView PageLoadFinished.")]
175         [Property("SPEC", "Tizen.NUI.WebView.PageLoadFinished E")]
176         [Property("SPEC_URL", "-")]
177         [Property("CRITERIA", "PRW")]
178         [Property("COVPARAM", "")]
179         [Property("AUTHOR", "guowei.wang@samsung.com")]
180         public async Task WebViewPageLoadFinished()
181         {
182             tlog.Debug(tag, $"WebViewPageLoadFinished START");
183
184             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
185             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) => { tcs.TrySetResult(true); };
186             webView.PageLoadFinished += onLoadFinished;
187
188             webView.LoadUrl(url);
189             var result = await tcs.Task;
190             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
191
192             webView.PageLoadFinished -= onLoadFinished;
193
194             tlog.Debug(tag, $"WebViewPageLoadFinished END (OK)");
195         }
196
197         //TODO... it seems that web engine does not implement it.
198         //[Test]
199         //[Category("P1")]
200         //[Description("WebView ScrollEdgeReached.")]
201         //[Property("SPEC", "Tizen.NUI.WebView.ScrollEdgeReached E")]
202         //[Property("SPEC_URL", "-")]
203         //[Property("CRITERIA", "PRW")]
204         //[Property("COVPARAM", "")]
205         //[Property("AUTHOR", "guowei.wang@samsung.com")]
206         //public async Task WebViewScrollEdgeReached()
207         //{
208         //    tlog.Debug(tag, $"WebViewScrollEdgeReached START");
209
210         //    TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
211         //    EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
212         //    {
213         //        webView.ScrollBy(0, 60);
214         //    };
215         //    webView.PageLoadFinished += onLoadFinished;
216
217         //    EventHandler<WebViewScrollEdgeReachedEventArgs> onEdgeReached = (s, e) =>
218         //    {
219         //        tcs.TrySetResult(true);
220         //    };
221         //    webView.ScrollEdgeReached += onEdgeReached;
222
223         //    webView.LoadUrl(url);
224         //    var result = await tcs.Task;
225         //    Assert.IsTrue(result, "ScrollEdgeReached event should be invoked");
226
227         //    webView.PageLoadFinished -= onLoadFinished;
228         //    webView.ScrollEdgeReached -= onEdgeReached;
229
230         //    tlog.Debug(tag, $"WebViewScrollEdgeReached END (OK)");
231         //}
232
233         [Test]
234         [Category("P1")]
235         [Description("WebView UrlChanged.")]
236         [Property("SPEC", "Tizen.NUI.WebView.UrlChanged E")]
237         [Property("SPEC_URL", "-")]
238         [Property("CRITERIA", "PRW")]
239         [Property("COVPARAM", "")]
240         [Property("AUTHOR", "guowei.wang@samsung.com")]
241         public async Task WebViewUrlChanged()
242         {
243             tlog.Debug(tag, $"WebViewUrlChanged START");
244
245             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
246
247             EventHandler<WebViewUrlChangedEventArgs> onUrlChange = (s, e) =>
248             {
249                 tcs.TrySetResult(true);
250             };
251             webView.UrlChanged += onUrlChange;
252
253             webView.LoadUrl(url);
254             var result = await tcs.Task;
255             Assert.IsTrue(result, "UrlChanged event should be invoked");
256
257             webView.UrlChanged -= onUrlChange;
258
259             tlog.Debug(tag, $"WebViewUrlChanged END (OK)");
260         }
261
262         //[Test]
263         //[Category("P1")]
264         //[Description("WebView FormRepostPolicyDecided.")]
265         //[Property("SPEC", "Tizen.NUI.WebView.FormRepostPolicyDecided A")]
266         //[Property("SPEC_URL", "-")]
267         //[Property("CRITERIA", "PRW")]
268         //[Property("COVPARAM", "")]
269         //[Property("AUTHOR", "guowei.wang@samsung.com")]
270         //public void WebViewFormRepostPolicyDecided()
271         //{
272         //    tlog.Debug(tag, $"WebViewFormRepostPolicyDecided START");
273
274         //    webView.FormRepostPolicyDecided += OnFormRepostPolicyDecide;
275         //    webView.FormRepostPolicyDecided -= OnFormRepostPolicyDecide;
276
277         //    tlog.Debug(tag, $"WebViewFormRepostPolicyDecided END (OK)");
278         //}
279
280         [Test]
281         [Category("P1")]
282         [Description("WebView FrameRendered.")]
283         [Property("SPEC", "Tizen.NUI.WebView.FrameRendered A")]
284         [Property("SPEC_URL", "-")]
285         [Property("CRITERIA", "PRW")]
286         [Property("COVPARAM", "")]
287         [Property("AUTHOR", "guowei.wang@samsung.com")]
288         public async Task WebViewFrameRendered()
289         {
290             tlog.Debug(tag, $"WebViewFrameRendered START");
291
292             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
293             EventHandler<EventArgs> onFrameRender = (s, e) => { tcs.TrySetResult(true); };
294             webView.FrameRendered += onFrameRender;
295
296             webView.LoadUrl(url);
297             var result = await tcs.Task;
298             Assert.IsTrue(result, "FrameRendered event should be invoked");
299
300             webView.FrameRendered -= onFrameRender;
301
302             tlog.Debug(tag, $"WebViewFrameRendered END (OK)");
303         }
304
305         [Test]
306         [Category("P1")]
307         [Description("WebView ResponsePolicyDecided.")]
308         [Property("SPEC", "Tizen.NUI.WebView.ResponsePolicyDecided A")]
309         [Property("SPEC_URL", "-")]
310         [Property("CRITERIA", "PRW")]
311         [Property("COVPARAM", "")]
312         [Property("AUTHOR", "guowei.wang@samsung.com")]
313         public async Task WebViewResponsePolicyDecided()
314         {
315             tlog.Debug(tag, $"WebViewResponsePolicyDecided START");
316
317             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
318             EventHandler<WebViewPolicyDecidedEventArgs> onResponsePolicyDecide = (s, e) => { tcs.TrySetResult(true); };
319             webView.ResponsePolicyDecided += onResponsePolicyDecide;
320
321             webView.LoadUrl(urlForResponsePolicyTest);
322             var result = await tcs.Task;
323             Assert.IsTrue(result, "ResponsePolicyDecided event should be invoked");
324
325             webView.ResponsePolicyDecided -= onResponsePolicyDecide;
326
327             tlog.Debug(tag, $"WebViewResponsePolicyDecided END (OK)");
328         }
329
330         [Test]
331         [Category("P1")]
332         [Description("WebView NavigationPolicyDecided.")]
333         [Property("SPEC", "Tizen.NUI.WebView.NavigationPolicyDecided A")]
334         [Property("SPEC_URL", "-")]
335         [Property("CRITERIA", "PRW")]
336         [Property("COVPARAM", "")]
337         [Property("AUTHOR", "guowei.wang@samsung.com")]
338         public async Task WebViewNavigationPolicyDecided()
339         {
340             tlog.Debug(tag, $"WebViewNavigationPolicyDecided START");
341
342             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
343
344             EventHandler<WebViewPolicyDecidedEventArgs> onNavigationPolicyDecided = (s, e) =>
345             {
346                 tlog.Info(tag, "onNavigationPolicyDecided is being called!");
347                 tcs.TrySetResult(true);
348             };
349             webView.NavigationPolicyDecided += onNavigationPolicyDecided;
350
351             webView.LoadUrl(urlForNavigationPolicyTest);
352             var result = await tcs.Task;
353             Assert.IsTrue(result, "NavigationPolicyDecided event should be invoked");
354
355             webView.NavigationPolicyDecided -= onNavigationPolicyDecided;
356
357             tlog.Debug(tag, $"WebViewNavigationPolicyDecided END (OK)");
358         }
359
360         [Test]
361         [Category("P1")]
362         [Description("WebView CertificateConfirmed.")]
363         [Property("SPEC", "Tizen.NUI.WebView.CertificateConfirmed A")]
364         [Property("SPEC_URL", "-")]
365         [Property("CRITERIA", "PRW")]
366         [Property("COVPARAM", "")]
367         [Property("AUTHOR", "guowei.wang@samsung.com")]
368         public async Task WebViewCertificateConfirmed()
369         {
370             tlog.Debug(tag, $"WebViewCertificateConfirmed START");
371
372             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
373
374             EventHandler<WebViewCertificateReceivedEventArgs> onCertificateConfirme = (s, e) =>
375             {
376                 tlog.Info(tag, "CertificateConfirmed is being called!");
377                 tcs.TrySetResult(true);
378             };
379             webView.CertificateConfirmed += onCertificateConfirme;
380
381             webView.LoadUrl(urlForCertificateConfirmTest);
382             var result = await tcs.Task;
383             Assert.IsTrue(result, "CertificateConfirmed event should be invoked");
384
385             webView.CertificateConfirmed -= onCertificateConfirme;
386
387             tlog.Debug(tag, $"WebViewCertificateConfirmed END (OK)");
388         }
389
390         [Test]
391         [Category("P1")]
392         [Description("WebView SslCertificateChanged.")]
393         [Property("SPEC", "Tizen.NUI.WebView.SslCertificateChanged A")]
394         [Property("SPEC_URL", "-")]
395         [Property("CRITERIA", "PRW")]
396         [Property("COVPARAM", "")]
397         [Property("AUTHOR", "guowei.wang@samsung.com")]
398         public async Task WebViewSslCertificateChanged()
399         {
400             tlog.Debug(tag, $"WebViewSslCertificateChanged START");
401
402             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
403             EventHandler<WebViewCertificateReceivedEventArgs> onSslCertificateChange = (s, e) => { tcs.TrySetResult(true); };
404             webView.SslCertificateChanged += onSslCertificateChange;
405
406             webView.LoadUrl(url);
407             var result = await tcs.Task;
408             Assert.IsTrue(result, "SslCertificateChanged event should be invoked");
409
410             webView.SslCertificateChanged -= onSslCertificateChange;
411
412             tlog.Debug(tag, $"WebViewSslCertificateChanged END (OK)");
413         }
414
415         //TODO... it seems that web engine does not implement it.
416         //[Test]
417         //[Category("P1")]
418         //[Description("WebView HttpAuthRequested.")]
419         //[Property("SPEC", "Tizen.NUI.WebView.HttpAuthRequested A")]
420         //[Property("SPEC_URL", "-")]
421         //[Property("CRITERIA", "PRW")]
422         //[Property("COVPARAM", "")]
423         //[Property("AUTHOR", "guowei.wang@samsung.com")]
424         //public async Task WebViewHttpAuthRequested()
425         //{
426         //    tlog.Debug(tag, $"WebViewHttpAuthRequested START");
427
428         //    TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
429         //    EventHandler<WebViewHttpAuthRequestedEventArgs> onHttpAuthRequeste = (s, e) => { tcs.TrySetResult(true); };
430         //    webView.HttpAuthRequested += onHttpAuthRequeste;
431
432         //    webView.LoadUrl(urlForHttpAuthRequestTest);
433         //    var result = await tcs.Task;
434         //    Assert.IsTrue(result, "ResponsePolicyDecided event should be invoked");
435
436         //    webView.HttpAuthRequested -= onHttpAuthRequeste;
437
438         //    tlog.Debug(tag, $"WebViewHttpAuthRequested END (OK)");
439         //}
440
441         [Test]
442         [Category("P1")]
443         [Description("WebView ConsoleMessageReceived.")]
444         [Property("SPEC", "Tizen.NUI.WebView.ConsoleMessageReceived A")]
445         [Property("SPEC_URL", "-")]
446         [Property("CRITERIA", "PRW")]
447         [Property("COVPARAM", "")]
448         [Property("AUTHOR", "guowei.wang@samsung.com")]
449         public async Task WebViewConsoleMessageReceived()
450         {
451             tlog.Debug(tag, $"WebViewHttpAuthRequested START");
452
453             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
454             EventHandler<WebViewConsoleMessageReceivedEventArgs> onConsoleMessageReceive = (s, e) => { tcs.TrySetResult(true); };
455             webView.ConsoleMessageReceived += onConsoleMessageReceive;
456
457             webView.LoadUrl(urlForConsoleMessageTest);
458             var result = await tcs.Task;
459             Assert.IsTrue(result, "ConsoleMessageReceived event should be invoked");
460
461             webView.ConsoleMessageReceived -= onConsoleMessageReceive;
462
463             tlog.Debug(tag, $"WebViewConsoleMessageReceived END (OK)");
464         }
465
466         //TODO... move it to manual test...
467         //[Test]
468         //[Category("P1")]
469         //[Description("WebView ContextMenuShown.")]
470         //[Property("SPEC", "Tizen.NUI.WebView.ContextMenuShown A")]
471         //[Property("SPEC_URL", "-")]
472         //[Property("CRITERIA", "PRW")]
473         //[Property("COVPARAM", "")]
474         //[Property("AUTHOR", "guowei.wang@samsung.com")]
475         //public void WebViewContextMenuShown()
476         //{
477         //    tlog.Debug(tag, $"WebViewContextMenuShown START");
478
479         //    webView.ContextMenuShown += OnContextMenuShown;
480         //    webView.ContextMenuShown -= OnContextMenuShown;
481
482         //    tlog.Debug(tag, $"WebViewContextMenuShown END (OK)");
483         //}
484
485         //TODO... move it to manual test...
486         //[Test]
487         //[Category("P1")]
488         //[Description("WebView ContextMenuHidden.")]
489         //[Property("SPEC", "Tizen.NUI.WebView.ContextMenuHidden A")]
490         //[Property("SPEC_URL", "-")]
491         //[Property("CRITERIA", "PRW")]
492         //[Property("COVPARAM", "")]
493         //[Property("AUTHOR", "guowei.wang@samsung.com")]
494         //public void WebViewContextMenuHidden()
495         //{
496         //    tlog.Debug(tag, $"WebViewContextMenuHidden START");
497
498         //    webView.ContextMenuHidden += OnContextMenuHidden;
499         //    webView.ContextMenuHidden -= OnContextMenuHidden;
500
501         //    tlog.Debug(tag, $"WebViewContextMenuHidden END (OK)");
502         //}
503
504         [Test]
505         [Category("P1")]
506         [Description("WebView BackForwardList.")]
507         [Property("SPEC", "Tizen.NUI.WebView.BackForwardList A")]
508         [Property("SPEC_URL", "-")]
509         [Property("CRITERIA", "PRO")]
510         [Property("COVPARAM", "")]
511         [Property("AUTHOR", "guowei.wang@samsung.com")]
512         public void WebViewBackForwardList()
513         {
514             tlog.Debug(tag, $"WebViewBackForwardList START");
515
516             var result = webView.BackForwardList;
517             tlog.Debug(tag, "ForwardList : " + result);
518
519             tlog.Debug(tag, $"WebViewBackForwardList END (OK)");
520         }
521
522         [Test]
523         [Category("P1")]
524         [Description("WebView Context.")]
525         [Property("SPEC", "Tizen.NUI.WebView.Context A")]
526         [Property("SPEC_URL", "-")]
527         [Property("CRITERIA", "PRO")]
528         [Property("COVPARAM", "")]
529         [Property("AUTHOR", "guowei.wang@samsung.com")]
530         public void WebViewContext()
531         {
532             tlog.Debug(tag, $"WebViewContext START");
533
534             var result = webView.Context;
535             tlog.Debug(tag, "Context : " + result);
536
537             tlog.Debug(tag, $"WebViewContext END (OK)");
538         }
539
540         [Test]
541         [Category("P1")]
542         [Description("WebView CookieManager.")]
543         [Property("SPEC", "Tizen.NUI.WebView.CookieManager A")]
544         [Property("SPEC_URL", "-")]
545         [Property("CRITERIA", "PRO")]
546         [Property("COVPARAM", "")]
547         [Property("AUTHOR", "guowei.wang@samsung.com")]
548         public void WebViewCookieManager()
549         {
550             tlog.Debug(tag, $"WebViewCookieManager START");
551
552             var result = webView.CookieManager;
553             tlog.Debug(tag, "CookieManager : " + result);
554
555             tlog.Debug(tag, $"WebViewCookieManager END (OK)");
556         }
557
558         [Test]
559         [Category("P1")]
560         [Description("WebView Settings.")]
561         [Property("SPEC", "Tizen.NUI.WebView.Settings A")]
562         [Property("SPEC_URL", "-")]
563         [Property("CRITERIA", "PRO")]
564         [Property("COVPARAM", "")]
565         [Property("AUTHOR", "guowei.wang@samsung.com")]
566         public void WebViewSettings()
567         {
568             tlog.Debug(tag, $"WebViewSettings START");
569
570             var result = webView.Settings;
571             tlog.Debug(tag, "Settings : " + result);
572
573             tlog.Debug(tag, $"WebViewSettings END (OK)");
574         }
575
576         [Test]
577         [Category("P1")]
578         [Description("WebView Url.")]
579         [Property("SPEC", "Tizen.NUI.WebView.Url A")]
580         [Property("SPEC_URL", "-")]
581         [Property("CRITERIA", "PRW")]
582         [Property("COVPARAM", "")]
583         [Property("AUTHOR", "guowei.wang@samsung.com")]
584         public async Task WebViewUrl()
585         {
586             tlog.Debug(tag, $"WebViewUrl START");
587             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
588             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
589             {
590                 tcs.TrySetResult(true);
591             };
592             webView.PageLoadFinished += onLoadFinished;
593
594             webView.Url = url;
595             var result = await tcs.Task;
596             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
597
598             webView.PageLoadFinished -= onLoadFinished;
599
600             tlog.Debug(tag, "Url : " + webView.Url);
601             tlog.Debug(tag, $"WebViewUrl END (OK)");
602         }
603
604         [Test]
605         [Category("P1")]
606         [Description("WebView CacheModel.")]
607         [Property("SPEC", "Tizen.NUI.WebView.CacheModel A")]
608         [Property("SPEC_URL", "-")]
609         [Property("CRITERIA", "PRW")]
610         [Property("COVPARAM", "")]
611         [Property("AUTHOR", "guowei.wang@samsung.com")]
612         public void WebViewCacheModel()
613         {
614             tlog.Debug(tag, $"WebViewCacheModel START");
615
616             webView.CacheModel = Tizen.NUI.CacheModel.DocumentViewer;
617             tlog.Debug(tag, "CacheModel : " + webView.CacheModel);
618
619             webView.CacheModel = Tizen.NUI.CacheModel.DocumentBrowser;
620             tlog.Debug(tag, "CacheModel : " + webView.CacheModel);
621
622             webView.CacheModel = Tizen.NUI.CacheModel.PrimaryWebBrowser;
623             tlog.Debug(tag, "CacheModel : " + webView.CacheModel);
624
625             tlog.Debug(tag, $"WebViewCacheModel END (OK)");
626         }
627
628         [Test]
629         [Category("P1")]
630         [Description("WebView CookieAcceptPolicy.")]
631         [Property("SPEC", "Tizen.NUI.WebView.CookieAcceptPolicy A")]
632         [Property("SPEC_URL", "-")]
633         [Property("CRITERIA", "PRW")]
634         [Property("COVPARAM", "")]
635         [Property("AUTHOR", "guowei.wang@samsung.com")]
636         public void WebViewCookieAcceptPolicy()
637         {
638             tlog.Debug(tag, $"WebViewCookieAcceptPolicy START");
639
640             webView.CookieAcceptPolicy = (CookieAcceptPolicy)Tizen.NUI.WebCookieManager.CookieAcceptPolicyType.NoThirdParty;
641             tlog.Debug(tag, "CookieAcceptPolicy : " + webView.CookieAcceptPolicy);
642
643             webView.CookieAcceptPolicy = (CookieAcceptPolicy)Tizen.NUI.WebCookieManager.CookieAcceptPolicyType.Always;
644             tlog.Debug(tag, "CookieAcceptPolicy : " + webView.CookieAcceptPolicy);
645
646             webView.CookieAcceptPolicy = (CookieAcceptPolicy)Tizen.NUI.WebCookieManager.CookieAcceptPolicyType.Never;
647             tlog.Debug(tag, "CookieAcceptPolicy : " + webView.CookieAcceptPolicy);
648
649             tlog.Debug(tag, $"WebViewCookieAcceptPolicy END (OK)");
650         }
651
652         [Test]
653         [Category("P1")]
654         [Description("WebView UserAgent.")]
655         [Property("SPEC", "Tizen.NUI.WebView.UserAgent A")]
656         [Property("SPEC_URL", "-")]
657         [Property("CRITERIA", "PRW")]
658         [Property("COVPARAM", "")]
659         [Property("AUTHOR", "guowei.wang@samsung.com")]
660         public async Task WebViewUserAgent()
661         {
662             tlog.Debug(tag, $"WebViewUserAgent START");
663
664             webView.UserAgent = USER_AGENT;
665             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
666             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
667             {
668                 tcs.TrySetResult(true);
669             };
670             webView.PageLoadFinished += onLoadFinished;
671             webView.LoadUrl(url);
672             var result = await tcs.Task;
673             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
674
675             webView.PageLoadFinished -= onLoadFinished;
676
677             tlog.Debug(tag, "UserAgent : " + webView.UserAgent);
678             tlog.Debug(tag, $"WebViewUserAgent END (OK)");
679         }
680
681         [Test]
682         [Category("P1")]
683         [Description("WebView EnableJavaScript.")]
684         [Property("SPEC", "Tizen.NUI.WebView.EnableJavaScript A")]
685         [Property("SPEC_URL", "-")]
686         [Property("CRITERIA", "PRW")]
687         [Property("COVPARAM", "")]
688         [Property("AUTHOR", "guowei.wang@samsung.com")]
689         public void WebViewEnableJavaScript()
690         {
691             tlog.Debug(tag, $"WebViewEnableJavaScript START");
692
693             webView.EnableJavaScript = true;
694             tlog.Debug(tag, "EnableJavaScript : " + webView.EnableJavaScript);
695
696             webView.EnableJavaScript = false;
697             tlog.Debug(tag, "EnableJavaScript : " + webView.EnableJavaScript);
698
699             tlog.Debug(tag, $"WebViewEnableJavaScript END (OK)");
700         }
701
702         [Test]
703         [Category("P1")]
704         [Description("WebView LoadImagesAutomatically.")]
705         [Property("SPEC", "Tizen.NUI.WebView.LoadImagesAutomatically A")]
706         [Property("SPEC_URL", "-")]
707         [Property("CRITERIA", "PRW")]
708         [Property("COVPARAM", "")]
709         [Property("AUTHOR", "guowei.wang@samsung.com")]
710         public void WebViewLoadImagesAutomatically()
711         {
712             tlog.Debug(tag, $"WebViewLoadImagesAutomatically START");
713
714             webView.LoadImagesAutomatically = true;
715             tlog.Debug(tag, "LoadImagesAutomatically : " + webView.LoadImagesAutomatically);
716
717             webView.LoadImagesAutomatically = false;
718             tlog.Debug(tag, "LoadImagesAutomatically : " + webView.LoadImagesAutomatically);
719
720             tlog.Debug(tag, $"WebViewLoadImagesAutomatically END (OK)");
721         }
722
723         [Test]
724         [Category("P1")]
725         [Description("WebView DefaultTextEncodingName.")]
726         [Property("SPEC", "Tizen.NUI.WebView.DefaultTextEncodingName A")]
727         [Property("SPEC_URL", "-")]
728         [Property("CRITERIA", "PRW")]
729         [Property("COVPARAM", "")]
730         [Property("AUTHOR", "guowei.wang@samsung.com")]
731         public void WebViewDefaultTextEncodingName()
732         {
733             tlog.Debug(tag, $"WebViewDefaultTextEncodingName START");
734
735             var result = webView.DefaultTextEncodingName;
736             tlog.Debug(tag, "DefaultTextEncodingName : " + result);
737
738             webView.DefaultTextEncodingName = "gbk";
739             tlog.Debug(tag, "DefaultTextEncodingName : " + result);
740
741             tlog.Debug(tag, $"WebViewDefaultTextEncodingName END (OK)");
742         }
743
744         [Test]
745         [Category("P1")]
746         [Description("WebView DefaultFontSize.")]
747         [Property("SPEC", "Tizen.NUI.WebView.DefaultFontSize A")]
748         [Property("SPEC_URL", "-")]
749         [Property("CRITERIA", "PRW")]
750         [Property("COVPARAM", "")]
751         [Property("AUTHOR", "guowei.wang@samsung.com")]
752         public void WebViewDefaultFontSize()
753         {
754             tlog.Debug(tag, $"WebViewDefaultFontSize START");
755
756             var result = webView.DefaultFontSize;
757             tlog.Debug(tag, "DefaultFontSize : " + result);
758
759             webView.DefaultFontSize = 32;
760             tlog.Debug(tag, "DefaultFontSize : " + result);
761
762             tlog.Debug(tag, $"WebViewDefaultFontSize END (OK)");
763         }
764
765         [Test]
766         [Category("P1")]
767         [Description("WebView ScrollSize.")]
768         [Property("SPEC", "Tizen.NUI.WebView.ScrollSize A")]
769         [Property("SPEC_URL", "-")]
770         [Property("CRITERIA", "PRO")]
771         [Property("COVPARAM", "")]
772         [Property("AUTHOR", "guowei.wang@samsung.com")]
773         public void WebViewScrollSize()
774         {
775             tlog.Debug(tag, $"WebViewScrollSize START");
776
777             tlog.Debug(tag, "Width : " + webView.ScrollSize.Width);
778             tlog.Debug(tag, "Height : " + webView.ScrollSize.Height);
779
780             tlog.Debug(tag, $"WebViewScrollSize END (OK)");
781         }
782
783         [Test]
784         [Category("P1")]
785         [Description("WebView ContentSize.")]
786         [Property("SPEC", "Tizen.NUI.WebView.ContentSize A")]
787         [Property("SPEC_URL", "-")]
788         [Property("CRITERIA", "PRO")]
789         [Property("COVPARAM", "")]
790         [Property("AUTHOR", "guowei.wang@samsung.com")]
791         public void WebViewContentSize()
792         {
793             tlog.Debug(tag, $"WebViewContentSize START");
794
795             tlog.Debug(tag, "Width : " + webView.ContentSize.Width);
796             tlog.Debug(tag, "Height : " + webView.ContentSize.Height);
797
798             tlog.Debug(tag, $"WebViewContentSize END (OK)");
799         }
800
801         [Test]
802         [Category("P1")]
803         [Description("WebView VideoHoleEnabled.")]
804         [Property("SPEC", "Tizen.NUI.WebView.VideoHoleEnabled A")]
805         [Property("SPEC_URL", "-")]
806         [Property("CRITERIA", "PRW")]
807         [Property("COVPARAM", "")]
808         [Property("AUTHOR", "guowei.wang@samsung.com")]
809         public void WebViewVideoHoleEnabled()
810         {
811             tlog.Debug(tag, $"WebViewVideoHoleEnabled START");
812
813             webView.VideoHoleEnabled = true;
814             tlog.Debug(tag, "VideoHoleEnabled : " + webView.VideoHoleEnabled);
815
816             webView.VideoHoleEnabled = false;
817             tlog.Debug(tag, "VideoHoleEnabled : " + webView.VideoHoleEnabled);
818
819             tlog.Debug(tag, $"WebViewVideoHoleEnabled END (OK)");
820         }
821
822         [Test]
823         [Category("P1")]
824         [Description("WebView MouseEventsEnabled.")]
825         [Property("SPEC", "Tizen.NUI.WebView.MouseEventsEnabled A")]
826         [Property("SPEC_URL", "-")]
827         [Property("CRITERIA", "PRW")]
828         [Property("COVPARAM", "")]
829         [Property("AUTHOR", "guowei.wang@samsung.com")]
830         public void WebViewMouseEventsEnabled()
831         {
832             tlog.Debug(tag, $"WebViewMouseEventsEnabled START");
833
834             webView.MouseEventsEnabled = true;
835             tlog.Debug(tag, "MouseEventsEnabled : " + webView.MouseEventsEnabled);
836
837             webView.MouseEventsEnabled = false;
838             tlog.Debug(tag, "MouseEventsEnabled : " + webView.MouseEventsEnabled);
839
840             tlog.Debug(tag, $"WebViewMouseEventsEnabled END (OK)");
841         }
842
843         [Test]
844         [Category("P1")]
845         [Description("WebView KeyEventsEnabled.")]
846         [Property("SPEC", "Tizen.NUI.WebView.KeyEventsEnabled A")]
847         [Property("SPEC_URL", "-")]
848         [Property("CRITERIA", "PRW")]
849         [Property("COVPARAM", "")]
850         [Property("AUTHOR", "guowei.wang@samsung.com")]
851         public void WebViewKeyEventsEnabled()
852         {
853             tlog.Debug(tag, $"WebViewKeyEventsEnabled START");
854
855             webView.KeyEventsEnabled = true;
856             tlog.Debug(tag, "KeyEventsEnabled : " + webView.KeyEventsEnabled);
857
858             webView.KeyEventsEnabled = false;
859             tlog.Debug(tag, "KeyEventsEnabled : " + webView.KeyEventsEnabled);
860
861             tlog.Debug(tag, $"WebViewKeyEventsEnabled END (OK)");
862         }
863
864         [Test]
865         [Category("P1")]
866         [Description("WebView ContentBackgroundColor.")]
867         [Property("SPEC", "Tizen.NUI.WebView.ContentBackgroundColor A")]
868         [Property("SPEC_URL", "-")]
869         [Property("CRITERIA", "PRW")]
870         [Property("COVPARAM", "")]
871         [Property("AUTHOR", "guowei.wang@samsung.com")]
872         public async Task WebViewContentBackgroundColor()
873         {
874             tlog.Debug(tag, $"WebViewContentBackgroundColor START");
875
876             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
877             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
878             {
879                 webView.ContentBackgroundColor = new Vector4(0.3f, 0.5f, 1.0f, 0.0f);
880                 tcs.TrySetResult(true);
881             };
882             webView.PageLoadFinished += onLoadFinished;
883             webView.LoadUrl(url);
884             var result = await tcs.Task;
885             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
886
887             webView.PageLoadFinished -= onLoadFinished;
888
889             tlog.Debug(tag, "ContentBackgroundColor : " + webView.ContentBackgroundColor);
890
891             tlog.Debug(tag, $"WebViewContentBackgroundColor END (OK)");
892         }
893
894         [Test]
895         [Category("P1")]
896         [Description("WebView TilesClearedWhenHidden.")]
897         [Property("SPEC", "Tizen.NUI.WebView.TilesClearedWhenHidden A")]
898         [Property("SPEC_URL", "-")]
899         [Property("CRITERIA", "PRW")]
900         [Property("COVPARAM", "")]
901         [Property("AUTHOR", "guowei.wang@samsung.com")]
902         public void WebViewTilesClearedWhenHidden()
903         {
904             tlog.Debug(tag, $"WebViewTilesClearedWhenHidden START");
905
906             webView.TilesClearedWhenHidden = true;
907             tlog.Debug(tag, "TilesClearedWhenHidden : " + webView.TilesClearedWhenHidden);
908
909             webView.TilesClearedWhenHidden = false;
910             tlog.Debug(tag, "TilesClearedWhenHidden : " + webView.TilesClearedWhenHidden);
911
912             tlog.Debug(tag, $"WebViewTilesClearedWhenHidden END (OK)");
913         }
914
915         [Test]
916         [Category("P1")]
917         [Description("WebView TileCoverAreaMultiplier.")]
918         [Property("SPEC", "Tizen.NUI.WebView.TileCoverAreaMultiplier A")]
919         [Property("SPEC_URL", "-")]
920         [Property("CRITERIA", "PRW")]
921         [Property("COVPARAM", "")]
922         [Property("AUTHOR", "guowei.wang@samsung.com")]
923         public void WebViewTileCoverAreaMultiplier()
924         {
925             tlog.Debug(tag, $"WebViewTileCoverAreaMultiplier START");
926
927             webView.TileCoverAreaMultiplier = 0.3f;
928             tlog.Debug(tag, "TileCoverAreaMultiplier : " + webView.TileCoverAreaMultiplier);
929
930             tlog.Debug(tag, $"WebViewTileCoverAreaMultiplier END (OK)");
931         }
932
933         [Test]
934         [Category("P1")]
935         [Description("WebView CursorEnabledByClient.")]
936         [Property("SPEC", "Tizen.NUI.WebView.CursorEnabledByClient A")]
937         [Property("SPEC_URL", "-")]
938         [Property("CRITERIA", "PRW")]
939         [Property("COVPARAM", "")]
940         [Property("AUTHOR", "guowei.wang@samsung.com")]
941         public void WebViewCursorEnabledByClient()
942         {
943             tlog.Debug(tag, $"WebViewCursorEnabledByClient START");
944
945             webView.CursorEnabledByClient = true;
946             tlog.Debug(tag, "CursorEnabledByClient : " + webView.CursorEnabledByClient);
947
948             webView.CursorEnabledByClient = false;
949             tlog.Debug(tag, "CursorEnabledByClient : " + webView.CursorEnabledByClient);
950
951             tlog.Debug(tag, $"WebViewCursorEnabledByClient END (OK)");
952         }
953
954         [Test]
955         [Category("P1")]
956         [Description("WebView SelectedText.")]
957         [Property("SPEC", "Tizen.NUI.WebView.SelectedText A")]
958         [Property("SPEC_URL", "-")]
959         [Property("CRITERIA", "PRO")]
960         [Property("COVPARAM", "")]
961         [Property("AUTHOR", "guowei.wang@samsung.com")]
962         public void WebViewSelectedText()
963         {
964             tlog.Debug(tag, $"WebViewSelectedText START");
965
966             var text = webView.SelectedText;
967             tlog.Debug(tag, "SelectedText : " + text);
968
969             tlog.Debug(tag, $"WebViewSelectedText END (OK)");
970         }
971
972         [Test]
973         [Category("P1")]
974         [Description("WebView Title.")]
975         [Property("SPEC", "Tizen.NUI.WebView.Title A")]
976         [Property("SPEC_URL", "-")]
977         [Property("CRITERIA", "PRO")]
978         [Property("COVPARAM", "")]
979         [Property("AUTHOR", "guowei.wang@samsung.com")]
980         public void WebViewTitle()
981         {
982             tlog.Debug(tag, $"WebViewTitle START");
983
984             var title = webView.Title;
985             tlog.Debug(tag, "Title : " + title);
986
987             tlog.Debug(tag, $"WebViewTitle END (OK)");
988         }
989
990         [Test]
991         [Category("P1")]
992         [Description("WebView Favicon.")]
993         [Property("SPEC", "Tizen.NUI.WebView.Favicon A")]
994         [Property("SPEC_URL", "-")]
995         [Property("CRITERIA", "PRO")]
996         [Property("COVPARAM", "")]
997         [Property("AUTHOR", "guowei.wang@samsung.com")]
998         public void WebViewFavicon()
999         {
1000             tlog.Debug(tag, $"WebViewFavicon START");
1001
1002             var fav = webView.Favicon;
1003             tlog.Debug(tag, "Favicon : " + fav);
1004
1005             tlog.Debug(tag, $"WebViewFavicon END (OK)");
1006         }
1007
1008         [Test]
1009         [Category("P1")]
1010         [Description("WebView PageZoomFactor.")]
1011         [Property("SPEC", "Tizen.NUI.WebView.PageZoomFactor A")]
1012         [Property("SPEC_URL", "-")]
1013         [Property("CRITERIA", "PRW")]
1014         [Property("COVPARAM", "")]
1015         [Property("AUTHOR", "guowei.wang@samsung.com")]
1016         public void WebViewPageZoomFactor()
1017         {
1018             tlog.Debug(tag, $"WebViewPageZoomFactor START");
1019
1020             webView.PageZoomFactor = 0.3f;
1021             tlog.Debug(tag, "PageZoomFactor : " + webView.PageZoomFactor);
1022
1023             tlog.Debug(tag, $"WebViewPageZoomFactor END (OK)");
1024         }
1025
1026         [Test]
1027         [Category("P1")]
1028         [Description("WebView TextZoomFactor.")]
1029         [Property("SPEC", "Tizen.NUI.WebView.TextZoomFactor A")]
1030         [Property("SPEC_URL", "-")]
1031         [Property("CRITERIA", "PRW")]
1032         [Property("COVPARAM", "")]
1033         [Property("AUTHOR", "guowei.wang@samsung.com")]
1034         public void WebViewTextZoomFactor()
1035         {
1036             tlog.Debug(tag, $"WebViewTextZoomFactor START");
1037
1038             webView.TextZoomFactor = 0.2f;
1039             tlog.Debug(tag, "TextZoomFactor : " + webView.TextZoomFactor);
1040
1041             tlog.Debug(tag, $"WebViewTextZoomFactor END (OK)");
1042         }
1043
1044         [Test]
1045         [Category("P1")]
1046         [Description("WebView LoadProgressPercentage.")]
1047         [Property("SPEC", "Tizen.NUI.WebView.LoadProgressPercentage A")]
1048         [Property("SPEC_URL", "-")]
1049         [Property("CRITERIA", "PRO")]
1050         [Property("COVPARAM", "")]
1051         [Property("AUTHOR", "guowei.wang@samsung.com")]
1052         public void WebViewLoadProgressPercentage()
1053         {
1054             tlog.Debug(tag, $"WebViewLoadProgressPercentage START");
1055
1056             var result = webView.LoadProgressPercentage;
1057             tlog.Debug(tag, "LoadProgressPercentage : " + result);
1058
1059             tlog.Debug(tag, $"WebViewLoadProgressPercentage END (OK)");
1060         }
1061
1062         [Test]
1063         [Category("P1")]
1064         [Description("WebView LoadHtmlString.")]
1065         [Property("SPEC", "Tizen.NUI.WebView.LoadHtmlString M")]
1066         [Property("SPEC_URL", "-")]
1067         [Property("CRITERIA", "MR")]
1068         [Property("COVPARAM", "")]
1069         [Property("AUTHOR", "guowei.wang@samsung.com")]
1070         public async Task WebViewLoadHtmlString()
1071         {
1072             tlog.Debug(tag, $"WebViewLoadHtmlString START");
1073
1074             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1075             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1076             {
1077                 tlog.Info(tag, "onLoadFinished is called!");
1078                 tcs.TrySetResult(true);
1079             };
1080             webView.PageLoadFinished += onLoadFinished;
1081
1082             webView.LoadHtmlString("<html><head lang=\"en\"></head></html>");
1083
1084             var result = await tcs.Task;
1085             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1086
1087             webView.PageLoadFinished -= onLoadFinished;
1088
1089             tlog.Debug(tag, $"WebViewLoadHtmlString END (OK)");
1090         }
1091
1092         [Test]
1093         [Category("P1")]
1094         [Description("WebView LoadHTMLString.")]
1095         [Property("SPEC", "Tizen.NUI.WebView.LoadHTMLString M")]
1096         [Property("SPEC_URL", "-")]
1097         [Property("CRITERIA", "MR")]
1098         [Property("COVPARAM", "")]
1099         [Property("AUTHOR", "guowei.wang@samsung.com")]
1100         public async Task WebViewLoadHTMLString()
1101         {
1102             tlog.Debug(tag, $"WebViewLoadHTMLString START");
1103
1104             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1105             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1106             {
1107                 tlog.Info(tag, "onLoadFinished is called!");
1108                 tcs.TrySetResult(true);
1109             };
1110             webView.PageLoadFinished += onLoadFinished;
1111
1112             webView.LoadHTMLString("<html><head lang=\"en\"></head></html>");
1113
1114             var result = await tcs.Task;
1115             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1116
1117             webView.PageLoadFinished -= onLoadFinished;
1118
1119             tlog.Debug(tag, $"WebViewLoadHTMLString END (OK)");
1120         }
1121
1122         [Test]
1123         [Category("P1")]
1124         [Description("WebView LoadContents.")]
1125         [Property("SPEC", "Tizen.NUI.WebView.LoadContents M")]
1126         [Property("SPEC_URL", "-")]
1127         [Property("CRITERIA", "MR")]
1128         [Property("COVPARAM", "")]
1129         [Property("AUTHOR", "guowei.wang@samsung.com")]
1130         public async Task WebViewLoadContents()
1131         {
1132             tlog.Debug(tag, $"WebViewLoadContents START");
1133
1134             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1135             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1136             {
1137                 tlog.Info(tag, "onLoadFinished is called!");
1138                 tcs.TrySetResult(true);
1139             };
1140             webView.PageLoadFinished += onLoadFinished;
1141
1142             webView.LoadContents("body", 18, " ", "gbk", null);
1143
1144             var result = await tcs.Task;
1145             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1146
1147             webView.PageLoadFinished -= onLoadFinished;
1148
1149             tlog.Debug(tag, $"WebViewLoadContents END (OK)");
1150         }
1151
1152         [Test]
1153         [Category("P1")]
1154         [Description("WebView Reload.")]
1155         [Property("SPEC", "Tizen.NUI.WebView.Reload M")]
1156         [Property("SPEC_URL", "-")]
1157         [Property("CRITERIA", "MR")]
1158         [Property("COVPARAM", "")]
1159         [Property("AUTHOR", "guowei.wang@samsung.com")]
1160         public async Task WebViewReload()
1161         {
1162             tlog.Debug(tag, $"WebViewReload START");
1163
1164             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1165             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1166             {
1167                 tlog.Info(tag, "onLoadFinished is called!");
1168                 webView.Reload();
1169                 tcs.TrySetResult(true);
1170             };
1171             webView.PageLoadFinished += onLoadFinished;
1172
1173             webView.LoadUrl(url);
1174
1175             var result = await tcs.Task;
1176             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1177
1178             webView.PageLoadFinished -= onLoadFinished;
1179
1180             tlog.Debug(tag, $"WebViewReload END (OK)");
1181         }
1182
1183         [Test]
1184         [Category("P1")]
1185         [Description("WebView ReloadWithoutCache.")]
1186         [Property("SPEC", "Tizen.NUI.WebView.ReloadWithoutCache M")]
1187         [Property("SPEC_URL", "-")]
1188         [Property("CRITERIA", "MR")]
1189         [Property("COVPARAM", "")]
1190         [Property("AUTHOR", "guowei.wang@samsung.com")]
1191         public async Task WebViewReloadWithoutCache()
1192         {
1193             tlog.Debug(tag, $"WebViewReloadWithoutCache START");
1194
1195             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1196             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1197             {
1198                 tlog.Info(tag, "onLoadFinished is called!");
1199                 webView.ReloadWithoutCache();
1200                 tcs.TrySetResult(true);
1201             };
1202             webView.PageLoadFinished += onLoadFinished;
1203
1204             webView.LoadUrl(url);
1205
1206             var result = await tcs.Task;
1207             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1208
1209             webView.PageLoadFinished -= onLoadFinished;
1210
1211             tlog.Debug(tag, $"WebViewReloadWithoutCache END (OK)");
1212         }
1213
1214         [Test]
1215         [Category("P1")]
1216         [Description("WebView StopLoading.")]
1217         [Property("SPEC", "Tizen.NUI.WebView.StopLoading M")]
1218         [Property("SPEC_URL", "-")]
1219         [Property("CRITERIA", "MR")]
1220         [Property("COVPARAM", "")]
1221         [Property("AUTHOR", "guowei.wang@samsung.com")]
1222         public async Task WebViewStopLoading()
1223         {
1224             tlog.Debug(tag, $"WebViewStopLoading START");
1225
1226             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1227             EventHandler<WebViewPageLoadEventArgs> onLoadStarted = (s, e) =>
1228             {
1229                 tlog.Info(tag, "onLoadFinished is called!");
1230                 webView.StopLoading();
1231                 tcs.TrySetResult(true);
1232             };
1233             webView.PageLoadStarted += onLoadStarted;
1234
1235             webView.LoadUrl(url);
1236
1237             var result = await tcs.Task;
1238             Assert.IsTrue(result, "PageLoadStarted event should be invoked");
1239
1240             webView.PageLoadStarted -= onLoadStarted;
1241
1242             tlog.Debug(tag, $"WebViewStopLoading END (OK)");
1243         }
1244
1245         [Test]
1246         [Category("P1")]
1247         [Description("WebView Suspend.")]
1248         [Property("SPEC", "Tizen.NUI.WebView.Suspend M")]
1249         [Property("SPEC_URL", "-")]
1250         [Property("CRITERIA", "MR")]
1251         [Property("COVPARAM", "")]
1252         [Property("AUTHOR", "guowei.wang@samsung.com")]
1253         public async Task WebViewSuspend()
1254         {
1255             tlog.Debug(tag, $"WebViewSuspend START");
1256
1257             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1258             EventHandler<WebViewPageLoadEventArgs> onLoadStarted = (s, e) =>
1259             {
1260                 tlog.Info(tag, "onLoadStarted is called!");
1261                 webView.Suspend();
1262             };
1263             webView.PageLoadStarted += onLoadStarted;
1264
1265             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1266             {
1267                 tlog.Info(tag, "onLoadFinished is called!");
1268                 webView.Resume();
1269                 tcs.TrySetResult(true);
1270             };
1271             webView.PageLoadFinished += onLoadFinished;
1272
1273             webView.LoadUrl(url);
1274
1275             var result = await tcs.Task;
1276             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1277
1278             webView.PageLoadStarted -= onLoadStarted;
1279             webView.PageLoadFinished -= onLoadFinished;
1280
1281             tlog.Debug(tag, $"WebViewSuspend END (OK)");
1282         }
1283
1284         [Test]
1285         [Category("P1")]
1286         [Description("WebView SuspendNetworkLoading.")]
1287         [Property("SPEC", "Tizen.NUI.WebView.SuspendNetworkLoading M")]
1288         [Property("SPEC_URL", "-")]
1289         [Property("CRITERIA", "MR")]
1290         [Property("COVPARAM", "")]
1291         [Property("AUTHOR", "guowei.wang@samsung.com")]
1292         public async Task WebViewSuspendNetworkLoading()
1293         {
1294             tlog.Debug(tag, $"WebViewSuspendNetworkLoading START");
1295
1296             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1297             EventHandler<WebViewPageLoadEventArgs> onLoadStarted = (s, e) =>
1298             {
1299                 tlog.Info(tag, "onLoadStarted is called!");
1300                 webView.SuspendNetworkLoading();
1301             };
1302             webView.PageLoadStarted += onLoadStarted;
1303
1304             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1305             {
1306                 tlog.Info(tag, "onLoadFinished is called!");
1307                 webView.ResumeNetworkLoading();
1308                 tcs.TrySetResult(true);
1309             };
1310             webView.PageLoadFinished += onLoadFinished;
1311
1312             webView.LoadUrl(url);
1313
1314             var result = await tcs.Task;
1315             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1316
1317             webView.PageLoadStarted -= onLoadStarted;
1318             webView.PageLoadFinished -= onLoadFinished;
1319
1320             tlog.Debug(tag, $"WebViewSuspendNetworkLoading END (OK)");
1321         }
1322
1323         [Test]
1324         [Category("P1")]
1325         [Description("WebView AddCustomHeader.")]
1326         [Property("SPEC", "Tizen.NUI.WebView.AddCustomHeader M")]
1327         [Property("SPEC_URL", "-")]
1328         [Property("CRITERIA", "MR")]
1329         [Property("COVPARAM", "")]
1330         [Property("AUTHOR", "guowei.wang@samsung.com")]
1331         public void WebViewAddCustomHeader()
1332         {
1333             tlog.Debug(tag, $"WebViewAddCustomHeader START");
1334
1335             var result = webView.AddCustomHeader("customHeader_title", "font-size: 32rpx");
1336             tlog.Debug(tag, "AddCustomHeader : " + result);
1337
1338             result = webView.RemoveCustomHeader("customHeader_title");
1339             tlog.Debug(tag, "RemoveCustomHeader : " + result);
1340
1341             tlog.Debug(tag, $"WebViewAddCustomHeader END (OK)");
1342         }
1343
1344         [Test]
1345         [Category("P1")]
1346         [Description("WebView ScrollBy.")]
1347         [Property("SPEC", "Tizen.NUI.WebView.ScrollBy M")]
1348         [Property("SPEC_URL", "-")]
1349         [Property("CRITERIA", "MR")]
1350         [Property("COVPARAM", "")]
1351         [Property("AUTHOR", "guowei.wang@samsung.com")]
1352         public async Task WebViewScrollBy()
1353         {
1354             tlog.Debug(tag, $"WebViewScrollBy START");
1355
1356             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1357             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1358             {
1359                 tlog.Info(tag, "onLoadFinished is called!");
1360                 webView.ScrollBy(0, 60);
1361                 tcs.TrySetResult(true);
1362             };
1363             webView.PageLoadFinished += onLoadFinished;
1364
1365             webView.LoadUrl(url);
1366             var result = await tcs.Task;
1367             Assert.IsTrue(result, "ScrollEdgeReached event should be invoked");
1368
1369             webView.PageLoadFinished -= onLoadFinished;
1370
1371             tlog.Debug(tag, $"WebViewScrollBy END (OK)");
1372         }
1373
1374         [Test]
1375         [Category("P1")]
1376         [Description("WebView ScrollEdgeBy.")]
1377         [Property("SPEC", "Tizen.NUI.WebView.ScrollEdgeBy M")]
1378         [Property("SPEC_URL", "-")]
1379         [Property("CRITERIA", "MR")]
1380         [Property("COVPARAM", "")]
1381         [Property("AUTHOR", "guowei.wang@samsung.com")]
1382         public async Task WebViewScrollEdgeBy()
1383         {
1384             tlog.Debug(tag, $"WebViewScrollEdgeBy START");
1385
1386             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1387             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1388             {
1389                 tlog.Info(tag, "onLoadFinished is called!");
1390                 webView.ScrollEdgeBy(0, 60);
1391                 tcs.TrySetResult(true);
1392             };
1393             webView.PageLoadFinished += onLoadFinished;
1394
1395             webView.LoadUrl(url);
1396             var result = await tcs.Task;
1397             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1398
1399             webView.PageLoadFinished -= onLoadFinished;
1400
1401             tlog.Debug(tag, $"WebViewScrollEdgeBy END (OK)");
1402         }
1403
1404         [Test]
1405         [Category("P1")]
1406         [Description("WebView GoBack.")]
1407         [Property("SPEC", "Tizen.NUI.WebView.GoBack M")]
1408         [Property("SPEC_URL", "-")]
1409         [Property("CRITERIA", "MR")]
1410         [Property("COVPARAM", "")]
1411         [Property("AUTHOR", "guowei.wang@samsung.com")]
1412         public async Task WebViewGoBack()
1413         {
1414             tlog.Debug(tag, $"WebViewGoBack START");
1415
1416             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1417             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1418             {
1419                 if (webView.Url.Contains("index.html"))
1420                 {
1421                     tlog.Info(tag, "onLoadFinished is called!");
1422                     webView.LoadUrl(secondUrl);
1423                 }
1424                 else
1425                 {
1426                     tlog.Info(tag, "onLoadFinished is called!");
1427                     webView.GoBack();
1428                     tcs.TrySetResult(true);
1429                 }
1430             };
1431             webView.PageLoadFinished += onLoadFinished;
1432
1433             webView.LoadUrl(url);
1434             var result = await tcs.Task;
1435             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1436
1437             webView.PageLoadFinished -= onLoadFinished;
1438
1439             tlog.Debug(tag, $"WebViewGoBack END (OK)");
1440         }
1441
1442         [Test]
1443         [Category("P1")]
1444         [Description("WebView GoForward.")]
1445         [Property("SPEC", "Tizen.NUI.WebView.GoForward M")]
1446         [Property("SPEC_URL", "-")]
1447         [Property("CRITERIA", "MR")]
1448         [Property("COVPARAM", "")]
1449         [Property("AUTHOR", "guowei.wang@samsung.com")]
1450         public async Task WebViewGoForward()
1451         {
1452             tlog.Debug(tag, $"WebViewGoForward START");
1453
1454             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1455             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1456             {
1457                 if (webView.Url.Contains("index.html"))
1458                 {
1459                     tlog.Info(tag, "onLoadFinished is called!");
1460                     webView.LoadUrl(secondUrl);
1461                 }
1462                 else
1463                 {
1464                     tlog.Info(tag, "onLoadFinished is called!");
1465                     webView.GoBack();
1466                     webView.GoForward();
1467                     tcs.TrySetResult(true);
1468                 }
1469             };
1470             webView.PageLoadFinished += onLoadFinished;
1471
1472             webView.LoadUrl(url);
1473             var result = await tcs.Task;
1474             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1475
1476             webView.PageLoadFinished -= onLoadFinished;
1477
1478             tlog.Debug(tag, $"WebViewGoForward END (OK)");
1479         }
1480
1481         [Test]
1482         [Category("P1")]
1483         [Description("WebView CanGoBack.")]
1484         [Property("SPEC", "Tizen.NUI.WebView.CanGoBack M")]
1485         [Property("SPEC_URL", "-")]
1486         [Property("CRITERIA", "MR")]
1487         [Property("COVPARAM", "")]
1488         [Property("AUTHOR", "guowei.wang@samsung.com")]
1489         public async Task WebViewCanGoBack()
1490         {
1491             tlog.Debug(tag, $"WebViewCanGoBack START");
1492
1493             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1494             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1495             {
1496                 if (webView.Url.Contains("index.html"))
1497                 {
1498                     tlog.Info(tag, "onLoadFinished is called!");
1499                     webView.LoadUrl(secondUrl);
1500                 }
1501                 else
1502                 {
1503                     tlog.Info(tag, "onLoadFinished is called!");
1504                     var canGo = webView.CanGoBack();
1505                     tcs.TrySetResult(canGo);
1506                 }
1507             };
1508             webView.PageLoadFinished += onLoadFinished;
1509
1510             webView.LoadUrl(url);
1511             var result = await tcs.Task;
1512             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1513
1514             webView.PageLoadFinished -= onLoadFinished;
1515
1516             tlog.Debug(tag, $"WebViewCanGoBack END (OK)");
1517         }
1518
1519         [Test]
1520         [Category("P1")]
1521         [Description("WebView CanGoForward.")]
1522         [Property("SPEC", "Tizen.NUI.WebView.CanGoForward M")]
1523         [Property("SPEC_URL", "-")]
1524         [Property("CRITERIA", "MR")]
1525         [Property("COVPARAM", "")]
1526         [Property("AUTHOR", "guowei.wang@samsung.com")]
1527         public async Task WebViewCanGoForward()
1528         {
1529             tlog.Debug(tag, $"WebViewCanGoForward START");
1530
1531             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1532             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1533             {
1534                 if (webView.Url.Contains("index.html"))
1535                 {
1536                     tlog.Info(tag, "onLoadFinished is called!");
1537                     webView.LoadUrl(secondUrl);
1538                 }
1539                 else
1540                 {
1541                     tlog.Info(tag, "onLoadFinished is called!");
1542                     webView.GoBack();
1543                     var canGo = webView.CanGoForward();
1544                     tcs.TrySetResult(true);
1545                 }
1546             };
1547             webView.PageLoadFinished += onLoadFinished;
1548
1549             webView.LoadUrl(url);
1550             var result = await tcs.Task;
1551             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1552
1553             webView.PageLoadFinished -= onLoadFinished;
1554
1555             tlog.Debug(tag, $"WebViewCanGoForward END (OK)");
1556         }
1557
1558         [Test]
1559         [Category("P1")]
1560         [Description("WebView EvaluateJavaScript.")]
1561         [Property("SPEC", "Tizen.NUI.WebView.EvaluateJavaScript M")]
1562         [Property("SPEC_URL", "-")]
1563         [Property("CRITERIA", "MR")]
1564         [Property("COVPARAM", "")]
1565         [Property("AUTHOR", "guowei.wang@samsung.com")]
1566         public async Task WebViewEvaluateJavaScript()
1567         {
1568             tlog.Debug(tag, $"WebViewEvaluateJavaScript START");
1569
1570             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1571             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1572             {
1573                 tlog.Info(tag, "onLoadFinished is called!");
1574                 webView.EvaluateJavaScript("<script type=\"text / javascript\">document.write(\"page\");</script>");
1575                 tcs.TrySetResult(true);
1576             };
1577             webView.PageLoadFinished += onLoadFinished;
1578
1579             webView.LoadUrl(url);
1580             var result = await tcs.Task;
1581             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1582
1583             webView.PageLoadFinished -= onLoadFinished;
1584
1585             tlog.Debug(tag, $"WebViewEvaluateJavaScript END (OK)");
1586         }
1587
1588         [Test]
1589         [Category("P1")]
1590         [Description("WebView AddJavaScriptMessageHandler.")]
1591         [Property("SPEC", "Tizen.NUI.WebView.AddJavaScriptMessageHandler M")]
1592         [Property("SPEC_URL", "-")]
1593         [Property("CRITERIA", "MR")]
1594         [Property("COVPARAM", "")]
1595         [Property("AUTHOR", "guowei.wang@samsung.com")]
1596         public async Task WebViewAddJavaScriptMessageHandler()
1597         {
1598             tlog.Debug(tag, $"WebViewAddJavaScriptMessageHandler START");
1599
1600             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1601             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1602             {
1603                 tlog.Info(tag, "onLoadFinished is called!");
1604                 webView.AddJavaScriptMessageHandler("AllowOrigin", JsCallback);
1605                 tcs.TrySetResult(true);
1606             };
1607             webView.PageLoadFinished += onLoadFinished;
1608
1609             webView.LoadUrl(url);
1610             var result = await tcs.Task;
1611             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1612
1613             webView.PageLoadFinished -= onLoadFinished;
1614
1615             tlog.Debug(tag, $"WebViewAddJavaScriptMessageHandler END (OK)");
1616         }
1617
1618         [Test]
1619         [Category("P1")]
1620         [Description("WebView RegisterJavaScriptAlertCallback.")]
1621         [Property("SPEC", "Tizen.NUI.WebView.RegisterJavaScriptAlertCallback M")]
1622         [Property("SPEC_URL", "-")]
1623         [Property("CRITERIA", "MR")]
1624         [Property("COVPARAM", "")]
1625         [Property("AUTHOR", "guowei.wang@samsung.com")]
1626         public async Task WebViewRegisterJavaScriptAlertCallback()
1627         {
1628             tlog.Debug(tag, $"WebViewRegisterJavaScriptAlertCallback START");
1629
1630             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1631             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1632             {
1633                 tlog.Info(tag, "onLoadFinished is called!");
1634                 tcs.TrySetResult(true);
1635             };
1636             webView.PageLoadFinished += onLoadFinished;
1637
1638             webView.RegisterJavaScriptAlertCallback(JsCallback);
1639
1640             webView.LoadUrl(url);
1641             var result = await tcs.Task;
1642             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1643
1644             webView.PageLoadFinished -= onLoadFinished;
1645
1646             tlog.Debug(tag, $"WebViewRegisterJavaScriptAlertCallback END (OK)");
1647         }
1648
1649         [Test]
1650         [Category("P1")]
1651         [Description("WebView RegisterJavaScriptConfirmCallback.")]
1652         [Property("SPEC", "Tizen.NUI.WebView.RegisterJavaScriptConfirmCallback M")]
1653         [Property("SPEC_URL", "-")]
1654         [Property("CRITERIA", "MR")]
1655         [Property("COVPARAM", "")]
1656         [Property("AUTHOR", "guowei.wang@samsung.com")]
1657         public async Task WebViewRegisterJavaScriptConfirmCallback()
1658         {
1659             tlog.Debug(tag, $"WebViewRegisterJavaScriptConfirmCallback START");
1660
1661             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1662             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1663             {
1664                 tlog.Info(tag, "onLoadFinished is called!");
1665                 tcs.TrySetResult(true);
1666             };
1667             webView.PageLoadFinished += onLoadFinished;
1668
1669             webView.RegisterJavaScriptConfirmCallback(JsCallback);
1670
1671             webView.LoadUrl(url);
1672             var result = await tcs.Task;
1673             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1674
1675             webView.PageLoadFinished -= onLoadFinished;
1676
1677             tlog.Debug(tag, $"WebViewRegisterJavaScriptConfirmCallback END (OK)");
1678         }
1679
1680         [Test]
1681         [Category("P1")]
1682         [Description("WebView RegisterJavaScriptPromptCallback.")]
1683         [Property("SPEC", "Tizen.NUI.WebView.RegisterJavaScriptPromptCallback M")]
1684         [Property("SPEC_URL", "-")]
1685         [Property("CRITERIA", "MR")]
1686         [Property("COVPARAM", "")]
1687         [Property("AUTHOR", "guowei.wang@samsung.com")]
1688         public async Task WebViewRegisterJavaScriptPromptCallback()
1689         {
1690             tlog.Debug(tag, $"WebViewRegisterJavaScriptPromptCallback START");
1691
1692             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1693             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1694             {
1695                 tlog.Info(tag, "onLoadFinished is called!");
1696                 tcs.TrySetResult(true);
1697             };
1698             webView.PageLoadFinished += onLoadFinished;
1699
1700             webView.RegisterJavaScriptPromptCallback(PromptCallback);
1701
1702             webView.LoadUrl(url);
1703             var result = await tcs.Task;
1704             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1705
1706             webView.PageLoadFinished -= onLoadFinished;
1707
1708             tlog.Debug(tag, $"WebViewRegisterJavaScriptPromptCallback END (OK)");
1709         }
1710
1711         [Test]
1712         [Category("P1")]
1713         [Description("WebView ClearAllTilesResources.")]
1714         [Property("SPEC", "Tizen.NUI.WebView.ClearAllTilesResources M")]
1715         [Property("SPEC_URL", "-")]
1716         [Property("CRITERIA", "MR")]
1717         [Property("COVPARAM", "")]
1718         [Property("AUTHOR", "guowei.wang@samsung.com")]
1719         public async Task WebViewClearAllTilesResources()
1720         {
1721             tlog.Debug(tag, $"WebViewClearAllTilesResources START");
1722
1723             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1724             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1725             {
1726                 tlog.Info(tag, "onLoadFinished is called!");
1727                 webView.ClearAllTilesResources();
1728                 tcs.TrySetResult(true);
1729             };
1730             webView.PageLoadFinished += onLoadFinished;
1731
1732             webView.LoadUrl(url);
1733             var result = await tcs.Task;
1734             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1735
1736             webView.PageLoadFinished -= onLoadFinished;
1737
1738             tlog.Debug(tag, $"WebViewClearAllTilesResources END (OK)");
1739         }
1740
1741         [Test]
1742         [Category("P1")]
1743         [Description("WebView ClearHistory.")]
1744         [Property("SPEC", "Tizen.NUI.WebView.ClearHistory M")]
1745         [Property("SPEC_URL", "-")]
1746         [Property("CRITERIA", "MR")]
1747         [Property("COVPARAM", "")]
1748         [Property("AUTHOR", "guowei.wang@samsung.com")]
1749         public async Task WebViewClearHistory()
1750         {
1751             tlog.Debug(tag, $"WebViewClearHistory START");
1752
1753             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1754             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1755             {
1756                 tlog.Info(tag, "onLoadFinished is called!");
1757                 webView.ClearHistory();
1758                 tcs.TrySetResult(true);
1759             };
1760             webView.PageLoadFinished += onLoadFinished;
1761
1762             webView.LoadUrl(url);
1763             var result = await tcs.Task;
1764             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1765
1766             webView.PageLoadFinished -= onLoadFinished;
1767
1768             tlog.Debug(tag, $"WebViewClearHistory END (OK)");
1769         }
1770
1771         [Test]
1772         [Category("P1")]
1773         [Description("WebView SetScaleFactor.")]
1774         [Property("SPEC", "Tizen.NUI.WebView.SetScaleFactor M")]
1775         [Property("SPEC_URL", "-")]
1776         [Property("CRITERIA", "MR")]
1777         [Property("COVPARAM", "")]
1778         [Property("AUTHOR", "guowei.wang@samsung.com")]
1779         public async Task WebViewSetScaleFactor()
1780         {
1781             tlog.Debug(tag, $"WebViewSetScaleFactor START");
1782
1783             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1784             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1785             {
1786                 tlog.Info(tag, "onLoadFinished is called!");
1787                 using (Vector2 point = new Vector2(1.0f, 1.0f))
1788                 {
1789                     webView.SetScaleFactor(0.2f, point);
1790
1791                     var factor = webView.GetScaleFactor();
1792                     tlog.Debug(tag, "ScaleFactor : " + factor);
1793                 }
1794                 tcs.TrySetResult(true);
1795             };
1796             webView.PageLoadFinished += onLoadFinished;
1797
1798             webView.LoadUrl(url);
1799             var result = await tcs.Task;
1800             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1801
1802             webView.PageLoadFinished -= onLoadFinished;
1803
1804             tlog.Debug(tag, $"WebViewSetScaleFactor END (OK)");
1805         }
1806
1807         [Test]
1808         [Category("P1")]
1809         [Description("WebView ActivateAccessibility.")]
1810         [Property("SPEC", "Tizen.NUI.WebView.ActivateAccessibility M")]
1811         [Property("SPEC_URL", "-")]
1812         [Property("CRITERIA", "MR")]
1813         [Property("COVPARAM", "")]
1814         [Property("AUTHOR", "guowei.wang@samsung.com")]
1815         public async Task WebViewActivateAccessibility()
1816         {
1817             tlog.Debug(tag, $"WebViewActivateAccessibility START");
1818
1819             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1820             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1821             {
1822                 tlog.Info(tag, "onLoadFinished is called!");
1823                 webView.ActivateAccessibility(false);
1824                 tcs.TrySetResult(true);
1825             };
1826             webView.PageLoadFinished += onLoadFinished;
1827
1828             webView.LoadUrl(url);
1829             var result = await tcs.Task;
1830             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1831
1832             webView.PageLoadFinished -= onLoadFinished;
1833
1834             tlog.Debug(tag, $"WebViewActivateAccessibility END (OK)");
1835         }
1836
1837         [Test]
1838         [Category("P1")]
1839         [Description("WebView HighlightText.")]
1840         [Property("SPEC", "Tizen.NUI.WebView.HighlightText M")]
1841         [Property("SPEC_URL", "-")]
1842         [Property("CRITERIA", "MR")]
1843         [Property("COVPARAM", "")]
1844         [Property("AUTHOR", "guowei.wang@samsung.com")]
1845         public async Task WebViewHighlightText()
1846         {
1847             tlog.Debug(tag, $"WebViewHighlightText START");
1848
1849             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1850             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1851             {
1852                 tlog.Info(tag, "onLoadFinished is called!");
1853                 webView.HighlightText("web", BaseComponents.WebView.FindOption.AtWordStart, 3);
1854                 tcs.TrySetResult(true);
1855             };
1856             webView.PageLoadFinished += onLoadFinished;
1857
1858             webView.LoadUrl(url);
1859             var result = await tcs.Task;
1860             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1861
1862             webView.PageLoadFinished -= onLoadFinished;
1863
1864             tlog.Debug(tag, $"WebViewHighlightText END (OK)");
1865         }
1866
1867         [Test]
1868         [Category("P1")]
1869         [Description("WebView AddDynamicCertificatePath.")]
1870         [Property("SPEC", "Tizen.NUI.WebView.AddDynamicCertificatePath M")]
1871         [Property("SPEC_URL", "-")]
1872         [Property("CRITERIA", "MR")]
1873         [Property("COVPARAM", "")]
1874         [Property("AUTHOR", "guowei.wang@samsung.com")]
1875         public async Task WebViewAddDynamicCertificatePath()
1876         {
1877             tlog.Debug(tag, $"WebViewAddDynamicCertificatePath START");
1878
1879             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1880             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1881             {
1882                 tlog.Info(tag, "onLoadFinished is called!");
1883                 webView.AddDynamicCertificatePath("127.0.0.0", "/");
1884                 tcs.TrySetResult(true);
1885             };
1886             webView.PageLoadFinished += onLoadFinished;
1887
1888             webView.LoadUrl(url);
1889             var result = await tcs.Task;
1890             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1891
1892             webView.PageLoadFinished -= onLoadFinished;
1893
1894             tlog.Debug(tag, $"WebViewAddDynamicCertificatePath END (OK)");
1895         }
1896
1897         [Test]
1898         [Category("P1")]
1899         [Description("WebView CheckVideoPlayingAsynchronously.")]
1900         [Property("SPEC", "Tizen.NUI.WebView.CheckVideoPlayingAsynchronously M")]
1901         [Property("SPEC_URL", "-")]
1902         [Property("CRITERIA", "MR")]
1903         [Property("COVPARAM", "")]
1904         [Property("AUTHOR", "guowei.wang@samsung.com")]
1905         public async Task WebViewCheckVideoPlayingAsynchronously()
1906         {
1907             tlog.Debug(tag, $"WebViewCheckVideoPlayingAsynchronously START");
1908
1909             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1910             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1911             {
1912                 tlog.Info(tag, "onLoadFinished is called!");
1913                 webView.CheckVideoPlayingAsynchronously(VideoCallback);
1914                 tcs.TrySetResult(true);
1915             };
1916             webView.PageLoadFinished += onLoadFinished;
1917
1918             webView.LoadUrl(url);
1919             var result = await tcs.Task;
1920             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1921
1922             webView.PageLoadFinished -= onLoadFinished;
1923
1924             tlog.Debug(tag, $"WebViewCheckVideoPlayingAsynchronously END (OK)");
1925         }
1926
1927         [Test]
1928         [Category("P1")]
1929         [Description("WebView RegisterGeolocationPermissionCallback.")]
1930         [Property("SPEC", "Tizen.NUI.WebView.RegisterGeolocationPermissionCallback M")]
1931         [Property("SPEC_URL", "-")]
1932         [Property("CRITERIA", "MR")]
1933         [Property("COVPARAM", "")]
1934         [Property("AUTHOR", "guowei.wang@samsung.com")]
1935         public async Task WebViewRegisterGeolocationPermissionCallback()
1936         {
1937             tlog.Debug(tag, $"WebViewRegisterGeolocationPermissionCallback START");
1938
1939             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1940             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1941             {
1942                 tlog.Info(tag, "onLoadFinished is called!");
1943                 tcs.TrySetResult(true);
1944             };
1945             webView.PageLoadFinished += onLoadFinished;
1946
1947             webView.RegisterGeolocationPermissionCallback(GeolocationCallback);
1948
1949             webView.LoadUrl(url);
1950             var result = await tcs.Task;
1951             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1952
1953             webView.PageLoadFinished -= onLoadFinished;
1954
1955             tlog.Debug(tag, $"WebViewRegisterGeolocationPermissionCallback END (OK)");
1956         }
1957
1958         [Test]
1959         [Category("P1")]
1960         [Description("WebView GetPlainTextAsynchronously.")]
1961         [Property("SPEC", "Tizen.NUI.WebView.GetPlainTextAsynchronously M")]
1962         [Property("SPEC_URL", "-")]
1963         [Property("CRITERIA", "MR")]
1964         [Property("COVPARAM", "")]
1965         [Property("AUTHOR", "guowei.wang@samsung.com")]
1966         public async Task WebViewGetPlainTextAsynchronously()
1967         {
1968             tlog.Debug(tag, $"WebViewGetPlainTextAsynchronously START");
1969
1970             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
1971             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
1972             {
1973                 tlog.Info(tag, "onLoadFinished is called!");
1974                 webView.GetPlainTextAsynchronously(PlainReceivedCallback);
1975                 tcs.TrySetResult(true);
1976             };
1977             webView.PageLoadFinished += onLoadFinished;
1978
1979             webView.LoadUrl(url);
1980             var result = await tcs.Task;
1981             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
1982
1983             webView.PageLoadFinished -= onLoadFinished;
1984
1985             tlog.Debug(tag, $"WebViewGetPlainTextAsynchronously END (OK)");
1986         }
1987
1988         [Test]
1989         [Category("P1")]
1990         [Description("WebView SetTtsFocus.")]
1991         [Property("SPEC", "Tizen.NUI.WebView.SetTtsFocus M")]
1992         [Property("SPEC_URL", "-")]
1993         [Property("CRITERIA", "MR")]
1994         [Property("COVPARAM", "")]
1995         [Property("AUTHOR", "guowei.wang@samsung.com")]
1996         public async Task WebViewSetTtsFocus()
1997         {
1998             tlog.Debug(tag, $"WebViewSetTtsFocus START");
1999
2000             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
2001             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
2002             {
2003                 tlog.Info(tag, "onLoadFinished is called!");
2004                 webView.SetTtsFocus(false);
2005                 tcs.TrySetResult(true);
2006             };
2007             webView.PageLoadFinished += onLoadFinished;
2008
2009             webView.LoadUrl(url);
2010             var result = await tcs.Task;
2011             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
2012
2013             webView.PageLoadFinished -= onLoadFinished;
2014
2015             tlog.Debug(tag, $"WebViewSetTtsFocus END (OK)");
2016         }
2017
2018         [Test]
2019         [Category("P1")]
2020         [Description("WebView GetScreenshot.")]
2021         [Property("SPEC", "Tizen.NUI.WebView.GetScreenshot M")]
2022         [Property("SPEC_URL", "-")]
2023         [Property("CRITERIA", "MR")]
2024         [Property("COVPARAM", "")]
2025         [Property("AUTHOR", "guowei.wang@samsung.com")]
2026         public async Task WebViewGetScreenshot()
2027         {
2028             tlog.Debug(tag, $"WebViewGetScreenshot START");
2029
2030             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
2031             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
2032             {
2033                 tlog.Info(tag, "onLoadFinished is called!");
2034                 var factor = webView.GetScaleFactor();
2035                 webView.GetScreenshot(new Rectangle(5, 6, 100, 200), factor);
2036                 tcs.TrySetResult(true);
2037             };
2038             webView.PageLoadFinished += onLoadFinished;
2039
2040             webView.LoadUrl(url);
2041             var result = await tcs.Task;
2042             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
2043
2044             webView.PageLoadFinished -= onLoadFinished;
2045
2046             tlog.Debug(tag, $"WebViewGetScreenshot END (OK)");
2047         }
2048
2049         [Test]
2050         [Category("P1")]
2051         [Description("WebView GetScreenshotAsynchronously.")]
2052         [Property("SPEC", "Tizen.NUI.WebView.GetScreenshotAsynchronously M")]
2053         [Property("SPEC_URL", "-")]
2054         [Property("CRITERIA", "MR")]
2055         [Property("COVPARAM", "")]
2056         [Property("AUTHOR", "guowei.wang@samsung.com")]
2057         public async Task WebViewGetScreenshotAsynchronously()
2058         {
2059             tlog.Debug(tag, $"WebViewGetScreenshotAsynchronously START");
2060
2061             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
2062             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
2063             {
2064                 tlog.Info(tag, "onLoadFinished is called!");
2065                 var factor = webView.GetScaleFactor();
2066                 webView.GetScreenshotAsynchronously(new Rectangle(5, 6, 50, 50), factor, ScreenshotAcquiredCallbackCase);
2067                 tcs.TrySetResult(true);
2068             };
2069             webView.PageLoadFinished += onLoadFinished;
2070
2071             webView.LoadUrl(url);
2072             var result = await tcs.Task;
2073             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
2074
2075             webView.PageLoadFinished -= onLoadFinished;
2076
2077             tlog.Debug(tag, $"WebViewGetScreenshotAsynchronously END (OK)");
2078         }
2079
2080         [Test]
2081         [Category("P1")]
2082         [Description("WebView EvaluateJavaScript.")]
2083         [Property("SPEC", "Tizen.NUI.WebView.EvaluateJavaScript M")]
2084         [Property("SPEC_URL", "-")]
2085         [Property("CRITERIA", "MR")]
2086         [Property("COVPARAM", "")]
2087         [Property("AUTHOR", "guowei.wang@samsung.com")]
2088         public async Task WebViewEvaluateJavaScriptWithCallback()
2089         {
2090             tlog.Debug(tag, $"WebViewEvaluateJavaScriptWithCallback START");
2091
2092             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
2093             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
2094             {
2095                 tlog.Info(tag, "onLoadFinished is called!");
2096                 webView.EvaluateJavaScript("<script type=\"text / javascript\">document.write(\"page\");</script>", JsCallback);
2097                 tcs.TrySetResult(true);
2098             };
2099             webView.PageLoadFinished += onLoadFinished;
2100
2101             webView.LoadUrl(url);
2102             var result = await tcs.Task;
2103             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
2104
2105             webView.PageLoadFinished -= onLoadFinished;
2106
2107             tlog.Debug(tag, $"WebViewEvaluateJavaScriptWithCallback END (OK)");
2108         }
2109
2110         [Test]
2111         [Category("P1")]
2112         [Description("WebView ClearCache.")]
2113         [Property("SPEC", "Tizen.NUI.WebView.ClearCache M")]
2114         [Property("SPEC_URL", "-")]
2115         [Property("CRITERIA", "MR")]
2116         [Property("COVPARAM", "")]
2117         [Property("AUTHOR", "guowei.wang@samsung.com")]
2118         public async Task WebViewClearCache()
2119         {
2120             tlog.Debug(tag, $"WebViewClearCache START");
2121
2122             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
2123             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
2124             {
2125                 tlog.Info(tag, "onLoadFinished is called!");
2126                 webView.ClearCache();
2127                 tcs.TrySetResult(true);
2128             };
2129             webView.PageLoadFinished += onLoadFinished;
2130
2131             webView.LoadUrl(url);
2132             var result = await tcs.Task;
2133             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
2134
2135             webView.PageLoadFinished -= onLoadFinished;
2136
2137             tlog.Debug(tag, $"WebViewClearCache END (OK)");
2138         }
2139
2140         [Test]
2141         [Category("P1")]
2142         [Description("WebView ClearCookies.")]
2143         [Property("SPEC", "Tizen.NUI.WebView.ClearCookies M")]
2144         [Property("SPEC_URL", "-")]
2145         [Property("CRITERIA", "MR")]
2146         [Property("COVPARAM", "")]
2147         [Property("AUTHOR", "guowei.wang@samsung.com")]
2148         public async Task WebViewClearCookies()
2149         {
2150             tlog.Debug(tag, $"WebViewClearCookies START");
2151
2152             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
2153             EventHandler<WebViewPageLoadEventArgs> onLoadFinished = (s, e) =>
2154             {
2155                 tlog.Info(tag, "onLoadFinished is called!");
2156                 webView.ClearCookies();
2157                 tcs.TrySetResult(true);
2158             };
2159             webView.PageLoadFinished += onLoadFinished;
2160
2161             webView.LoadUrl(url);
2162             var result = await tcs.Task;
2163             Assert.IsTrue(result, "PageLoadFinished event should be invoked");
2164
2165             webView.PageLoadFinished -= onLoadFinished;
2166
2167             tlog.Debug(tag, $"WebViewClearCookies END (OK)");
2168         }
2169
2170         [Test]
2171         [Category("P1")]
2172         [Description("WebView DownCast.")]
2173         [Property("SPEC", "Tizen.NUI.WebView.DownCast M")]
2174         [Property("SPEC_URL", "-")]
2175         [Property("CRITERIA", "MR")]
2176         [Property("COVPARAM", "")]
2177         [Property("AUTHOR", "guowei.wang@samsung.com")]
2178         public void WebViewDownCast()
2179         {
2180             tlog.Debug(tag, $"WebViewDownCast START");
2181
2182             try
2183             {
2184                 BaseComponents.WebView.DownCast(webView);
2185             }
2186             catch (Exception e)
2187             {
2188                 tlog.Debug(tag, e.Message.ToString());
2189                 Assert.Fail("Caught Exception : Failed!");
2190             }
2191
2192             tlog.Debug(tag, $"WebViewDownCast END (OK)");
2193         }
2194
2195         [Test]
2196         [Category("P1")]
2197         [Description("WebView Assign.")]
2198         [Property("SPEC", "Tizen.NUI.WebView.Assign M")]
2199         [Property("SPEC_URL", "-")]
2200         [Property("CRITERIA", "MR")]
2201         [Property("COVPARAM", "")]
2202         [Property("AUTHOR", "guowei.wang@samsung.com")]
2203         public void WebViewAssign()
2204         {
2205             tlog.Debug(tag, $"WebViewAssign START");
2206
2207             try
2208             {
2209                 webView.Assign(webView);
2210             }
2211             catch (Exception e)
2212             {
2213                 tlog.Debug(tag, e.Message.ToString());
2214                 Assert.Fail("Caught Exception : Failed!");
2215             }
2216
2217             tlog.Debug(tag, $"WebViewAssign END (OK)");
2218         }
2219
2220         [Test]
2221         [Category("P1")]
2222         [Description("WebView Dispose.")]
2223         [Property("SPEC", "Tizen.NUI.WebView.Dispose M")]
2224         [Property("SPEC_URL", "-")]
2225         [Property("CRITERIA", "MR")]
2226         [Property("COVPARAM", "")]
2227         [Property("AUTHOR", "guowei.wang@samsung.com")]
2228         public void WebViewDispose()
2229         {
2230             tlog.Debug(tag, $"WebViewDispose START");
2231
2232             var testingTarget = new MyWebView();
2233             Assert.IsNotNull(testingTarget, "null handle");
2234             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
2235
2236             testingTarget.OnDispose(DisposeTypes.Explicit);
2237             //disposed
2238             testingTarget.OnDispose(DisposeTypes.Explicit);
2239
2240             tlog.Debug(tag, $"WebViewDispose END (OK)");
2241         }
2242     }
2243 }