[WebView][Non-ACR] Fix some TCs due to Chromium upstream change 94/302994/3
authoryh106.jung <yh106.jung@samsung.com>
Mon, 18 Dec 2023 10:33:30 +0000 (19:33 +0900)
committerYoungha Jung <yh106.jung@samsung.com>
Tue, 19 Dec 2023 01:53:53 +0000 (01:53 +0000)
This patch fixes 2 TCs due to Chromium upstream change.

1. Tizen.WebView.Tests.SettingsTests.ScriptsCanOpenWindows_READ_WRITE

Default value of new window policy is 'Allowed', so it is appropriate to
perform the negative case first.

2. Tizen.WebView.Tests.WebViewTests.StopLoading_CHANGE_STATUS

Error event is no longer occurred by the user's stop request, this patch
checks only stop request at the start of loading.

Change-Id: I6fdb91e92beb8920753cc666074360bfd760c93d
Signed-off-by: yh106.jung <yh106.jung@samsung.com>
tct-suite-vs/Tizen.WebView.Tests/testcase/TSSettings.cs
tct-suite-vs/Tizen.WebView.Tests/testcase/TSWebView.cs

index 6158151..963db86 100755 (executable)
@@ -131,11 +131,11 @@ namespace Tizen.WebView.Tests
             var settings = _webView.GetSettings();
             Assert.IsInstanceOf<Settings>(settings, "GetSettings method failed");
 
-            settings.ScriptsCanOpenWindows = true;
-            Assert.IsTrue(settings.ScriptsCanOpenWindows, "Fail to get/set ScriptCanOpenWindows");
-
             settings.ScriptsCanOpenWindows = false;
             Assert.IsFalse(settings.ScriptsCanOpenWindows, "Fail to get/set ScriptCanOpenWindows");
+
+            settings.ScriptsCanOpenWindows = true;
+            Assert.IsTrue(settings.ScriptsCanOpenWindows, "Fail to get/set ScriptCanOpenWindows");
         }
     }
 }
index 8b1ba33..1910c8a 100755 (executable)
@@ -625,28 +625,23 @@ namespace Tizen.WebView.Tests
         public async Task StopLoading_CHANGE_STATUS()
         {
             /* TEST CODE */
-            var isCancellation = false;
             TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(false);
-            EventHandler onLoadStarted = (s, e) => { _webView.StopLoading(); };
-            EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(false); };
-            EventHandler<SmartCallbackLoadErrorArgs> onLoadError = (s, e) => {
-                isCancellation = e.Cancellation;
+            EventHandler onLoadStarted = (s, e) => {
+                _webView.StopLoading();
                 tcs.TrySetResult(true);
             };
+            EventHandler onLoadFinished = (s, e) => { tcs.TrySetResult(false); };
 
             _webView.LoadStarted += onLoadStarted;
             _webView.LoadFinished += onLoadFinished;
-            _webView.LoadError += onLoadError;
 
             _webView.LoadUrl(WebViewCommon.TestUrl);
             var result = await tcs.Task;
 
             _webView.LoadStarted -= onLoadStarted;
             _webView.LoadFinished -= onLoadFinished;
-            _webView.LoadError -= onLoadError;
 
-            Assert.IsTrue(result, "LoadError should be invoked");
-            Assert.IsTrue(isCancellation, "Cancellation should be true");
+            Assert.IsTrue(result, "LoadStarted event should be invoked");
         }
 
         [Test]