Bug 186958

Summary: Add API to control mock media devices
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric.carlson, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch for landing
none
Patch for landing none

Description youenn fablet 2018-06-22 18:48:46 PDT
This will allow improving testing
Comment 1 youenn fablet 2018-06-22 18:56:07 PDT
Created attachment 343414 [details]
Patch
Comment 2 youenn fablet 2018-06-22 21:37:52 PDT
Created attachment 343418 [details]
Patch
Comment 3 youenn fablet 2018-06-23 10:23:22 PDT
Created attachment 343441 [details]
Patch
Comment 4 youenn fablet 2018-06-23 14:35:48 PDT
Comment on attachment 343441 [details]
Patch

Patch is ready for a first round of review.
I need to beef-up the change log, especially the changes to MediaDevices to ensure it is not GCed while dispatching events.
Comment 5 Radar WebKit Bug Importer 2018-06-23 14:36:16 PDT
<rdar://problem/41401524>
Comment 6 Eric Carlson 2018-06-25 08:20:44 PDT
Comment on attachment 343441 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=343441&action=review

> Source/WebKit/UIProcess/API/C/WKMockMediaDevice.cpp:48
> +static inline std::optional<Properties> typeFromString(const String& type)
> +{
> +    if (type == "camera")
> +        return Properties { WebCore::MockCameraProperties { } };
> +    if (type == "microphone")
> +        return Properties { WebCore::MockMicrophoneProperties { } };
> +    if (type == "screen")
> +        return Properties { WebCore::MockDisplayProperties { } };
> +    return std::nullopt;
> +}

Nit: this is only used in one place. Is there a plan to use it in more place?
Comment 7 youenn fablet 2018-06-25 10:17:11 PDT
Created attachment 343508 [details]
Patch for landing
Comment 8 youenn fablet 2018-06-25 11:13:41 PDT
Created attachment 343517 [details]
Patch for landing
Comment 9 WebKit Commit Bot 2018-06-25 12:19:13 PDT
Comment on attachment 343517 [details]
Patch for landing

Clearing flags on attachment: 343517

Committed r233162: <https://trac.webkit.org/changeset/233162>
Comment 10 WebKit Commit Bot 2018-06-25 12:19:15 PDT
All reviewed patches have been landed.  Closing bug.