3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Threading.Tasks;
8 namespace Tizen.NUI.Devel.Tests
10 using tlog = Tizen.Log;
13 [Description("internal/WebView/WebCookieManager")]
14 public class InternalWebCookieManagerTest
16 private const string tag = "NUITEST";
17 private static string[] runtimeArgs = { "Tizen.NUI.Devel.Tests", "--enable-dali-window", "--enable-spatial-navigation" };
18 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";
23 tlog.Info(tag, "Init() is called!");
29 tlog.Info(tag, "Destroy() is called!");
34 [Description("WebCookieManager CookieChanged.")]
35 [Property("SPEC", "Tizen.NUI.WebCookieManager.CookieChanged A")]
36 [Property("SPEC_URL", "-")]
37 [Property("CRITERIA", "PRW")]
38 [Property("COVPARAM", "")]
39 [Property("AUTHOR", "guowei.wang@samsung.com")]
40 public async Task WebCookieManagerCookieChanged()
42 tlog.Debug(tag, $"WebCookieManagerCookieChanged START");
44 var webview = new Tizen.NUI.BaseComponents.WebView(runtimeArgs)
46 Size = new Size(500, 200),
47 UserAgent = USER_AGENT
49 Assert.IsNotNull(webview, "null handle");
50 Assert.IsInstanceOf<Tizen.NUI.BaseComponents.WebView>(webview, "Should return Tizen.NUI.BaseComponents.WebView instance.");
52 var testingTarget = webview.CookieManager;
53 Assert.IsInstanceOf<WebCookieManager>(testingTarget, "Should return WebCookieManager instance.");
55 testingTarget.CookieChanged += OnCookieChanged;
57 webview.LoadUrl("http://www.baidu.com/");
59 await Task.Delay(10000);
61 testingTarget.CookieChanged -= OnCookieChanged;
63 testingTarget.Dispose();
64 tlog.Debug(tag, $"WebCookieManagerCookieChanged END (OK)");
69 [Description("WebCookieManager SetPersistentStorage.")]
70 [Property("SPEC", "Tizen.NUI.WebCookieManager.SetPersistentStorage M")]
71 [Property("SPEC_URL", "-")]
72 [Property("CRITERIA", "MR")]
73 [Property("COVPARAM", "")]
74 [Property("AUTHOR", "guowei.wang@samsung.com")]
75 public void WebCookieManagerSetPersistentStorage()
77 tlog.Debug(tag, $"WebCookieManagerSetPersistentStorage START");
79 using (Tizen.NUI.BaseComponents.WebView webview = new Tizen.NUI.BaseComponents.WebView("Shanghai", "Asia/Shanghai"))
81 var testingTarget = webview.CookieManager;
82 Assert.IsInstanceOf<WebCookieManager>(testingTarget, "Should return WebCookieManager instance.");
86 testingTarget.SetPersistentStorage("/", WebCookieManager.CookiePersistentStorageType.Text);
90 tlog.Debug(tag, e.Message.ToString());
91 Assert.Fail("Caught Exception : Failed!");
94 testingTarget.Dispose();
97 tlog.Debug(tag, $"WebCookieManagerSetPersistentStorage END (OK)");
100 private void OnCookieChanged(object sender, EventArgs e) { }