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