[dotnet] [bidi] Implement browsing context download events #16382
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
User description
https://w3c.github.io/webdriver-bidi/#event-browsingContext-downloadWillBegin
https://w3c.github.io/webdriver-bidi/#event-browsingContext-downloadEnd
💥 What does this PR do?
Fix
downloadWillBegin
event signature, implementdownloadEnd
event. Adding tests.🔄 Types of changes
PR Type
Enhancement
Description
Fix
downloadWillBegin
event signature to use proper event argsImplement new
downloadEnd
event with polymorphic event argsAdd comprehensive tests for both download events
Create JSON converters for proper serialization
Diagram Walkthrough
File Walkthrough
BrowsingContext.cs
Update download event method signatures
dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContext.cs
OnDownloadWillBeginAsync
method signatures to useDownloadWillBeginEventArgs
OnDownloadEndAsync
methods for both sync and async handlersBrowsingContextModule.cs
Update module download event subscriptions
dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs
OnDownloadWillBeginAsync
method signatures to use proper eventargs
OnDownloadEndAsync
methods subscribing tobrowsingContext.downloadEnd
DownloadEndEventArgs.cs
Create download end event args classes
dotnet/src/webdriver/BiDi/BrowsingContext/DownloadEndEventArgs.cs
DownloadEndEventArgs
DownloadCanceledEventArgs
andDownloadCompleteEventArgs
derived types
DownloadWillBeginEventArgs.cs
Create download will begin event args
dotnet/src/webdriver/BiDi/BrowsingContext/DownloadWillBeginEventArgs.cs
DownloadWillBeginEventArgs
record with suggested filenameIBaseNavigationInfo
interface for navigation contextDownloadEndEventArgsConverter.cs
Create polymorphic download end converter
dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/DownloadEndEventArgsConverter.cs
DownloadEndEventArgs
canceled
andcomplete
status discriminatorsBroker.cs
Register download end event converter
dotnet/src/webdriver/BiDi/Communication/Broker.cs
DownloadEndEventArgsConverter
for polymorphic JSONserialization
BiDiJsonSerializerContext.cs
Register download event types for serialization
dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs
BrowsingContextEventsTest.cs
Add download events integration tests
dotnet/test/common/BiDi/BrowsingContext/BrowsingContextEventsTest.cs
downloadWillBegin
event with file download simulationdownloadEnd
event verifying completion and filepath