From 6a4affaecfe025b054896239fb2f06eeade29e7a Mon Sep 17 00:00:00 2001 From: pkar70 Date: Tue, 5 Nov 2019 17:07:59 +0000 Subject: [PATCH 1/3] Uri too long remediation --- doc/ReleaseNotes/_ReleaseNotes.md | 2 +- .../UnoSamples_Test_NavigateToString.cs | 45 ++++++++++++++ .../UITests.Shared/UITests.Shared.projitems | 7 +++ .../WebView/WebView_NavigateToString2.xaml | 31 ++++++++++ .../WebView/WebView_NavigateToString2.xaml.cs | 60 +++++++++++++++++++ .../Xaml/Controls/WebView/WebView.Android.cs | 20 ++++--- 6 files changed, 157 insertions(+), 8 deletions(-) create mode 100644 src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/WebViewTests/UnoSamples_Test_NavigateToString.cs create mode 100644 src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_NavigateToString2.xaml create mode 100644 src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_NavigateToString2.xaml.cs diff --git a/doc/ReleaseNotes/_ReleaseNotes.md b/doc/ReleaseNotes/_ReleaseNotes.md index 0e1eedeb1526..af8e68f61fc3 100644 --- a/doc/ReleaseNotes/_ReleaseNotes.md +++ b/doc/ReleaseNotes/_ReleaseNotes.md @@ -100,7 +100,7 @@ > This change might break the compilation for projects that define duplicate resources in other globally accessible resource dictionaries. Adjustments to remove duplicate resources may be necessary. ### Bug fixes - +* Android WebView.NavigateToString doesn't throw exception even when string is very long. * [#1987](https://github.com/unoplatform/uno/pull/1987) Missing XML comment warnings are disabled on generated code * [#1939](https://github.com/unoplatform/uno/pull/1939) Handles nullables types in XAML file generator * [#1741](https://github.com/unoplatform/uno/issues/1741) On Android, `ApplicationData.Current.[LocalFolder|RoamingFolder]` can now be used in the ctor of App.xaml.cs diff --git a/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/WebViewTests/UnoSamples_Test_NavigateToString.cs b/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/WebViewTests/UnoSamples_Test_NavigateToString.cs new file mode 100644 index 000000000000..6081dd2f089a --- /dev/null +++ b/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/WebViewTests/UnoSamples_Test_NavigateToString.cs @@ -0,0 +1,45 @@ +using NUnit.Framework; +using SamplesApp.UITests.TestFramework; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Uno.UITest.Helpers; +using Uno.UITest.Helpers.Queries; + +namespace SamplesApp.UITests.Windows_UI_Xaml_Controls.WebViewTests +{ + [TestFixture] + public partial class WebView_Tests : SampleControlUITestBase + { + [Test] + [AutoRetry] + public void WebView_NavigateToLongString() + { + Run("UITests.Shared.Windows_UI_Xaml_Controls.WebView.WebView_NavigateToString2"); + + _app.WaitForElement(_app.Marked("startButton")); + + TakeScreenshot("Initial"); + + var startButton = _app.Marked("startButton"); + var clickResult = _app.Marked("WebView_NavigateToStringResult"); + + // step 1: generate long string + _app.Tap(startButton); + + // _app.Wait(TimeSpan.FromSeconds(300)); // Android: 20 is sufficient + _app.WaitForText(clickResult, "string ready"); // timeout here means: add wait + + // step 2: NavigateTo + _app.Tap(startButton); + _app.WaitForText(clickResult, "success"); // timeout here means: bug reappear + + TakeScreenshot("AfterSuccess"); + + } + + } +} diff --git a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems index 0b2f2d98a986..536c729615ef 100644 --- a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems +++ b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems @@ -1753,6 +1753,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -3537,6 +3541,9 @@ UndefinedHeightListView.xaml + + WebView_NavigateToString2.xaml + CopyToClipboard.xaml diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_NavigateToString2.xaml b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_NavigateToString2.xaml new file mode 100644 index 000000000000..7356642c1726 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_NavigateToString2.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + +