18 Commits

Author SHA1 Message Date
Alex Maitland cafd378859 Test - Code Cleanup
- Start splitting tests out into own files where relevant
- Improve call ordering
- Use Assert.RaisesAsync where possible
- Classes have been renamed (Tests is now the standard suffix)

TODO: Some of the classes still need their method names changed
2023-02-17 13:53:23 +10:00
Alex Maitland a51da76ad9 OffScreen - Add useLegacyRenderHandler optional param to constructor
- Defaults to true
- For those using CaptureScreenshotAsync set to false to avoid
  creating DefaultRenderHandler
2023-01-15 11:33:08 +10:00
Alex Maitland d26789bfc2 Test - Add DevToolsClientFacts MediaQuery test 2022-03-22 16:46:04 +10:00
Alex Maitland 4a07af26e9 Core - Rename WaitForBrowserInitialLoadAsync to WaitForInitialLoadAsync and simplify
- Initial intention was to have a reusable method that could be used CefSharp.Wpf.HwndHost,
  upon further deliberation I've decided to build the functionality into the ChromiumWebBrowser.Partial.cs
  and will need to duplicate the functionality in CefSharp.Wpf.HwndHost. This guarantees that the
  Task will be resolved in all cases. The previous implementation there was a theoretical change we'd
  miss subscribing to the relevant events
- Remove CancellationToken as it's not possible to cancel

Issue #3842
2021-10-28 10:31:03 +10:00
Alex Maitland 91b7514a1c WinForms/WPF/OffScreen - Add WaitForBrowserInitialLoadAsync
Second attempt at WaitForBrowserInitialLoadAsync, includes optional
CancellationToken param.

Issue #3842
2021-10-27 13:58:57 +10:00
Alex Maitland 544abc68d1 Revert "WinForms/WPF/OffScreen - Add WaitForBrowserInitialLoadAsync"
Tests started failing so will revisit later.

This reverts commit 08e5140060.
2021-10-11 10:14:31 +10:00
Alex Maitland 08e5140060 WinForms/WPF/OffScreen - Add WaitForBrowserInitialLoadAsync
Change all the tests to use WaitForBrowserInitialLoadAsync instead of LoadUrlAsync
as LoadUrlAsync will require a Url as part of #3842
2021-10-10 14:41:04 +10:00
Alex Maitland 0804a404c7 DevTools Client - Add Event error handling
- New event that is raised when an exception occurs during converting a response to JSON
- Test cleanup
- New unit test to validate IEventProxy has been removed from ConcurrentDictionary

Resolves #3787
2021-09-10 14:15:57 +10:00
campersau 9a37ebdbd3 DevTools Client - Generic ExecuteDevToolsMethodAsync and add RegisterEventHandler (#3674)
* Make ExecuteDevToolsMethodAsync generic

* Make RegisterEventHandler generic

* PR feedback and added test for registering multiple event handlers

* Updated generated code to latest version

* Fix possible NRE when removing event listener before adding one
2021-07-26 12:01:46 +10:00
Alex Maitland 4a20b19e6b Test - Minor cleanup 2021-07-05 11:16:25 +10:00
campersau b8896da54d DevTools - Support strongly typed events (#3669)
Includes various other DevTools fixes:
- JavaScript "number"s are represented as doubles instead of longs
- Headers are now correctly serialized / deserialized
- DevToolsDomainErrorResponse is now correctly deserialized
2021-07-05 10:32:22 +10:00
Alex Maitland 42ffee0bcd Test - Add DevToolsClientFacts.CanCaptureScreenshot
- Capture screenshot, load data and confirm width/height match browser
2021-06-21 10:25:56 +10:00
Alex Maitland 4e16f3b16d Enhancement - Add LoadUrlAsync (#3596)
Core - Add LoadUrlAsync

- Add IWebBrowser.LoadUrlAsync
- Add LoadUrlAsyncResponse
- Update unit tests to use new method
-  Add static method to allow for CefSharp.Wpf.HwndHost to share the same code.
2021-06-04 13:29:40 +10:00
campersau 7888b147ea DevTools Client - Serialize lists of DevToolsDomainEntityBase (#3487) 2021-04-09 05:38:15 +10:00
Alex Maitland 848413bb2c DevTools Client - Make Message Id globally unique
When attempting to use two DevTools Client instances the message Id
fails validation as it's not incrementing per CefBrowser instance.

This should be made unique per CefBrowser

Issue #3341 has been created to document improving this.
2021-01-08 17:03:24 +10:00
Alex Maitland dcf5b43dc4 Core - Add Net Core DevTools
- Add specific Net Core DevTools generated code
- Improve xml doc generation for both Net 4.x and Net Core/Net 5
2021-01-08 14:26:21 +10:00
amaitland 2d3be70609 Test - Add expiry to DevToolsClientFacts.CanSetCookieForDomain test
#3218
2020-10-16 19:58:30 +10:00
Alex Maitland 78e32a3b9f Enhancement - Add DevToolsClient (#3229)
* Core - Add DevToolsClient

Issue #3165

* DevTools Client - Add Network domain class

- Add hand written class to get a better sense of how the code should be structured.
- Improve exception handling

* Devtools - First draft of devtools protocol methods (generated)

Not complete yet

* Devtools - Simple method execution working

* DevTools - Add .Net Style cased property names to response objects

- Use internal field and datacontract attributes

* DevTools - Improve mapping

* DevTools - Strongly typed enums

* DevTools Client - Generated from active browser instance (M84)

* Devtools Client - Extract IDevToolsClient interface for testability

Improve xml doc comments

* DevTools Client - Improve error handling

* DevTools Client - Improve enum conversion

* Revert to older c# syntax

* DevTools Client - Fix failing tests

* Devtools Client - Add SetCookie Tests

* DevTools Client - Add Capture SyncContext by default

- Add option to capture the SyncContext
- Add option to provide custom SyncContext (can just pass in UI SyncContext and all continuations will happen there).
- Fix bug in ExecuteDevToolsMethodAsync sending the command twice when exeucted on the CEF UI thread

* Devtools Client - Add missing file reference

The problem with developing with the .Net Core project where files are automatically included is you
forget to include them in the regular csproj file.

* Devtools Client - Add CanCanEmulate Test case

* DevTools Client - Add AddScriptToEvaluateOnNewDocumentAsync test

* DevTools Client - OnDevToolsEvent only parse data if event handler != null

* DevTools Client - GetDevToolsClient remove ThrowExceptionIfDisposed/ThrowExceptionIfBrowserNotInitialized calls

Those methods were removed as the GetBrowser call handles the checks for us.

* DevTools Client - Improve error handling

* DevTools Client - Update xml doc comments

* DevTools Client - Add validation method (partial)

Add ability to manually add validation logic

* DevTools Client - Comment out failing test

Was working when targeting M84, now with M85 it fails.

The mapping appears to be correct, will need to investigate further

* OffScreen Example - Remove test code
2020-09-21 19:32:25 +10:00