Chromium Code Reviews
DescriptionMake MediaStreamDevicesController tests go through the RequestPermissions API
In https://codereview.chromium.org/2706813004/ the consumers of
MediaStreamDevicesController were changed to use a static RequestPermissions
function instead of constructing the object directly. This facilitated moving
the prompting logic closer to the permission status checking logic which will
help us move to using PermissionManager to request permissions.
This CL does the same things for tests that are consumers of
MediaStreamDevicesController. This ensures that if we move any logic out of the
class and into the static entry point, that tests will continue to work
correctly.
In order to do this it means that tests still need a way to simulate
accepting permission prompts. Previously they did this by operating directly on
the MediaStreamDevicesController object, but that has been taken away. It has
been replaced by a private version of the entry point:
RequestPermissionsWithDelegate. This allows them to pass in a delegate which
can be used to determine whether prompts have been shown and to accept/deny
them.
The big benefit of this approach is that the delegate has been given the same
API as the MockPermissionPromptFactory. MockPermissionPromptFactory is the
class that is used to simulate/control permission prompts in tests of all other
permissions that use PermissionRequestManager. So, when the refactoring in
https://crbug.com/606138 is completed, we can replace the Delegate with a
MockPermissionPromptFactory and the tests themselves will not need to be
altered.
BUG=596786
Review-Url: https://codereview.chromium.org/2711883003
Cr-Commit-Position: refs/heads/master@{#454974}
Committed: https://chromium.googlesource.com/chromium/src/+/2d2d7d754045d63fd75aaee27026d27ae1e2fdab
Patch Set 1 #
Total comments: 2
Patch Set 2 : Add test delegate #
Depends on Patchset: Dependent Patchsets: Messages
Total messages: 23 (13 generated)
|
||||||||||||||||||||||||||||||||||||||||||||||