[NUI] Add TCs of WebView & Update some TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / WebView / TSWebContext.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Threading.Tasks;
7
8 namespace Tizen.NUI.Devel.Tests
9 {
10     using tlog = Tizen.Log;
11
12     [TestFixture]
13     [Description("internal/WebView/WebContext")]
14     public class InternalWebContextTest
15     {
16         private const string tag = "NUITEST";
17         private string url = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
18         private static string[] runtimeArgs = { "Tizen.NUI.Devel.Tests", "--enable-dali-window", "--enable-spatial-navigation" };
19         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";
20
21         private void OriginListAcquiredCallback (WebSecurityOriginList list) { }
22         private void OnStorageUsageAcquired(ulong usage) { }
23         private void PasswordAcquiredCallback (WebPasswordDataList list) { }
24         private void DownloadCallback (string url) { }
25         private void UsageAcquiredCallback (ulong usage) { }
26         private bool MimeWrittenCallback(string url, string currentMime, string newMime) 
27         {
28             return true;
29         }
30
31         [SetUp]
32         public void Init()
33         {
34             tlog.Info(tag, "Init() is called!");
35         }
36
37         [TearDown]
38         public void Destroy()
39         {
40             tlog.Info(tag, "Destroy() is called!");
41         }
42
43         [Test]
44         [Category("P1")]
45         [Description("WebContext ProxyUrl.")]
46         [Property("SPEC", "Tizen.NUI.WebContext.ProxyUrl A")]
47         [Property("SPEC_URL", "-")]
48         [Property("CRITERIA", "PRW")]
49         [Property("COVPARAM", "")]
50         [Property("AUTHOR", "guowei.wang@samsung.com")]
51         public void WebContextProxyUrl()
52         {
53             tlog.Debug(tag, $"WebContextProxyUrl START");
54
55             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
56             Assert.IsNotNull(testingTarget, "null handle");
57             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
58
59             var context = testingTarget.Context;
60             tlog.Debug(tag, "ProxyUrl : " + context.ProxyUrl);
61
62             context.ProxyUrl = "http://www.baidu.com";
63             tlog.Debug(tag, "ProxyUrl : " + context.ProxyUrl);
64
65             testingTarget.ClearCache();
66             testingTarget.ClearCookies();
67
68             context.Dispose();
69             testingTarget.Dispose();
70             tlog.Debug(tag, $"WebContextProxyUrl END (OK)");
71         }
72
73         [Test]
74         [Category("P1")]
75         [Description("WebContext CertificateFilePath.")]
76         [Property("SPEC", "Tizen.NUI.WebContext.CertificateFilePath A")]
77         [Property("SPEC_URL", "-")]
78         [Property("CRITERIA", "PRW")]
79         [Property("COVPARAM", "")]
80         [Property("AUTHOR", "guowei.wang@samsung.com")]
81         public void WebContextCertificateFilePath()
82         {
83             tlog.Debug(tag, $"WebContextCertificateFilePath START");
84
85             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
86             Assert.IsNotNull(testingTarget, "null handle");
87             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
88
89             var context = testingTarget.Context;
90             tlog.Debug(tag, "CertificateFilePath : " + context.CertificateFilePath);
91
92             context.CertificateFilePath = url;
93             tlog.Debug(tag, "CertificateFilePath : " + context.CertificateFilePath);
94
95             testingTarget.ClearCache();
96             testingTarget.ClearCookies();
97
98             context.Dispose();
99             testingTarget.Dispose();
100             tlog.Debug(tag, $"WebContextCertificateFilePath END (OK)");
101         }
102
103         [Test]
104         [Category("P1")]
105         [Description("WebContext CacheEnabled.")]
106         [Property("SPEC", "Tizen.NUI.WebContext.CacheEnabled A")]
107         [Property("SPEC_URL", "-")]
108         [Property("CRITERIA", "PRW")]
109         [Property("COVPARAM", "")]
110         [Property("AUTHOR", "guowei.wang@samsung.com")]
111         public void WebContextCacheEnabled()
112         {
113             tlog.Debug(tag, $"WebContextCacheEnabled START");
114
115             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
116             Assert.IsNotNull(testingTarget, "null handle");
117             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
118
119             var context = testingTarget.Context;
120             tlog.Debug(tag, "CacheEnabled : " + context.CacheEnabled);
121
122             context.CacheEnabled = true;
123             tlog.Debug(tag, "CacheEnabled : " + context.CacheEnabled);
124
125             context.CacheEnabled = false;
126             tlog.Debug(tag, "CacheEnabled : " + context.CacheEnabled);
127
128             testingTarget.ClearCache();
129             testingTarget.ClearCookies();
130
131             context.Dispose();
132             testingTarget.Dispose();
133             tlog.Debug(tag, $"WebContextCertificateFilePath END (OK)");
134         }
135
136         [Test]
137         [Category("P1")]
138         [Description("WebContext AppId.")]
139         [Property("SPEC", "Tizen.NUI.WebContext.AppId A")]
140         [Property("SPEC_URL", "-")]
141         [Property("CRITERIA", "PRW")]
142         [Property("COVPARAM", "")]
143         [Property("AUTHOR", "guowei.wang@samsung.com")]
144         public void WebContextAppId()
145         {
146             tlog.Debug(tag, $"WebContextAppId START");
147
148             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
149             Assert.IsNotNull(testingTarget, "null handle");
150             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
151
152             var context = testingTarget.Context;
153             tlog.Debug(tag, "AppId : " + context.AppId);
154
155             context.AppId = "WebContextAppId";
156             tlog.Debug(tag, "AppId : " + context.AppId);
157
158             testingTarget.ClearCache();
159             testingTarget.ClearCookies();
160
161             context.Dispose();
162             testingTarget.Dispose();
163             tlog.Debug(tag, $"WebContextAppId END (OK)");
164         }
165
166         [Test]
167         [Category("P1")]
168         [Description("WebContext AppVersion.")]
169         [Property("SPEC", "Tizen.NUI.WebContext.AppVersion A")]
170         [Property("SPEC_URL", "-")]
171         [Property("CRITERIA", "PRW")]
172         [Property("COVPARAM", "")]
173         [Property("AUTHOR", "guowei.wang@samsung.com")]
174         public void WebContextAppVersion()
175         {
176             tlog.Debug(tag, $"WebContextAppVersion START");
177
178             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
179             Assert.IsNotNull(testingTarget, "null handle");
180             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
181
182             var context = testingTarget.Context;
183             tlog.Debug(tag, "AppVersion : " + context.AppVersion);
184
185             context.AppVersion = "1.0";
186             tlog.Debug(tag, "AppVersion : " + context.AppVersion);
187
188             testingTarget.ClearCache();
189             testingTarget.ClearCookies();
190
191             context.Dispose();
192             testingTarget.Dispose();
193             tlog.Debug(tag, $"WebContextAppVersion END (OK)");
194         }
195
196         [Test]
197         [Category("P1")]
198         [Description("WebContext AppType.")]
199         [Property("SPEC", "Tizen.NUI.WebContext.AppType A")]
200         [Property("SPEC_URL", "-")]
201         [Property("CRITERIA", "PRW")]
202         [Property("COVPARAM", "")]
203         [Property("AUTHOR", "guowei.wang@samsung.com")]
204         public void WebContextAppType()
205         {
206             tlog.Debug(tag, $"WebContextAppType START");
207
208             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
209             Assert.IsNotNull(testingTarget, "null handle");
210             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
211
212             var context = testingTarget.Context;
213             tlog.Debug(tag, "AppType : " + context.AppType);
214
215             context.AppType = WebContext.ApplicationType.WebBrowser;
216             tlog.Debug(tag, "AppType : " + context.AppType);
217
218             testingTarget.ClearCache();
219             testingTarget.ClearCookies();
220
221             context.Dispose();
222             testingTarget.Dispose();
223             tlog.Debug(tag, $"WebContextAppType END (OK)");
224         }
225
226         [Test]
227         [Category("P1")]
228         [Description("WebContext TimeOffset.")]
229         [Property("SPEC", "Tizen.NUI.WebContext.TimeOffset A")]
230         [Property("SPEC_URL", "-")]
231         [Property("CRITERIA", "PRW")]
232         [Property("COVPARAM", "")]
233         [Property("AUTHOR", "guowei.wang@samsung.com")]
234         public void WebContextTimeOffset()
235         {
236             tlog.Debug(tag, $"WebContextTimeOffset START");
237
238             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
239             Assert.IsNotNull(testingTarget, "null handle");
240             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
241
242             var context = testingTarget.Context;
243             tlog.Debug(tag, "TimeOffset : " + context.TimeOffset);
244
245             context.TimeOffset = 0.3f;
246             tlog.Debug(tag, "TimeOffset : " + context.TimeOffset);
247
248             testingTarget.ClearCache();
249             testingTarget.ClearCookies();
250
251             context.Dispose();
252             testingTarget.Dispose();
253             tlog.Debug(tag, $"WebContextAppType END (OK)");
254         }
255
256         [Test]
257         [Category("P1")]
258         [Description("WebContext DefaultZoomFactor.")]
259         [Property("SPEC", "Tizen.NUI.WebContext.DefaultZoomFactor A")]
260         [Property("SPEC_URL", "-")]
261         [Property("CRITERIA", "PRW")]
262         [Property("COVPARAM", "")]
263         [Property("AUTHOR", "guowei.wang@samsung.com")]
264         public void WebContextDefaultZoomFactor()
265         {
266             tlog.Debug(tag, $"WebContextDefaultZoomFactor START");
267
268             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
269             Assert.IsNotNull(testingTarget, "null handle");
270             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
271
272             var context = testingTarget.Context;
273             tlog.Debug(tag, "DefaultZoomFactor : " + context.DefaultZoomFactor);
274
275             context.DefaultZoomFactor = 0.3f;
276             tlog.Debug(tag, "DefaultZoomFactor : " + context.DefaultZoomFactor);
277
278             testingTarget.ClearCache();
279             testingTarget.ClearCookies();
280
281             context.Dispose();
282             testingTarget.Dispose();
283             tlog.Debug(tag, $"WebContextDefaultZoomFactor END (OK)");
284         }
285
286         [Test]
287         [Category("P1")]
288         [Description("WebContext ContextProxy.")]
289         [Property("SPEC", "Tizen.NUI.WebContext.ContextProxy A")]
290         [Property("SPEC_URL", "-")]
291         [Property("CRITERIA", "PRO")]
292         [Property("COVPARAM", "")]
293         [Property("AUTHOR", "guowei.wang@samsung.com")]
294         public void WebContextContextProxy()
295         {
296             tlog.Debug(tag, $"WebContextContextProxy START");
297
298             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
299             Assert.IsNotNull(testingTarget, "null handle");
300             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
301
302             var context = testingTarget.Context;
303             tlog.Debug(tag, "ContextProxy : " + context.ContextProxy);
304
305             testingTarget.ClearCache();
306             testingTarget.ClearCookies();
307
308             context.Dispose();
309             testingTarget.Dispose();
310             tlog.Debug(tag, $"WebContextContextProxy END (OK)");
311         }
312
313         [Test]
314         [Category("P1")]
315         [Description("WebContext ProxyBypassRule.")]
316         [Property("SPEC", "Tizen.NUI.WebContext.ProxyBypassRule A")]
317         [Property("SPEC_URL", "-")]
318         [Property("CRITERIA", "PRO")]
319         [Property("COVPARAM", "")]
320         [Property("AUTHOR", "guowei.wang@samsung.com")]
321         public void WebContextProxyBypassRule()
322         {
323             tlog.Debug(tag, $"WebContextProxyBypassRule START");
324
325             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
326             Assert.IsNotNull(testingTarget, "null handle");
327             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
328
329             var context = testingTarget.Context;
330             tlog.Debug(tag, "ProxyBypassRule : " + context.ProxyBypassRule);
331
332             testingTarget.ClearCache();
333             testingTarget.ClearCookies();
334
335             context.Dispose();
336             testingTarget.Dispose();
337             tlog.Debug(tag, $"WebContextProxyBypassRule END (OK)");
338         }
339
340         [Test]
341         [Category("P1")]
342         [Description("WebContext SetDefaultProxyAuth.")]
343         [Property("SPEC", "Tizen.NUI.WebContext.SetDefaultProxyAuth M")]
344         [Property("SPEC_URL", "-")]
345         [Property("CRITERIA", "MR")]
346         [Property("COVPARAM", "")]
347         [Property("AUTHOR", "guowei.wang@samsung.com")]
348         public void WebContextSetDefaultProxyAuth()
349         {
350             tlog.Debug(tag, $"WebContextSetDefaultProxyAuth START");
351
352             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
353             Assert.IsNotNull(testingTarget, "null handle");
354             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
355
356             var context = testingTarget.Context;
357
358             try
359             {
360                 context.SetDefaultProxyAuth("tizen", "samsung");
361             }
362             catch (Exception e)
363             {
364                 tlog.Debug(tag, e.Message.ToString());
365                 Assert.Fail("Caught Exception :  Failed!");
366             }
367
368             testingTarget.ClearCache();
369             testingTarget.ClearCookies();
370
371             context.Dispose();
372             testingTarget.Dispose();
373             tlog.Debug(tag, $"WebContextSetDefaultProxyAuth END (OK)");
374         }
375
376         [Test]
377         [Category("P1")]
378         [Description("WebContext DeleteAllWebDatabase.")]
379         [Property("SPEC", "Tizen.NUI.WebContext.DeleteAllWebDatabase M")]
380         [Property("SPEC_URL", "-")]
381         [Property("CRITERIA", "MR")]
382         [Property("COVPARAM", "")]
383         [Property("AUTHOR", "guowei.wang@samsung.com")]
384         public void WebContextDeleteAllWebDatabase()
385         {
386             tlog.Debug(tag, $"WebContextDeleteAllWebDatabase START");
387
388             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
389             Assert.IsNotNull(testingTarget, "null handle");
390             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
391
392             var context = testingTarget.Context;
393
394             try
395             {
396                 context.DeleteAllWebDatabase();
397             }
398             catch (Exception e)
399             {
400                 tlog.Debug(tag, e.Message.ToString());
401                 Assert.Fail("Caught Exception :  Failed!");
402             }
403
404             testingTarget.ClearCache();
405             testingTarget.ClearCookies();
406
407             context.Dispose();
408             testingTarget.Dispose();
409             tlog.Debug(tag, $"WebContextDeleteAllWebDatabase END (OK)");
410         }
411
412         [Test]
413         [Category("P1")]
414         [Description("WebContext GetWebDatabaseOrigins.")]
415         [Property("SPEC", "Tizen.NUI.WebContext.GetWebDatabaseOrigins M")]
416         [Property("SPEC_URL", "-")]
417         [Property("CRITERIA", "MR")]
418         [Property("COVPARAM", "")]
419         [Property("AUTHOR", "guowei.wang@samsung.com")]
420         public void WebContextGetWebDatabaseOrigins()
421         {
422             tlog.Debug(tag, $"WebContextGetWebDatabaseOrigins START");
423
424             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
425             Assert.IsNotNull(testingTarget, "null handle");
426             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
427
428             var context = testingTarget.Context;
429
430             try
431             {
432                 context.GetWebDatabaseOrigins(OriginListAcquiredCallback);
433             }
434             catch (Exception e)
435             {
436                 tlog.Debug(tag, e.Message.ToString());
437                 Assert.Fail("Caught Exception :  Failed!");
438             }
439
440             testingTarget.ClearCache();
441             testingTarget.ClearCookies();
442
443             context.Dispose();
444             testingTarget.Dispose();
445             tlog.Debug(tag, $"WebContextGetWebDatabaseOrigins END (OK)");
446         }
447
448         [Test]
449         [Category("P1")]
450         [Description("WebContext DeleteWebDatabase.")]
451         [Property("SPEC", "Tizen.NUI.WebContext.DeleteWebDatabase M")]
452         [Property("SPEC_URL", "-")]
453         [Property("CRITERIA", "MR")]
454         [Property("COVPARAM", "")]
455         [Property("AUTHOR", "guowei.wang@samsung.com")]
456         public void WebContextDeleteWebDatabase()
457         {
458             tlog.Debug(tag, $"WebContextDeleteWebDatabase START");
459
460             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
461             Assert.IsNotNull(testingTarget, "null handle");
462             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
463
464             var context = testingTarget.Context;
465
466             try
467             {
468                 using (WebSecurityOrigin origin = new WebSecurityOrigin(testingTarget.SwigCPtr.Handle, false))
469                 {
470                     context.DeleteWebDatabase(origin);
471                 }
472             }
473             catch (Exception e)
474             {
475                 tlog.Debug(tag, e.Message.ToString());
476                 Assert.Fail("Caught Exception :  Failed!");
477             }
478
479             testingTarget.ClearCache();
480             testingTarget.ClearCookies();
481
482             context.Dispose();
483             testingTarget.Dispose();
484             tlog.Debug(tag, $"WebContextDeleteWebDatabase END (OK)");
485         }
486
487         [Test]
488         [Category("P1")]
489         [Description("WebContext GetWebStorageOrigins.")]
490         [Property("SPEC", "Tizen.NUI.WebContext.GetWebStorageUsageForOrigin M")]
491         [Property("SPEC_URL", "-")]
492         [Property("CRITERIA", "MR")]
493         [Property("COVPARAM", "")]
494         [Property("AUTHOR", "guowei.wang@samsung.com")]
495         public async Task WebContextGetWebStorageUsageForOrigin()
496         {
497             tlog.Debug(tag, $"WebContextGetWebStorageUsageForOrigin START");
498
499             var testingTarget = new Tizen.NUI.BaseComponents.WebView(runtimeArgs)
500             {
501                 Size = new Size(500, 200),
502                 UserAgent = USER_AGENT
503             };
504             Assert.IsNotNull(testingTarget, "null handle");
505             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return Tizen.NUI.BaseComponents.WebView instance.");
506
507             testingTarget.LoadUrl("https://www.youtube.com");
508             await Task.Delay(60000);
509
510             try
511             {
512                 var result = testingTarget.Context.GetWebStorageOrigins(OnSecurityOriginListAcquired);
513                 tlog.Error(tag, "result : " + result);
514             }
515             catch (Exception e)
516             {
517                 tlog.Debug(tag, e.Message.ToString());
518                 Assert.Fail("Caught Exception :  Failed!");
519             }
520
521             testingTarget.ClearCache();
522             testingTarget.ClearCookies();
523
524             testingTarget.Dispose();
525             tlog.Debug(tag, $"GetWebStorageOrigins END (OK)");
526         }
527
528         private void OnSecurityOriginListAcquired(WebSecurityOriginList list)
529         {   
530             WebSecurityOrigin origin = list.GetItemAtIndex(0);
531             tlog.Debug(tag, "security origin, Host : " + origin.Host);
532             tlog.Debug(tag, "security origin, Protocol : " + origin.Protocol);
533         }
534
535         [Test]
536         [Category("P1")]
537         [Description("WebContext DeleteAllWebStorage.")]
538         [Property("SPEC", "Tizen.NUI.WebContext.DeleteAllWebStorage M")]
539         [Property("SPEC_URL", "-")]
540         [Property("CRITERIA", "MR")]
541         [Property("COVPARAM", "")]
542         [Property("AUTHOR", "guowei.wang@samsung.com")]
543         public void WebContextDeleteAllWebStorage()
544         {
545             tlog.Debug(tag, $"WebContextDeleteAllWebStorage START");
546
547             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
548             Assert.IsNotNull(testingTarget, "null handle");
549             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
550
551             var context = testingTarget.Context;
552
553             try
554             {
555                 context.DeleteAllWebStorage();
556             }
557             catch (Exception e)
558             {
559                 tlog.Debug(tag, e.Message.ToString());
560                 Assert.Fail("Caught Exception :  Failed!");
561             }
562
563             testingTarget.ClearCache();
564             testingTarget.ClearCookies();
565
566             context.Dispose();
567             testingTarget.Dispose();
568             tlog.Debug(tag, $"WebContextDeleteAllWebStorage END (OK)");
569         }
570
571         [Test]
572         [Category("P1")]
573         [Description("WebContext DeleteLocalFileSystem.")]
574         [Property("SPEC", "Tizen.NUI.WebContext.DeleteLocalFileSystem M")]
575         [Property("SPEC_URL", "-")]
576         [Property("CRITERIA", "MR")]
577         [Property("COVPARAM", "")]
578         [Property("AUTHOR", "guowei.wang@samsung.com")]
579         public void WebContextDeleteLocalFileSystem()
580         {
581             tlog.Debug(tag, $"WebContextDeleteLocalFileSystem START");
582
583             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
584             Assert.IsNotNull(testingTarget, "null handle");
585             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
586
587             var context = testingTarget.Context;
588
589             try
590             {
591                 context.DeleteLocalFileSystem();
592             }
593             catch (Exception e)
594             {
595                 tlog.Debug(tag, e.Message.ToString());
596                 Assert.Fail("Caught Exception :  Failed!");
597             }
598
599             testingTarget.ClearCache();
600             testingTarget.ClearCookies();
601
602             context.Dispose();
603             testingTarget.Dispose();
604             tlog.Debug(tag, $"WebContextDeleteLocalFileSystem END (OK)");
605         }
606
607         [Test]
608         [Category("P1")]
609         [Description("WebContext GetFormPasswordList.")]
610         [Property("SPEC", "Tizen.NUI.WebContext.GetFormPasswordList M")]
611         [Property("SPEC_URL", "-")]
612         [Property("CRITERIA", "MR")]
613         [Property("COVPARAM", "")]
614         [Property("AUTHOR", "guowei.wang@samsung.com")]
615         public void WebContextGetFormPasswordList()
616         {
617             tlog.Debug(tag, $"WebContextGetFormPasswordList START");
618
619             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
620             Assert.IsNotNull(testingTarget, "null handle");
621             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
622
623             var context = testingTarget.Context;
624
625             try
626             {
627                 context.GetFormPasswordList(PasswordAcquiredCallback);
628             }
629             catch (Exception e)
630             {
631                 tlog.Debug(tag, e.Message.ToString());
632                 Assert.Fail("Caught Exception :  Failed!");
633             }
634
635             testingTarget.ClearCache();
636             testingTarget.ClearCookies();
637
638             context.Dispose();
639             testingTarget.Dispose();
640             tlog.Debug(tag, $"WebContextGetFormPasswordList END (OK)");
641         }
642
643         [Test]
644         [Category("P1")]
645         [Description("WebContext RegisterDownloadStartedCallback.")]
646         [Property("SPEC", "Tizen.NUI.WebContext.RegisterDownloadStartedCallback M")]
647         [Property("SPEC_URL", "-")]
648         [Property("CRITERIA", "MR")]
649         [Property("COVPARAM", "")]
650         [Property("AUTHOR", "guowei.wang@samsung.com")]
651         public void WebContextRegisterDownloadStartedCallback()
652         {
653             tlog.Debug(tag, $"WebContextRegisterDownloadStartedCallback START");
654
655             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
656             Assert.IsNotNull(testingTarget, "null handle");
657             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
658
659             var context = testingTarget.Context;
660
661             try
662             {
663                 context.RegisterDownloadStartedCallback(DownloadCallback);
664             }
665             catch (Exception e)
666             {
667                 tlog.Debug(tag, e.Message.ToString());
668                 Assert.Fail("Caught Exception :  Failed!");
669             }
670
671             testingTarget.ClearCache();
672             testingTarget.ClearCookies();
673
674             context.Dispose();
675             testingTarget.Dispose();
676             tlog.Debug(tag, $"WebContextRegisterDownloadStartedCallback END (OK)");
677         }
678
679         [Test]
680         [Category("P1")]
681         [Description("WebContext RegisterMimeOverriddenCallback.")]
682         [Property("SPEC", "Tizen.NUI.WebContext.RegisterMimeOverriddenCallback M")]
683         [Property("SPEC_URL", "-")]
684         [Property("CRITERIA", "MR")]
685         [Property("COVPARAM", "")]
686         [Property("AUTHOR", "guowei.wang@samsung.com")]
687         public void WebContextRegisterMimeOverriddenCallback()
688         {
689             tlog.Debug(tag, $"WebContextRegisterMimeOverriddenCallback START");
690
691             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
692             Assert.IsNotNull(testingTarget, "null handle");
693             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
694
695             var context = testingTarget.Context;
696
697             try
698             {
699                 context.RegisterMimeOverriddenCallback(MimeWrittenCallback);
700             }
701             catch (Exception e)
702             {
703                 tlog.Debug(tag, e.Message.ToString());
704                 Assert.Fail("Caught Exception :  Failed!");
705             }
706
707             testingTarget.ClearCache();
708             testingTarget.ClearCookies();
709
710             context.Dispose();
711             testingTarget.Dispose();
712             tlog.Debug(tag, $"WebContextRegisterMimeOverriddenCallback END (OK)");
713         }
714
715         [Test]
716         [Category("P1")]
717         [Description("WebContext SetTimeZoneOffset.")]
718         [Property("SPEC", "Tizen.NUI.WebContext.SetTimeZoneOffset M")]
719         [Property("SPEC_URL", "-")]
720         [Property("CRITERIA", "MR")]
721         [Property("COVPARAM", "")]
722         [Property("AUTHOR", "guowei.wang@samsung.com")]
723         public void WebContextSetTimeZoneOffset()
724         {
725             tlog.Debug(tag, $"WebContextSetTimeZoneOffset START");
726
727             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
728             Assert.IsNotNull(testingTarget, "null handle");
729             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
730
731             var context = testingTarget.Context;
732
733             try
734             {
735                 context.SetTimeZoneOffset(0.3f, 1.0f);
736             }
737             catch (Exception e)
738             {
739                 tlog.Debug(tag, e.Message.ToString());
740                 Assert.Fail("Caught Exception :  Failed!");
741             }
742
743             testingTarget.ClearCache();
744             testingTarget.ClearCookies();
745
746             context.Dispose();
747             testingTarget.Dispose();
748             tlog.Debug(tag, $"WebContextSetTimeZoneOffset END (OK)");
749         }
750
751         [Test]
752         [Category("P1")]
753         [Description("WebContext SetContextTimeZoneOffset.")]
754         [Property("SPEC", "Tizen.NUI.WebContext.SetContextTimeZoneOffset M")]
755         [Property("SPEC_URL", "-")]
756         [Property("CRITERIA", "MR")]
757         [Property("COVPARAM", "")]
758         [Property("AUTHOR", "guowei.wang@samsung.com")]
759         public void WebContextSetContextTimeZoneOffset()
760         {
761             tlog.Debug(tag, $"WebContextSetContextTimeZoneOffset START");
762
763             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
764             Assert.IsNotNull(testingTarget, "null handle");
765             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
766
767             var context = testingTarget.Context;
768
769             try
770             {
771                 context.SetContextTimeZoneOffset(0.3f, 1.0f);
772             }
773             catch (Exception e)
774             {
775                 tlog.Debug(tag, e.Message.ToString());
776                 Assert.Fail("Caught Exception :  Failed!");
777             }
778
779             testingTarget.ClearCache();
780             testingTarget.ClearCookies();
781
782             context.Dispose();
783             testingTarget.Dispose();
784             tlog.Debug(tag, $"WebContextSetContextTimeZoneOffset END (OK)");
785         }
786
787         [Test]
788         [Category("P1")]
789         [Description("WebContext DeleteAllApplicationCache.")]
790         [Property("SPEC", "Tizen.NUI.WebContext.DeleteAllApplicationCache M")]
791         [Property("SPEC_URL", "-")]
792         [Property("CRITERIA", "MR")]
793         [Property("COVPARAM", "")]
794         [Property("AUTHOR", "guowei.wang@samsung.com")]
795         public void WebContextDeleteAllApplicationCache()
796         {
797             tlog.Debug(tag, $"WebContextDeleteAllApplicationCache START");
798
799             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
800             Assert.IsNotNull(testingTarget, "null handle");
801             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
802
803             var context = testingTarget.Context;
804
805             try
806             {
807                 context.DeleteAllApplicationCache();
808             }
809             catch (Exception e)
810             {
811                 tlog.Debug(tag, e.Message.ToString());
812                 Assert.Fail("Caught Exception :  Failed!");
813             }
814
815             testingTarget.ClearCache();
816             testingTarget.ClearCookies();
817
818             context.Dispose();
819             testingTarget.Dispose();
820             tlog.Debug(tag, $"WebContextDeleteAllApplicationCache END (OK)");
821         }
822
823         [Test]
824         [Category("P1")]
825         [Description("WebContext DeleteAllWebIndexedDatabase.")]
826         [Property("SPEC", "Tizen.NUI.WebContext.DeleteAllWebIndexedDatabase M")]
827         [Property("SPEC_URL", "-")]
828         [Property("CRITERIA", "MR")]
829         [Property("COVPARAM", "")]
830         [Property("AUTHOR", "guowei.wang@samsung.com")]
831         public void WebContextDeleteAllWebIndexedDatabase()
832         {
833             tlog.Debug(tag, $"WebContextDeleteAllWebIndexedDatabase START");
834
835             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
836             Assert.IsNotNull(testingTarget, "null handle");
837             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
838
839             var context = testingTarget.Context;
840
841             try
842             {
843                 context.DeleteAllWebIndexedDatabase();
844             }
845             catch (Exception e)
846             {
847                 tlog.Debug(tag, e.Message.ToString());
848                 Assert.Fail("Caught Exception :  Failed!");
849             }
850
851             testingTarget.ClearCache();
852             testingTarget.ClearCookies();
853
854             context.Dispose();
855             testingTarget.Dispose();
856             tlog.Debug(tag, $"WebContextDeleteAllWebIndexedDatabase END (OK)");
857         }
858
859         [Test]
860         [Category("P1")]
861         [Description("WebContext DeleteAllFormPasswordData.")]
862         [Property("SPEC", "Tizen.NUI.WebContext.DeleteAllFormPasswordData M")]
863         [Property("SPEC_URL", "-")]
864         [Property("CRITERIA", "MR")]
865         [Property("COVPARAM", "")]
866         [Property("AUTHOR", "guowei.wang@samsung.com")]
867         public void WebContextDeleteAllFormPasswordData()
868         {
869             tlog.Debug(tag, $"WebContextDeleteAllFormPasswordData START");
870
871             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
872             Assert.IsNotNull(testingTarget, "null handle");
873             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
874
875             var context = testingTarget.Context;
876
877             try
878             {
879                 context.DeleteAllFormPasswordData();
880             }
881             catch (Exception e)
882             {
883                 tlog.Debug(tag, e.Message.ToString());
884                 Assert.Fail("Caught Exception :  Failed!");
885             }
886
887             testingTarget.ClearCache();
888             testingTarget.ClearCookies();
889
890             context.Dispose();
891             testingTarget.Dispose();
892             tlog.Debug(tag, $"WebContextDeleteAllFormPasswordData END (OK)");
893         }
894
895         [Test]
896         [Category("P1")]
897         [Description("WebContext DeleteAllFormCandidateData.")]
898         [Property("SPEC", "Tizen.NUI.WebContext.DeleteAllFormCandidateData M")]
899         [Property("SPEC_URL", "-")]
900         [Property("CRITERIA", "MR")]
901         [Property("COVPARAM", "")]
902         [Property("AUTHOR", "guowei.wang@samsung.com")]
903         public void WebContextDeleteAllFormCandidateData()
904         {
905             tlog.Debug(tag, $"WebContextDeleteAllFormCandidateData START");
906
907             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
908             Assert.IsNotNull(testingTarget, "null handle");
909             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
910
911             testingTarget.LoadUrl("http://www.baidu.com");
912             var context = testingTarget.Context;
913
914             try
915             {
916                 context.DeleteAllFormCandidateData();
917             }
918             catch (Exception e)
919             {
920                 tlog.Debug(tag, e.Message.ToString());
921                 Assert.Fail("Caught Exception :  Failed!");
922             }
923
924             testingTarget.ClearCache();
925             testingTarget.ClearCookies();
926
927             context.Dispose();
928             testingTarget.Dispose();
929             tlog.Debug(tag, $"WebContextDeleteAllFormCandidateData END (OK)");
930         }
931
932         [Test]
933         [Category("P1")]
934         [Description("WebContext FreeUnusedMemory.")]
935         [Property("SPEC", "Tizen.NUI.WebContext.FreeUnusedMemory M")]
936         [Property("SPEC_URL", "-")]
937         [Property("CRITERIA", "MR")]
938         [Property("COVPARAM", "")]
939         [Property("AUTHOR", "guowei.wang@samsung.com")]
940         public void WebContextFreeUnusedMemory()
941         {
942             tlog.Debug(tag, $"WebContextFreeUnusedMemory START");
943
944             var testingTarget = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai");
945             Assert.IsNotNull(testingTarget, "null handle");
946             Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(testingTarget, "Should return WebView instance.");
947
948             testingTarget.LoadUrl("http://www.baidu.com");
949             var context = testingTarget.Context;
950
951             try
952             {
953                 context.FreeUnusedMemory();
954             }
955             catch (Exception e)
956             {
957                 tlog.Debug(tag, e.Message.ToString());
958                 Assert.Fail("Caught Exception :  Failed!");
959             }
960
961             testingTarget.ClearCache();
962             testingTarget.ClearCookies();
963
964             context.Dispose();
965             testingTarget.Dispose();
966             tlog.Debug(tag, $"WebContextFreeUnusedMemory END (OK)");
967         }
968     }
969 }