public void DesignerPropertyEqualsSettingsProperty() { void Action() { var wv = new Forms.UI.Controls.WebView(); ((ISupportInitialize)wv).BeginInit(); wv.IsScriptNotifyAllowed = !wv.IsScriptNotifyAllowed; ((ISupportInitialize)wv).EndInit(); wv.IsScriptNotifyAllowed.ShouldEqual(wv.Settings.IsScriptNotifyAllowed); } #if NETCOREAPP if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA) { Action(); } else { _threadManager.Execute(Action); } #else Action(); #endif }
protected override void CreateWebView() { WebView = new Forms.UI.Controls.WebView() { IsScriptNotifyAllowed = true }; }
public void CanInitializeCtorBeginEndInit() { var wv = new Forms.UI.Controls.WebView(); ((ISupportInitialize)wv).BeginInit(); ((ISupportInitialize)wv).EndInit(); }
protected override void CreateWebView() { WebView = new Forms.UI.Controls.WebView(); ((ISupportInitialize)WebView).BeginInit(); ((ISupportInitialize)WebView).EndInit(); WebView.ShouldNotBeNull(); WebView.Process.ShouldNotBeNull(); }
public void DesignerPropertyEqualsSettingsProperty() { var wv = new Forms.UI.Controls.WebView(); ((ISupportInitialize)wv).BeginInit(); wv.IsScriptNotifyAllowed = !wv.IsScriptNotifyAllowed; ((ISupportInitialize)wv).EndInit(); wv.IsScriptNotifyAllowed.ShouldEqual(wv.Settings.IsScriptNotifyAllowed); }
protected override void CreateWebView() { WebView = new Forms.UI.Controls.WebView(); ((ISupportInitialize)WebView).BeginInit(); ((ISupportInitialize)WebView).EndInit(); WebView.ShouldNotBeNull(); WebView.Process.ShouldNotBeNull(); WebView.Process.ProcessId.ShouldNotEqual(0U); WebView.Process.ProcessExited += (o, e) => { _processExitedEventFired = true; _mre.Set(); }; }
protected async Task SetCookieAsync( Forms.UI.Controls.WebView webView, string cookieName, string cookieValue, DateTime?expiry = null) { string formatExpiry(DateTime?e) => e != null ? $"; expires={e.Value.ToUniversalTime():R}" : string.Empty; var cookie = $"{cookieName}={cookieValue}{formatExpiry(expiry)}"; if (webView != null) { await webView.InvokeScriptAsync("eval", $"document.cookie = \"{cookie}\"").ConfigureAwait(false); } }
protected override void Cleanup() { PrintStartEnd( TestContext.TestName, nameof(Cleanup), () => { UnsubscribeWebViewEvents(); TryAction(() => { if (WebView != null && !WebView.IsDisposed) { WriteLine("WebView is not null and has not been disposed. Calling Dispose()"); WebView.Dispose(); WebView = null; } }); }); base.Cleanup(); }
protected override void CreateWebView() { // This is what Windows Forms designer emits WebView = new Forms.UI.Controls.WebView(); ((ISupportInitialize)WebView).BeginInit(); Form.SuspendLayout(); WebView.Dock = DockStyle.Fill; WebView.Size = Form.ClientSize; WebView.IsScriptNotifyAllowed = true; WebView.IsIndexedDBEnabled = true; WebView.IsJavaScriptEnabled = true; WebView.Visible = true; Form.Controls.Add(WebView); ((ISupportInitialize)WebView).EndInit(); Form.ResumeLayout(false); Form.PerformLayout(); WebView.IsScriptNotifyAllowed.ShouldBeTrue(); WebView.IsIndexedDBEnabled.ShouldBeTrue(); WebView.IsJavaScriptEnabled.ShouldBeTrue(); }
public void CanInitializeCtorBeginEndInit() { void Action() { var wv = new Forms.UI.Controls.WebView(); ((ISupportInitialize)wv).BeginInit(); ((ISupportInitialize)wv).EndInit(); } #if NETCOREAPP if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA) { Action(); } else { _threadManager.Execute(Action); } #else Action(); #endif }
private async Task NewMethod(Forms.UI.Controls.WebView a) { _actual = await a.InvokeScriptAsync("echoOneArgument", "exampleParameter").ConfigureAwait(false); Form.Close(); }
protected override void CreateWebView() { WebView = new Forms.UI.Controls.WebView(); }
protected override void CreateWebView() { WebView = new Forms.UI.Controls.WebView(); ((ISupportInitialize)WebView).BeginInit(); ((ISupportInitialize)WebView).EndInit(); }
public void CanInitializeCtorOnly() { var wv = new Forms.UI.Controls.WebView(); wv.Process.ShouldBeNull(); }
protected Task <string> GetCookiesAsync(Forms.UI.Controls.WebView webView) { return(webView.InvokeScriptAsync("eval", "document.cookie")); }
protected abstract Task SetCookieAsync(Forms.UI.Controls.WebView webView);