mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 19:25:01 +00:00
9407ba1828
Readd CefSharp.Test.csproj to solution Add some very basic unit tests using xunit, DisableTestParallelization, Set xunit.appDomain to denied in app.config to disable using appdomains (https://xunit.github.io/docs/configuring-with-xml.html) Add xunit vs test running packages, using 2.2.0 version as 2.3.0 was throwing an exception similar to https://github.com/xunit/xunit/issues/1514 TODO: Take a look at https://github.com/NuGet/NuGetGallery/tree/master/tests/NuGetGallery.Facts for some ideas on structuring xunit tests (look at implementing Theory) NOTE: I am not providing this as a definitive set of tests, it's simply here to get someone else started in creating tests as it appears people have trouble dealing with AppDomain problem Only includes Tests for the OffScreen version at this stage.
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
// Copyright © 2010-2017 The CefSharp Authors. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace CefSharp.Test
|
|
{
|
|
public class CefSharpFixture : IDisposable
|
|
{
|
|
public CefSharpFixture()
|
|
{
|
|
if (!Cef.IsInitialized)
|
|
{
|
|
var isDefault = AppDomain.CurrentDomain.IsDefaultAppDomain();
|
|
if (!isDefault)
|
|
{
|
|
throw new Exception(@"Add <add key=""xunit.appDomain"" value=""denied""/> to your app.config to disable appdomains");
|
|
}
|
|
|
|
var settings = new CefSettings();
|
|
|
|
//The location where cache data will be stored on disk. If empty an in-memory cache will be used for some features and a temporary disk cache for others.
|
|
//HTML5 databases such as localStorage will only persist across sessions if a cache path is specified.
|
|
settings.CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Tests\\Cache");
|
|
|
|
Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);
|
|
}
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (Cef.IsInitialized)
|
|
{
|
|
Cef.Shutdown();
|
|
}
|
|
}
|
|
}
|
|
}
|