forked from cefsharp/CefSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFixture.cs
54 lines (46 loc) · 1.24 KB
/
Fixture.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System.Threading;
using System.Windows.Forms;
using NUnit.Framework;
using CefSharp.WinForms;
namespace CefSharp.Test
{
[SetUpFixture]
public class Fixture
{
public static WebView Browser { get; private set; }
private ManualResetEvent createdEvent = new ManualResetEvent(false);
[SetUp]
public void SetUp()
{
var settings = new Settings();
if (!CEF.Initialize(settings))
{
Assert.Fail();
}
var thread = new Thread(() =>
{
var form = new Form();
form.Shown += (sender, e) =>
{
Browser = new WebView
{
Parent = form,
Dock = DockStyle.Fill,
};
createdEvent.Set();
};
Application.Run(form);
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
createdEvent.WaitOne();
}
[TearDown]
public void TearDown()
{
createdEvent.WaitOne();
CEF.Shutdown();
Application.Exit();
}
}
}