From bfa19398ed319b3dc99735e9d2fd2cbbd1c62a24 Mon Sep 17 00:00:00 2001 From: anthony taranto Date: Tue, 28 Feb 2012 19:29:05 -0800 Subject: [PATCH] reenable popup test --- CefSharp.Example/ExamplePresenter.cs | 11 +++++++---- CefSharp.Example/IExampleView.cs | 2 +- CefSharp.Example/Resources/PopupsTest.html | 11 +++++++++++ CefSharp.Example/Resources/TooltipTest.html | 13 +++++++++++++ CefSharp.WinForms.Example/Browser.Designer.cs | 11 ++++++++++- CefSharp.WinForms.Example/Browser.cs | 6 ++++++ CefSharp.Wpf.Example/MainWindow.xaml | 1 + CefSharp.Wpf.Example/MainWindow.xaml.cs | 2 ++ 8 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 CefSharp.Example/Resources/PopupsTest.html create mode 100644 CefSharp.Example/Resources/TooltipTest.html diff --git a/CefSharp.Example/ExamplePresenter.cs b/CefSharp.Example/ExamplePresenter.cs index bfd2f08b7..34266e998 100644 --- a/CefSharp.Example/ExamplePresenter.cs +++ b/CefSharp.Example/ExamplePresenter.cs @@ -21,6 +21,7 @@ namespace CefSharp.Example private const string scheme_url = "test://test/SchemeTest.html"; private const string bind_url = "test://test/BindingTest.html"; private const string tooltip_url = "test://test/TooltipTest.html"; + private const string popup_url = "test:/test/PopupTest.html"; private int color_index = 0; private readonly string[] colors = @@ -56,6 +57,7 @@ namespace CefSharp.Example this.view.TestBindActivated += view_TestBindActivated; this.view.TestConsoleMessageActivated += view_TestConsoleMessageActivated; this.view.TestTooltipActivated += view_TestTooltipActivated; + this.view.TestPopupActivated += view_TestPopupActivated; this.view.ExitActivated += view_ExitActivated; } @@ -70,10 +72,6 @@ namespace CefSharp.Example @string = model.Title; gui_invoke(() => view.SetTitle(@string)); break; - case "TooltipText": - @string = model.TooltipText; - gui_invoke(() => view.SetTooltip(@string)); - break; case "Address": @string = model.Address; gui_invoke(() => view.SetAddress(@string)); @@ -164,6 +162,11 @@ namespace CefSharp.Example model.Load(tooltip_url); } + private void view_TestPopupActivated(object sender, EventArgs e) + { + model.Load(popup_url); + } + private void view_ExitActivated(object sender, EventArgs e) { CEF.Shutdown(); diff --git a/CefSharp.Example/IExampleView.cs b/CefSharp.Example/IExampleView.cs index baf5e1fce..97e5216c4 100644 --- a/CefSharp.Example/IExampleView.cs +++ b/CefSharp.Example/IExampleView.cs @@ -14,10 +14,10 @@ namespace CefSharp.Example event EventHandler TestBindActivated; event EventHandler TestConsoleMessageActivated; event EventHandler TestTooltipActivated; + event EventHandler TestPopupActivated; event EventHandler ExitActivated; void SetTitle(string title); - void SetTooltip(string tooltip); void SetAddress(string address); void SetCanGoBack(bool can_go_back); void SetCanGoForward(bool can_go_forward); diff --git a/CefSharp.Example/Resources/PopupsTest.html b/CefSharp.Example/Resources/PopupsTest.html new file mode 100644 index 000000000..3bc0a7f06 --- /dev/null +++ b/CefSharp.Example/Resources/PopupsTest.html @@ -0,0 +1,11 @@ + + + + Popup Test + + + target=_blank +
+ window.open() + + diff --git a/CefSharp.Example/Resources/TooltipTest.html b/CefSharp.Example/Resources/TooltipTest.html new file mode 100644 index 000000000..dc2f84ff8 --- /dev/null +++ b/CefSharp.Example/Resources/TooltipTest.html @@ -0,0 +1,13 @@ + + + + Scheme Handler Test + + +
+ +
+ +
+ + \ No newline at end of file diff --git a/CefSharp.WinForms.Example/Browser.Designer.cs b/CefSharp.WinForms.Example/Browser.Designer.cs index 2591ca197..d5b52b570 100644 --- a/CefSharp.WinForms.Example/Browser.Designer.cs +++ b/CefSharp.WinForms.Example/Browser.Designer.cs @@ -48,6 +48,7 @@ this.testBindMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.testConsoleMessageMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.testTooltipMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.testPopupMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripContainer.ContentPanel.SuspendLayout(); this.toolStripContainer.TopToolStripPanel.SuspendLayout(); this.toolStripContainer.SuspendLayout(); @@ -177,7 +178,8 @@ this.testEvaluateScriptMenuItem, this.testBindMenuItem, this.testConsoleMessageMenuItem, - this.testTooltipMenuItem}); + this.testTooltipMenuItem, + this.testPopupMenuItem}); this.testsToolStripMenuItem.Name = "testsToolStripMenuItem"; this.testsToolStripMenuItem.Size = new System.Drawing.Size(46, 20); this.testsToolStripMenuItem.Text = "Tests"; @@ -224,6 +226,12 @@ this.testTooltipMenuItem.Size = new System.Drawing.Size(254, 22); this.testTooltipMenuItem.Text = "Test Tooltip"; // + // testPopupMenuItem + // + this.testPopupMenuItem.Name = "testPopupMenuItem"; + this.testPopupMenuItem.Size = new System.Drawing.Size(254, 22); + this.testPopupMenuItem.Text = "Test Popup"; + // // Browser // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -271,6 +279,7 @@ private System.Windows.Forms.ToolStripMenuItem testConsoleMessageMenuItem; private System.Windows.Forms.Label outputLabel; private System.Windows.Forms.ToolStripMenuItem testTooltipMenuItem; + private System.Windows.Forms.ToolStripMenuItem testPopupMenuItem; } } \ No newline at end of file diff --git a/CefSharp.WinForms.Example/Browser.cs b/CefSharp.WinForms.Example/Browser.cs index bd208a07c..de3202121 100644 --- a/CefSharp.WinForms.Example/Browser.cs +++ b/CefSharp.WinForms.Example/Browser.cs @@ -62,6 +62,12 @@ namespace CefSharp.WinForms.Example remove { testTooltipMenuItem.Click -= value; } } + public event EventHandler TestPopupActivated + { + add { testPopupMenuItem.Click += value; } + remove { testPopupMenuItem.Click -= value; } + } + public event EventHandler ExitActivated { add { exitToolStripMenuItem.Click += value; } diff --git a/CefSharp.Wpf.Example/MainWindow.xaml b/CefSharp.Wpf.Example/MainWindow.xaml index 449f22ee7..6283cd4c9 100644 --- a/CefSharp.Wpf.Example/MainWindow.xaml +++ b/CefSharp.Wpf.Example/MainWindow.xaml @@ -16,6 +16,7 @@ + diff --git a/CefSharp.Wpf.Example/MainWindow.xaml.cs b/CefSharp.Wpf.Example/MainWindow.xaml.cs index ec2f923ba..21ac5843a 100644 --- a/CefSharp.Wpf.Example/MainWindow.xaml.cs +++ b/CefSharp.Wpf.Example/MainWindow.xaml.cs @@ -23,6 +23,7 @@ namespace CefSharp.Wpf.Example public event EventHandler TestBindActivated; public event EventHandler TestConsoleMessageActivated; public event EventHandler TestTooltipActivated; + public event EventHandler TestPopupActivated; public event EventHandler ExitActivated; private WebView web_view; @@ -53,6 +54,7 @@ namespace CefSharp.Wpf.Example { testBindMenuItem, TestBindActivated }, { testConsoleMessageMenuItem, TestConsoleMessageActivated }, { testTooltipMenuItem, TestTooltipActivated }, + { testPopupMenuItem, TestPopupActivated }, { exitMenuItem, ExitActivated }, }; }