Commit Graph

32 Commits

Author SHA1 Message Date
Alex Maitland b8b27f6885 WPF/OffScreen - Add WaitForRenderIdleAsync (#4080)
* WPF/OffScreen - Add WaitForRenderIdleAsync

- Task resolves when render has been idle for the specified time
- Make TaskTimeoutExtensions public (they're not extension methods as this was expected)
2022-05-30 19:11:17 +10:00
Alex Maitland 15cf58c273 Core - Add IRequestContext.GetCookieManagerAsync extension method
- Will return the cookie manager when the backing store has loaded
  otherwise returns null
2021-10-08 13:08:31 +10:00
Alex Maitland c5ba1ce430 Core - Add Cef.ParseUrl
Uses GURL to parse the Url (Google's URL parsing library)
2021-09-16 10:05:34 +10:00
Alex Maitland 0f691b678e Test - Add MethodRunnerQueueFacts.DisposeQueueThenEnqueueMethodInvocation
Test to validate that MethodRunnerQueue doesn't have the same issues as #3639
2021-06-25 16:37:37 +10:00
Alex Maitland 4ab6d2ad25 Core - ConcurrentMethodRunnerQueue.Enqueue throws InvalidOperationException
When ConcurrentMethodRunnerQueue.Dispose is called from a different thread it appears that
the CancellationTokenSource is cancelled (via Dispose) inbetween creation of the Task
and calling Task.Start(TaskScheduler).

Switch from using Task constructor and Task.Start to the preferred Task.Run method.

Added additional unit tests.

Issue #3639
2021-06-25 14:08:50 +10:00
Alex Maitland 11c41aea0d Test - CachePath should be child of RootCachePath 2021-05-12 11:00:08 +10:00
Alex Maitland 497e75c267 Test - Add CanLoadRequestWithPostData test 2021-01-15 13:40:37 +10:00
Alex Maitland 8a367fbdc4 Refactor CefSharp.Core into CefSharp.Core.Runtime (#3311)
* Net Core - Rename CefSharp.Core.dll to CefSharp.Core.Runtime.dll

Partial rename, only Net Core, folder not renamed

* Net Core - Rename CefSharp.Core.RefAssembly to CefSharp.Core.netcore

Remove GenApi

* Core - Rename CefDragDataWrapper to DragData

Move into CefSharp.Core namespace

* WinForms/WPF/OffScreen - Migrate from GitLink command line to Nuget package

* Net Core - Refactor to have CefSharp.Core.dll contain only public Api

* Net Core - Remove CefSharp.Core.RefAssembly

* Net Core - Change CefSharp.Core.netcore output folder

* Net Core - Restructure nuget packages

* Net Core - Add Cefsharp.Core.Runtime.RefAssembly

* Net Core - Hide CLI/C++ classes from intellisense

Make sure users don't attempt to load them directly

* Rename CefSharp.Core to CefSharp.Core.Runtime

* Core - Restructure Net 4.5.2 packages to use CefSharp.Core.dll anycpu variant

Attempt to load CefSharp.Core.Runtime at runtime rather than having to use msbuild to copy the correct version

* Rename CefSharp.Core.netcore to CefSharp.Core

* WPF/WinForms/OffScreen - Change from x86/64 to AnyCPU

As they are all managed assemblies they can target AnyCPU.
Includes CefSharp.dll

* Convert RequestContextBuilder from C++ to C#

Now part of the CefSharp.Core PublicApi

* Update version number to 87.1.11

* Migrate more of the public Api to C#

* Net Core - Basic restructure complete

* Net Core - ModuleInitializer (Doesn't work yet)

* Remove direct references to BrowserSettings

* Net Core - ModuleInitializer load CefShar.Core.Runtime.dl

* Net Core - Load libcef.dll via CLR Module initializer

If no RID is specified then we can load libcef.dll using the module initializer

* Add version to CefSharp.Core

* Remove dependency on CefSharp.Core.Runtime
Rewrite common targets

* AnyCPU app.config transform

Improve AnyCPU support

* Improve Net Core 3 support
Only delete CefSharp.Core.Runtime.dll when AnyCPU

* Nuget - Add CefSharp.Core.Runtime reference when TargetFramework = NetCore

* Fix Typos

Based on #3306

* Net Core - Rename CefSharp.Core.Runtime RefAssembly source file

* Net Full - Generate CefSharp.Core.Runtime Ref Assembly

For now the powershell build script generates the .cs file based on a x86 release build.ps1
It's not possible to directly install GenApi as it requires a Sdk style project

* Net Core - Old packages copy files to required folders

* Test - Install newer .Net Compiler and set Lang Version to 7.3

* Net Core - Exclude Net 452 Runtime generated reference source

* Core - Add Refactoring TODO

* Ref Assembly - Generate source as part of build

- Move ref assembly source generate into GenerateRefAssemblySource.ps1
- Call before project build

Runs locally, see if Appveyor has a problem with the powershell script execution

* Core - Add more factory methods to create instances of managed wrappers

* Net Core - Make Initialzier properties internal

Not quite sure what the public API should look like as yet, so making internal for now.
2020-12-16 10:47:34 +10:00
amaitland 55af252d91 Core - Refactor JavascriptObjectRepository to IJavascriptObjectRepositoryInternal
Basic refactoring in preparation for allowing users(advanced) to provide their own custom JavascriptObjectRepository implementation
2020-11-25 15:23:29 +10:00
Alex Maitland 3eca8bdba6 Enhancement - Simplify Setting of RequestContext Proxy (#3250)
Core - Simplify Setting of Proxy for new RequestContext

- Throw exception if requestContext.CanSetPreference returns false.
Proxy likely set via command line args.
- Add IRequestContext.SetPreferenceAsync
-  Test - Add SelfHosted Proxy
Use Titanium.Web.Proxy to self host a proxy for testing proxy settings
Only run Proxy Tests when run locally
- Add RequestContext Builder Fluent API
2020-10-13 13:40:46 +10:00
amaitland b4c2e359a6 Core - Improve IRequestContext.SetProxy extension Method
- Add tests
- Add better validation

Issue #3235
2020-10-02 17:13:49 +10:00
amaitland 74c23b1dfe Test - Revert c# Discard
Older compiler doesn't like it

Will look at rewriting test later
2020-08-18 19:20:44 +10:00
amaitland f11785e44b Core - Fix some compiler warnings 2020-08-18 18:08:09 +10:00
Alex Maitland b5a83f526e Enhancement - Pluggable Javascript Naming (#3141)
* Core - Move NameConverter to IJavascriptObjectRepository

- Move NameConverter property from BindingOptions to IJavascriptObjectRepository
- Remove BindingOptions.CamelCaseJavascriptNames

**Breaking Change**

Follow up to https://github.com/cefsharp/CefSharp/commit/898ca38e7a7261b3a42c33b2abf5eac6c022ddde

* Core - Javascript Binding Pluggable Naming Improvements

- Added some basic unit tests (more required)
- DefaultBinder now accepts a IJavascriptNameConverter passed into the constructor
  to allow for conversion of names

* Core - Replace WeakReference with WeakReference<T>
2020-07-27 20:13:16 +10:00
amaitland 1af1065f03 Net Core - Add XUnit Test Project
Issue #3197
2020-07-24 21:07:29 +10:00
amaitland 940034314b Tests - Convert BinderFacts.NullToValueType to NullToValueTypeTheory
Now uses Theory with InlineData
2020-05-18 11:47:43 +10:00
amaitland 99cc2d5030 Core - Cef.GetMimeType custom/fallback mimeType mapping
- return application/octet-stream when no mapping found
- Add custom dictionary with some additional mimeTypes, users can add their own to this dictionary
- Add xunit test

Resolves #3041
2020-05-18 11:47:42 +10:00
amaitland ef590444b4 Core - DefaultBinder InvalidOperationException when binding [1,2,3,1.23] to double[]
- Bind for all elements in a collection, not just when the collection contains list/arrays
- Add additional unit tests

JavaScript array of [1,2,3,1.23] translates to [int, int, int, double], when attempting to Bind
to a double[] an InvalidOperationException was thrown. We now call Bind for each element,
when the type is directly assignable we return the value, for cases like above we perform a
type conversion.

Resolves #3129
2020-05-18 09:13:02 +10:00
amaitland 98b7abeeea Core - PathCheck rewrite to match Chromium FilePath::IsAbsolute
Resovles #3102
2020-05-03 19:28:32 +10:00
amaitland e1401e7092 Core - Ensure CachePath/RootCachePath/LocalesDirPath/BrowserSubprocessPath are absolute
CEF now requires this to be absolute, we enforce this by throwing exception if non-absolute

Resolves  #3102
2020-05-03 16:59:57 +10:00
amaitland ce94992d28 Tests - Skip ConcurrentMethodRunnerQueueFacts.ValidateAsyncTaskMethodOutput
It's unreliable, will improve as part of https://github.com/cefsharp/CefSharp/issues/3067
2020-04-01 12:34:25 +10:00
amaitland 9d10775566 Test - Rewrite ValidateAsyncTaskMethodOutput to use AsyncManualResetEvent
Also increased timeout.

Issue #3067
2020-03-02 12:16:21 +10:00
amaitland 82ec447d23 Test - ValidateAsyncTaskMethodOutput dispose of MethodRunnerQueue after result complete
Issue #3067
2020-02-29 14:54:05 +10:00
campersau 967ad22e60 CefSharp.Text - Add BindingRedirectHelper
Replaces BindingRedirectFixtureCollection/BindingRedirectFixture

https://github.com/cefsharp/CefSharp/pull/3065#issuecomment-592828985

Issue #3065
2020-02-29 13:26:13 +10:00
campersau a6aa5ec05c AppVeyor - Enable Unit Tests on Build (#3065)
AppVeyor - Enable Unit Tests on Build

* Test - Fix tests

* use async which isn't that flaky

* rename CurrentDomainAssemblyResolve

* replace project reference to CefSharp.BrowserSubprocess with solution dependency

* updated comment on fixture

* revert whitespace changes

* remove project reference to CefSharp.BrowserSubprocess for consistency

solution dependency already exists

* move binding redirect with assembly resolve to separate fixture

* Revert "remove project reference to CefSharp.BrowserSubprocess for consistency"

This reverts commit b8b1d28c30.

* Revert ConcurrentMethodRunnerQueueFacts
2020-02-29 12:28:45 +10:00
amaitland 396e2cb5b8 ModelBinding - Major refactor
- Remove unused IFieldNameConverter/DefaultFieldNameConverter
- DefaultBinder remove blacklistnames
2019-10-04 14:41:45 +10:00
amaitland 25ab209380 MethodRunnerQueue/ConcurrentMethodRunnerQueue - Remove custom task execution queue
- ConcurrentMethodRunnerQueue we now directly queue tasks on TaskScheduler.Default
- MethodRunnerQueue now uses LimitedConcurrencyLevelTaskScheduler (example from Microsoft) to limit execution to one concurrent task
- MethodRunnerQueue tasks are now run on the ThreadPool directly instead of our own custom thread, should have some threading implications
for user
- IMethodRunnerQueue now implements IDisposable

Resolves #2873
2019-09-06 11:05:18 +10:00
Alex Maitland fe98124c9b Async JavascriptBinding - Add support for returning Task (#2771)
* Async JavascriptBinding - Add support for returning Task

Remove Parallel Task execution code from MethodRunnerQueue
Add ParallelMethodRunnerQueue
  - For the new code path the Func is executed, if the Result is a generic Task we wait for it's completion
  - If the task is not generic then we return immediately

This is only enabled when CefSharpSettings.ConcurrentTaskExecution = true;
* MethodRunnerQueue - Display error message when method returns Task
* ParallelMethodRunnerQueue - Rename to ConcurrentMethodRunnerQueue
* MethodRunnerQueue - Improve formatting of error message when method returns Task
* Async JavascriptBinding Return Task - Add Basic xUnit Test

Very quick test, needs to be refined a little. The basics are working as expected.

* Add Binding Test Async Task Example to the WPF Example menu

* Async JSB Task - Add additional tests and improve error messaging
2019-06-08 17:21:49 +10:00
Chris bef5dd37c4 Maintenance - Fixed formatting, file encoding, and copyright year (#2504)
* Applied formatting

* Fixed file encoding + Updated copyright year

* Updated License

* Fixed more file encoding

* Copyright notice now shows the year the file was created
2018-09-10 10:41:13 +10:00
amaitland dd42fdbed7 AsyncExtensionFacts - Add test case for #2349 2018-05-03 13:06:10 +10:00
João Neves 206e419786 Fix enums, integer and doubles binding behavior (#2219)
* Fix enums binding behavior

* Whitespace cleanups
2018-01-08 14:33:02 +10:00
amaitland 9407ba1828 Due to limitations of VC++ we must run our tests in the default appdomain, it's possible to use xunit for testing.
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.
2017-10-25 10:44:38 +10:00