Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Issue 2711883003: Change MediaStreamDevicesController tests to use RequestPermissions function (Closed)

Created:
3 years, 10 months ago by raymes
Modified:
3 years, 9 months ago
Reviewers:
Timothy Loh, pastarmovj
CC:
chromium-reviews, chfremer+watch_chromium.org, phoglund+watch_chromium.org, mcasas+watch+vc_chromium.org, feature-media-reviews_chromium.org, chrome-apps-syd-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+310 lines, -221 lines) Patch
M chrome/browser/media/webrtc/media_stream_devices_controller.h View 2 chunks +19 lines, -0 lines 0 comments Download
M chrome/browser/media/webrtc/media_stream_devices_controller.cc View 2 chunks +67 lines, -43 lines 0 comments Download
M chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc View 1 20 chunks +188 lines, -170 lines 0 comments Download
M chrome/browser/policy/policy_browsertest.cc View 4 chunks +36 lines, -8 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 23 (13 generated)
raymes
3 years, 9 months ago (2017-02-27 06:42:40 UTC) #4
Timothy Loh
https://codereview.chromium.org/2711883003/diff/1/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc File chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc (right): https://codereview.chromium.org/2711883003/diff/1/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc#newcode696 chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc:696: ASSERT_EQ(test.NumExpectedPrompts(), This makes the test a bit less thorough, ...
3 years, 9 months ago (2017-02-28 00:39:20 UTC) #5
raymes
https://codereview.chromium.org/2711883003/diff/1/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc File chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc (right): https://codereview.chromium.org/2711883003/diff/1/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc#newcode696 chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc:696: ASSERT_EQ(test.NumExpectedPrompts(), On 2017/02/28 00:39:20, Timothy Loh wrote: > This ...
3 years, 9 months ago (2017-03-01 02:08:01 UTC) #6
Timothy Loh
On 2017/03/01 02:08:01, raymes wrote: > https://codereview.chromium.org/2711883003/diff/1/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc > File chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc > (right): > > https://codereview.chromium.org/2711883003/diff/1/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc#newcode696 ...
3 years, 9 months ago (2017-03-01 06:45:27 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2711883003/20001
3 years, 9 months ago (2017-03-06 00:45:17 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/378497)
3 years, 9 months ago (2017-03-06 00:50:47 UTC) #15
raymes
+pastarmovj for policy_browsertest.cc
3 years, 9 months ago (2017-03-06 01:12:30 UTC) #17
pastarmovj
lgtm
3 years, 9 months ago (2017-03-06 08:02:25 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2711883003/20001
3 years, 9 months ago (2017-03-06 21:42:30 UTC) #20
commit-bot: I haz the power
3 years, 9 months ago (2017-03-06 22:17:24 UTC) #23
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://chromium.googlesource.com/chromium/src/+/2d2d7d754045d63fd75aaee27026...

Powered by Google App Engine
This is Rietveld 408576698