| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 11 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 11 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 12 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" | 12 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" |
| 13 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h" | 13 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h" |
| 14 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" | 14 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" |
| 15 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" | 15 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" |
| 16 #include "chrome/browser/permissions/permission_context_base.h" | 16 #include "chrome/browser/permissions/permission_context_base.h" |
| 17 #include "chrome/browser/permissions/permission_request_manager.h" |
| 17 #include "chrome/browser/permissions/permission_util.h" | 18 #include "chrome/browser/permissions/permission_util.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
| 23 #include "components/content_settings/core/browser/host_content_settings_map.h" | 24 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 24 #include "components/prefs/pref_service.h" | 25 #include "components/prefs/pref_service.h" |
| 25 #include "components/variations/variations_associated_data.h" | 26 #include "components/variations/variations_associated_data.h" |
| 26 #include "content/public/common/media_stream_request.h" | 27 #include "content/public/common/media_stream_request.h" |
| 27 #include "content/public/test/mock_render_process_host.h" | 28 #include "content/public/test/mock_render_process_host.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 29 | 30 |
| 30 namespace { | |
| 31 | |
| 32 // Causes the controller to update the TabSpecificContentSettings associated | |
| 33 // with the same WebContents with the current permissions. This should be the | |
| 34 // last change made to the controller in the test. | |
| 35 void NotifyTabSpecificContentSettings( | |
| 36 MediaStreamDevicesController* controller) { | |
| 37 // Note that calling Deny() would have the same effect of passing the current | |
| 38 // permissions state to the TabSpecificContentSettings. Deny() and Accept() | |
| 39 // differ in their effect on the controller itself, but that is not important | |
| 40 // in the tests calling this. | |
| 41 if (controller->IsAskingForAudio() || controller->IsAskingForVideo()) | |
| 42 controller->PermissionGranted(); | |
| 43 } | |
| 44 | |
| 45 } // namespace | |
| 46 | |
| 47 class MediaStreamDevicesControllerTest : public WebRtcTestBase { | 31 class MediaStreamDevicesControllerTest : public WebRtcTestBase { |
| 48 public: | 32 public: |
| 33 // TODO(raymes): When crbug.com/606138 is finished and the |
| 34 // PermissionRequestManager is used to show all prompts on Android/Desktop |
| 35 // we should remove PermissionPromptDelegate and just use |
| 36 // MockPermissionPromptFactory instead. The APIs are the same. |
| 37 class TestPermissionPromptDelegate |
| 38 : public MediaStreamDevicesController::PermissionPromptDelegate { |
| 39 public: |
| 40 void ShowPrompt( |
| 41 bool user_gesture, |
| 42 content::WebContents* web_contents, |
| 43 std::unique_ptr<MediaStreamDevicesController> controller) override { |
| 44 if (controller->IsAskingForAudio()) |
| 45 last_requests_.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 46 if (controller->IsAskingForVideo()) |
| 47 last_requests_.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 48 |
| 49 if (response_type_ == PermissionRequestManager::ACCEPT_ALL) |
| 50 controller->PermissionGranted(); |
| 51 else if (response_type_ == PermissionRequestManager::DENY_ALL) |
| 52 controller->PermissionDenied(); |
| 53 } |
| 54 |
| 55 void set_response_type( |
| 56 PermissionRequestManager::AutoResponseType response_type) { |
| 57 response_type_ = response_type; |
| 58 } |
| 59 |
| 60 size_t TotalRequestCount() { return last_requests_.size(); } |
| 61 |
| 62 bool WasRequested(ContentSettingsType type) { |
| 63 return std::find(last_requests_.begin(), last_requests_.end(), type) != |
| 64 last_requests_.end(); |
| 65 } |
| 66 |
| 67 void Reset() { last_requests_.clear(); } |
| 68 |
| 69 private: |
| 70 PermissionRequestManager::AutoResponseType response_type_ = |
| 71 PermissionRequestManager::NONE; |
| 72 std::vector<ContentSettingsType> last_requests_; |
| 73 }; |
| 74 |
| 49 MediaStreamDevicesControllerTest() | 75 MediaStreamDevicesControllerTest() |
| 50 : example_audio_id_("fake_audio_dev"), | 76 : example_audio_id_("fake_audio_dev"), |
| 51 example_video_id_("fake_video_dev"), | 77 example_video_id_("fake_video_dev"), |
| 52 media_stream_result_(content::NUM_MEDIA_REQUEST_RESULTS) {} | 78 media_stream_result_(content::NUM_MEDIA_REQUEST_RESULTS) {} |
| 53 | 79 |
| 54 // Dummy callback for when we deny the current request directly. | 80 // Dummy callback for when we deny the current request directly. |
| 55 void OnMediaStreamResponse(const content::MediaStreamDevices& devices, | 81 void OnMediaStreamResponse(const content::MediaStreamDevices& devices, |
| 56 content::MediaStreamRequestResult result, | 82 content::MediaStreamRequestResult result, |
| 57 std::unique_ptr<content::MediaStreamUI> ui) { | 83 std::unique_ptr<content::MediaStreamUI> ui) { |
| 58 media_stream_devices_ = devices; | 84 media_stream_devices_ = devices; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 69 return TabSpecificContentSettings::FromWebContents(GetWebContents()); | 95 return TabSpecificContentSettings::FromWebContents(GetWebContents()); |
| 70 } | 96 } |
| 71 | 97 |
| 72 const std::string& example_audio_id() const { return example_audio_id_; } | 98 const std::string& example_audio_id() const { return example_audio_id_; } |
| 73 const std::string& example_video_id() const { return example_video_id_; } | 99 const std::string& example_video_id() const { return example_video_id_; } |
| 74 | 100 |
| 75 content::MediaStreamRequestResult media_stream_result() const { | 101 content::MediaStreamRequestResult media_stream_result() const { |
| 76 return media_stream_result_; | 102 return media_stream_result_; |
| 77 } | 103 } |
| 78 | 104 |
| 79 std::unique_ptr<MediaStreamDevicesController> | 105 void RequestPermissions(content::WebContents* web_contents, |
| 80 CreateMediaStreamDevicesController( | 106 const content::MediaStreamRequest& request, |
| 81 content::WebContents* web_contents, | 107 const content::MediaResponseCallback& callback) { |
| 82 const content::MediaStreamRequest& request, | 108 MediaStreamDevicesController::RequestPermissionsWithDelegate( |
| 83 const content::MediaResponseCallback& callback) { | 109 web_contents, request, callback, &prompt_delegate_); |
| 84 return base::WrapUnique( | |
| 85 new MediaStreamDevicesController(web_contents, request, callback)); | |
| 86 } | 110 } |
| 87 | 111 |
| 88 bool IsAskingForAudio(const MediaStreamDevicesController* controller) { | 112 TestPermissionPromptDelegate* prompt_delegate() { return &prompt_delegate_; } |
| 89 return controller->IsAskingForAudio(); | |
| 90 } | |
| 91 | |
| 92 bool IsAskingForVideo(const MediaStreamDevicesController* controller) { | |
| 93 return controller->IsAskingForVideo(); | |
| 94 } | |
| 95 | |
| 96 void PermissionGranted(MediaStreamDevicesController* controller) { | |
| 97 return controller->PermissionGranted(); | |
| 98 } | |
| 99 | |
| 100 void PermissionDenied(MediaStreamDevicesController* controller) { | |
| 101 return controller->PermissionDenied(); | |
| 102 } | |
| 103 | 113 |
| 104 // Sets the device policy-controlled |access| for |example_url_| to be for the | 114 // Sets the device policy-controlled |access| for |example_url_| to be for the |
| 105 // selected |device_type|. | 115 // selected |device_type|. |
| 106 void SetDevicePolicy(DeviceType device_type, Access access) { | 116 void SetDevicePolicy(DeviceType device_type, Access access) { |
| 107 PrefService* prefs = Profile::FromBrowserContext( | 117 PrefService* prefs = Profile::FromBrowserContext( |
| 108 GetWebContents()->GetBrowserContext())->GetPrefs(); | 118 GetWebContents()->GetBrowserContext())->GetPrefs(); |
| 109 const char* policy_name = NULL; | 119 const char* policy_name = NULL; |
| 110 switch (device_type) { | 120 switch (device_type) { |
| 111 case DEVICE_TYPE_AUDIO: | 121 case DEVICE_TYPE_AUDIO: |
| 112 policy_name = prefs::kAudioCaptureAllowed; | 122 policy_name = prefs::kAudioCaptureAllowed; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 MediaCaptureDevicesDispatcher::GetInstance()->SetTestVideoCaptureDevices( | 212 MediaCaptureDevicesDispatcher::GetInstance()->SetTestVideoCaptureDevices( |
| 203 video_devices); | 213 video_devices); |
| 204 } | 214 } |
| 205 | 215 |
| 206 GURL example_url_; | 216 GURL example_url_; |
| 207 const std::string example_audio_id_; | 217 const std::string example_audio_id_; |
| 208 const std::string example_video_id_; | 218 const std::string example_video_id_; |
| 209 | 219 |
| 210 content::MediaStreamDevices media_stream_devices_; | 220 content::MediaStreamDevices media_stream_devices_; |
| 211 content::MediaStreamRequestResult media_stream_result_; | 221 content::MediaStreamRequestResult media_stream_result_; |
| 222 |
| 223 TestPermissionPromptDelegate prompt_delegate_; |
| 212 }; | 224 }; |
| 213 | 225 |
| 214 // Request and allow microphone access. | 226 // Request and allow microphone access. |
| 215 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndAllowMic) { | 227 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndAllowMic) { |
| 216 InitWithUrl(GURL("https://www.example.com")); | 228 InitWithUrl(GURL("https://www.example.com")); |
| 217 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_ALLOWED); | 229 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_ALLOWED); |
| 218 std::unique_ptr<MediaStreamDevicesController> controller( | 230 // Ensure the prompt is accepted if necessary such that tab specific content |
| 219 CreateMediaStreamDevicesController( | 231 // settings are updated. |
| 220 GetWebContents(), CreateRequest(example_audio_id(), std::string()), | 232 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 221 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 233 RequestPermissions( |
| 222 base::Unretained(this)))); | 234 GetWebContents(), CreateRequest(example_audio_id(), std::string()), |
| 223 NotifyTabSpecificContentSettings(controller.get()); | 235 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 236 base::Unretained(this))); |
| 224 | 237 |
| 225 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( | 238 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( |
| 226 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 239 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 227 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( | 240 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( |
| 228 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 241 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 229 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED, | 242 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED, |
| 230 GetContentSettings()->GetMicrophoneCameraState()); | 243 GetContentSettings()->GetMicrophoneCameraState()); |
| 231 EXPECT_EQ(example_audio_id(), | 244 EXPECT_EQ(example_audio_id(), |
| 232 GetContentSettings()->media_stream_requested_audio_device()); | 245 GetContentSettings()->media_stream_requested_audio_device()); |
| 233 EXPECT_EQ(example_audio_id(), | 246 EXPECT_EQ(example_audio_id(), |
| 234 GetContentSettings()->media_stream_selected_audio_device()); | 247 GetContentSettings()->media_stream_selected_audio_device()); |
| 235 EXPECT_EQ(std::string(), | 248 EXPECT_EQ(std::string(), |
| 236 GetContentSettings()->media_stream_requested_video_device()); | 249 GetContentSettings()->media_stream_requested_video_device()); |
| 237 EXPECT_EQ(std::string(), | 250 EXPECT_EQ(std::string(), |
| 238 GetContentSettings()->media_stream_selected_video_device()); | 251 GetContentSettings()->media_stream_selected_video_device()); |
| 239 } | 252 } |
| 240 | 253 |
| 241 // Request and allow camera access. | 254 // Request and allow camera access. |
| 242 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndAllowCam) { | 255 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndAllowCam) { |
| 243 InitWithUrl(GURL("https://www.example.com")); | 256 InitWithUrl(GURL("https://www.example.com")); |
| 244 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); | 257 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); |
| 245 std::unique_ptr<MediaStreamDevicesController> controller( | 258 // Ensure the prompt is accepted if necessary such that tab specific content |
| 246 CreateMediaStreamDevicesController( | 259 // settings are updated. |
| 247 GetWebContents(), CreateRequest(std::string(), example_video_id()), | 260 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 248 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 261 RequestPermissions( |
| 249 base::Unretained(this)))); | 262 GetWebContents(), CreateRequest(std::string(), example_video_id()), |
| 250 NotifyTabSpecificContentSettings(controller.get()); | 263 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 264 base::Unretained(this))); |
| 251 | 265 |
| 252 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( | 266 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( |
| 253 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 267 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 254 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( | 268 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( |
| 255 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 269 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 256 EXPECT_EQ(TabSpecificContentSettings::CAMERA_ACCESSED, | 270 EXPECT_EQ(TabSpecificContentSettings::CAMERA_ACCESSED, |
| 257 GetContentSettings()->GetMicrophoneCameraState()); | 271 GetContentSettings()->GetMicrophoneCameraState()); |
| 258 EXPECT_EQ(std::string(), | 272 EXPECT_EQ(std::string(), |
| 259 GetContentSettings()->media_stream_requested_audio_device()); | 273 GetContentSettings()->media_stream_requested_audio_device()); |
| 260 EXPECT_EQ(std::string(), | 274 EXPECT_EQ(std::string(), |
| 261 GetContentSettings()->media_stream_selected_audio_device()); | 275 GetContentSettings()->media_stream_selected_audio_device()); |
| 262 EXPECT_EQ(example_video_id(), | 276 EXPECT_EQ(example_video_id(), |
| 263 GetContentSettings()->media_stream_requested_video_device()); | 277 GetContentSettings()->media_stream_requested_video_device()); |
| 264 EXPECT_EQ(example_video_id(), | 278 EXPECT_EQ(example_video_id(), |
| 265 GetContentSettings()->media_stream_selected_video_device()); | 279 GetContentSettings()->media_stream_selected_video_device()); |
| 266 } | 280 } |
| 267 | 281 |
| 268 // Request and block microphone access. | 282 // Request and block microphone access. |
| 269 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndBlockMic) { | 283 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndBlockMic) { |
| 270 InitWithUrl(GURL("https://www.example.com")); | 284 InitWithUrl(GURL("https://www.example.com")); |
| 271 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_DENIED); | 285 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_DENIED); |
| 272 std::unique_ptr<MediaStreamDevicesController> controller( | 286 // Ensure the prompt is accepted if necessary such that tab specific content |
| 273 CreateMediaStreamDevicesController( | 287 // settings are updated. |
| 274 GetWebContents(), CreateRequest(example_audio_id(), std::string()), | 288 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 275 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 289 RequestPermissions( |
| 276 base::Unretained(this)))); | 290 GetWebContents(), CreateRequest(example_audio_id(), std::string()), |
| 277 NotifyTabSpecificContentSettings(controller.get()); | 291 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 292 base::Unretained(this))); |
| 278 | 293 |
| 279 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( | 294 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( |
| 280 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 295 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 281 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( | 296 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( |
| 282 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 297 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 283 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED | | 298 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED | |
| 284 TabSpecificContentSettings::MICROPHONE_BLOCKED, | 299 TabSpecificContentSettings::MICROPHONE_BLOCKED, |
| 285 GetContentSettings()->GetMicrophoneCameraState()); | 300 GetContentSettings()->GetMicrophoneCameraState()); |
| 286 EXPECT_EQ(example_audio_id(), | 301 EXPECT_EQ(example_audio_id(), |
| 287 GetContentSettings()->media_stream_requested_audio_device()); | 302 GetContentSettings()->media_stream_requested_audio_device()); |
| 288 EXPECT_EQ(example_audio_id(), | 303 EXPECT_EQ(example_audio_id(), |
| 289 GetContentSettings()->media_stream_selected_audio_device()); | 304 GetContentSettings()->media_stream_selected_audio_device()); |
| 290 EXPECT_EQ(std::string(), | 305 EXPECT_EQ(std::string(), |
| 291 GetContentSettings()->media_stream_requested_video_device()); | 306 GetContentSettings()->media_stream_requested_video_device()); |
| 292 EXPECT_EQ(std::string(), | 307 EXPECT_EQ(std::string(), |
| 293 GetContentSettings()->media_stream_selected_video_device()); | 308 GetContentSettings()->media_stream_selected_video_device()); |
| 294 } | 309 } |
| 295 | 310 |
| 296 // Request and block camera access. | 311 // Request and block camera access. |
| 297 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndBlockCam) { | 312 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, RequestAndBlockCam) { |
| 298 InitWithUrl(GURL("https://www.example.com")); | 313 InitWithUrl(GURL("https://www.example.com")); |
| 299 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_DENIED); | 314 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_DENIED); |
| 300 std::unique_ptr<MediaStreamDevicesController> controller( | 315 // Ensure the prompt is accepted if necessary such that tab specific content |
| 301 CreateMediaStreamDevicesController( | 316 // settings are updated. |
| 302 GetWebContents(), CreateRequest(std::string(), example_video_id()), | 317 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 303 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 318 RequestPermissions( |
| 304 base::Unretained(this)))); | 319 GetWebContents(), CreateRequest(std::string(), example_video_id()), |
| 305 NotifyTabSpecificContentSettings(controller.get()); | 320 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 321 base::Unretained(this))); |
| 306 | 322 |
| 307 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( | 323 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( |
| 308 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 324 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 309 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( | 325 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( |
| 310 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 326 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 311 EXPECT_EQ(TabSpecificContentSettings::CAMERA_ACCESSED | | 327 EXPECT_EQ(TabSpecificContentSettings::CAMERA_ACCESSED | |
| 312 TabSpecificContentSettings::CAMERA_BLOCKED, | 328 TabSpecificContentSettings::CAMERA_BLOCKED, |
| 313 GetContentSettings()->GetMicrophoneCameraState()); | 329 GetContentSettings()->GetMicrophoneCameraState()); |
| 314 EXPECT_EQ(std::string(), | 330 EXPECT_EQ(std::string(), |
| 315 GetContentSettings()->media_stream_requested_audio_device()); | 331 GetContentSettings()->media_stream_requested_audio_device()); |
| 316 EXPECT_EQ(std::string(), | 332 EXPECT_EQ(std::string(), |
| 317 GetContentSettings()->media_stream_selected_audio_device()); | 333 GetContentSettings()->media_stream_selected_audio_device()); |
| 318 EXPECT_EQ(example_video_id(), | 334 EXPECT_EQ(example_video_id(), |
| 319 GetContentSettings()->media_stream_requested_video_device()); | 335 GetContentSettings()->media_stream_requested_video_device()); |
| 320 EXPECT_EQ(example_video_id(), | 336 EXPECT_EQ(example_video_id(), |
| 321 GetContentSettings()->media_stream_selected_video_device()); | 337 GetContentSettings()->media_stream_selected_video_device()); |
| 322 } | 338 } |
| 323 | 339 |
| 324 // Request and allow microphone and camera access. | 340 // Request and allow microphone and camera access. |
| 325 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, | 341 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, |
| 326 RequestAndAllowMicCam) { | 342 RequestAndAllowMicCam) { |
| 327 InitWithUrl(GURL("https://www.example.com")); | 343 InitWithUrl(GURL("https://www.example.com")); |
| 328 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_ALLOWED); | 344 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_ALLOWED); |
| 329 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); | 345 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); |
| 330 std::unique_ptr<MediaStreamDevicesController> controller( | 346 // Ensure the prompt is accepted if necessary such that tab specific content |
| 331 CreateMediaStreamDevicesController( | 347 // settings are updated. |
| 332 GetWebContents(), | 348 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 333 CreateRequest(example_audio_id(), example_video_id()), | 349 RequestPermissions( |
| 334 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 350 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), |
| 335 base::Unretained(this)))); | 351 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 336 NotifyTabSpecificContentSettings(controller.get()); | 352 base::Unretained(this))); |
| 337 | 353 |
| 338 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( | 354 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( |
| 339 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 355 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 340 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( | 356 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( |
| 341 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 357 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 342 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( | 358 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( |
| 343 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 359 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 344 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( | 360 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( |
| 345 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 361 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 346 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED | | 362 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED | |
| 347 TabSpecificContentSettings::CAMERA_ACCESSED, | 363 TabSpecificContentSettings::CAMERA_ACCESSED, |
| 348 GetContentSettings()->GetMicrophoneCameraState()); | 364 GetContentSettings()->GetMicrophoneCameraState()); |
| 349 EXPECT_EQ(example_audio_id(), | 365 EXPECT_EQ(example_audio_id(), |
| 350 GetContentSettings()->media_stream_requested_audio_device()); | 366 GetContentSettings()->media_stream_requested_audio_device()); |
| 351 EXPECT_EQ(example_audio_id(), | 367 EXPECT_EQ(example_audio_id(), |
| 352 GetContentSettings()->media_stream_selected_audio_device()); | 368 GetContentSettings()->media_stream_selected_audio_device()); |
| 353 EXPECT_EQ(example_video_id(), | 369 EXPECT_EQ(example_video_id(), |
| 354 GetContentSettings()->media_stream_requested_video_device()); | 370 GetContentSettings()->media_stream_requested_video_device()); |
| 355 EXPECT_EQ(example_video_id(), | 371 EXPECT_EQ(example_video_id(), |
| 356 GetContentSettings()->media_stream_selected_video_device()); | 372 GetContentSettings()->media_stream_selected_video_device()); |
| 357 } | 373 } |
| 358 | 374 |
| 359 // Request and block microphone and camera access. | 375 // Request and block microphone and camera access. |
| 360 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, | 376 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, |
| 361 RequestAndBlockMicCam) { | 377 RequestAndBlockMicCam) { |
| 362 InitWithUrl(GURL("https://www.example.com")); | 378 InitWithUrl(GURL("https://www.example.com")); |
| 363 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_DENIED); | 379 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_DENIED); |
| 364 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_DENIED); | 380 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_DENIED); |
| 365 std::unique_ptr<MediaStreamDevicesController> controller( | 381 // Ensure the prompt is accepted if necessary such that tab specific content |
| 366 CreateMediaStreamDevicesController( | 382 // settings are updated. |
| 367 GetWebContents(), | 383 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 368 CreateRequest(example_audio_id(), example_video_id()), | 384 RequestPermissions( |
| 369 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 385 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), |
| 370 base::Unretained(this)))); | 386 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 371 NotifyTabSpecificContentSettings(controller.get()); | 387 base::Unretained(this))); |
| 372 | 388 |
| 373 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( | 389 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( |
| 374 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 390 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 375 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( | 391 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( |
| 376 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 392 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 377 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( | 393 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( |
| 378 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 394 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 379 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( | 395 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( |
| 380 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 396 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 381 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED | | 397 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED | |
| (...skipping 10 matching lines...) Expand all Loading... |
| 392 EXPECT_EQ(example_video_id(), | 408 EXPECT_EQ(example_video_id(), |
| 393 GetContentSettings()->media_stream_selected_video_device()); | 409 GetContentSettings()->media_stream_selected_video_device()); |
| 394 } | 410 } |
| 395 | 411 |
| 396 // Request microphone and camera access. Allow microphone, block camera. | 412 // Request microphone and camera access. Allow microphone, block camera. |
| 397 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, | 413 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, |
| 398 RequestMicCamBlockCam) { | 414 RequestMicCamBlockCam) { |
| 399 InitWithUrl(GURL("https://www.example.com")); | 415 InitWithUrl(GURL("https://www.example.com")); |
| 400 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_ALLOWED); | 416 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_ALLOWED); |
| 401 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_DENIED); | 417 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_DENIED); |
| 402 std::unique_ptr<MediaStreamDevicesController> controller( | 418 // Ensure the prompt is accepted if necessary such that tab specific content |
| 403 CreateMediaStreamDevicesController( | 419 // settings are updated. |
| 404 GetWebContents(), | 420 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 405 CreateRequest(example_audio_id(), example_video_id()), | 421 RequestPermissions( |
| 406 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 422 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), |
| 407 base::Unretained(this)))); | 423 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 408 NotifyTabSpecificContentSettings(controller.get()); | 424 base::Unretained(this))); |
| 409 | 425 |
| 410 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( | 426 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( |
| 411 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 427 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 412 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( | 428 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( |
| 413 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 429 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 414 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( | 430 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( |
| 415 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 431 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 416 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( | 432 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( |
| 417 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 433 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 418 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED | | 434 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED | |
| 419 TabSpecificContentSettings::CAMERA_ACCESSED | | 435 TabSpecificContentSettings::CAMERA_ACCESSED | |
| 420 TabSpecificContentSettings::CAMERA_BLOCKED, | 436 TabSpecificContentSettings::CAMERA_BLOCKED, |
| 421 GetContentSettings()->GetMicrophoneCameraState()); | 437 GetContentSettings()->GetMicrophoneCameraState()); |
| 422 EXPECT_EQ(example_audio_id(), | 438 EXPECT_EQ(example_audio_id(), |
| 423 GetContentSettings()->media_stream_requested_audio_device()); | 439 GetContentSettings()->media_stream_requested_audio_device()); |
| 424 EXPECT_EQ(example_audio_id(), | 440 EXPECT_EQ(example_audio_id(), |
| 425 GetContentSettings()->media_stream_selected_audio_device()); | 441 GetContentSettings()->media_stream_selected_audio_device()); |
| 426 EXPECT_EQ(example_video_id(), | 442 EXPECT_EQ(example_video_id(), |
| 427 GetContentSettings()->media_stream_requested_video_device()); | 443 GetContentSettings()->media_stream_requested_video_device()); |
| 428 EXPECT_EQ(example_video_id(), | 444 EXPECT_EQ(example_video_id(), |
| 429 GetContentSettings()->media_stream_selected_video_device()); | 445 GetContentSettings()->media_stream_selected_video_device()); |
| 430 } | 446 } |
| 431 | 447 |
| 432 // Request microphone and camera access. Block microphone, allow camera. | 448 // Request microphone and camera access. Block microphone, allow camera. |
| 433 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, | 449 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, |
| 434 RequestMicCamBlockMic) { | 450 RequestMicCamBlockMic) { |
| 435 InitWithUrl(GURL("https://www.example.com")); | 451 InitWithUrl(GURL("https://www.example.com")); |
| 436 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_DENIED); | 452 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_DENIED); |
| 437 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); | 453 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); |
| 438 std::unique_ptr<MediaStreamDevicesController> controller( | 454 // Ensure the prompt is accepted if necessary such that tab specific content |
| 439 CreateMediaStreamDevicesController( | 455 // settings are updated. |
| 440 GetWebContents(), | 456 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 441 CreateRequest(example_audio_id(), example_video_id()), | 457 RequestPermissions( |
| 442 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 458 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), |
| 443 base::Unretained(this)))); | 459 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 444 NotifyTabSpecificContentSettings(controller.get()); | 460 base::Unretained(this))); |
| 445 | 461 |
| 446 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( | 462 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( |
| 447 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 463 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 448 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( | 464 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( |
| 449 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 465 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 450 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( | 466 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( |
| 451 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 467 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 452 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( | 468 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( |
| 453 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 469 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 454 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED | | 470 EXPECT_EQ(TabSpecificContentSettings::MICROPHONE_ACCESSED | |
| (...skipping 10 matching lines...) Expand all Loading... |
| 465 GetContentSettings()->media_stream_selected_video_device()); | 481 GetContentSettings()->media_stream_selected_video_device()); |
| 466 } | 482 } |
| 467 | 483 |
| 468 // Request microphone access. Requesting camera should not change microphone | 484 // Request microphone access. Requesting camera should not change microphone |
| 469 // state. | 485 // state. |
| 470 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, | 486 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, |
| 471 RequestCamDoesNotChangeMic) { | 487 RequestCamDoesNotChangeMic) { |
| 472 InitWithUrl(GURL("https://www.example.com")); | 488 InitWithUrl(GURL("https://www.example.com")); |
| 473 // Request mic and deny. | 489 // Request mic and deny. |
| 474 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_DENIED); | 490 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_DENIED); |
| 475 std::unique_ptr<MediaStreamDevicesController> mic_controller( | 491 // Ensure the prompt is accepted if necessary such that tab specific content |
| 476 CreateMediaStreamDevicesController( | 492 // settings are updated. |
| 477 GetWebContents(), CreateRequest(example_audio_id(), std::string()), | 493 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 478 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 494 RequestPermissions( |
| 479 base::Unretained(this)))); | 495 GetWebContents(), CreateRequest(example_audio_id(), std::string()), |
| 480 NotifyTabSpecificContentSettings(mic_controller.get()); | 496 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 497 base::Unretained(this))); |
| 481 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( | 498 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( |
| 482 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 499 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 483 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( | 500 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( |
| 484 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 501 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 485 EXPECT_EQ(example_audio_id(), | 502 EXPECT_EQ(example_audio_id(), |
| 486 GetContentSettings()->media_stream_requested_audio_device()); | 503 GetContentSettings()->media_stream_requested_audio_device()); |
| 487 EXPECT_EQ(example_audio_id(), | 504 EXPECT_EQ(example_audio_id(), |
| 488 GetContentSettings()->media_stream_selected_audio_device()); | 505 GetContentSettings()->media_stream_selected_audio_device()); |
| 489 | 506 |
| 490 // Request cam and allow | 507 // Request cam and allow |
| 491 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); | 508 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); |
| 492 std::unique_ptr<MediaStreamDevicesController> cam_controller( | 509 RequestPermissions( |
| 493 CreateMediaStreamDevicesController( | 510 GetWebContents(), CreateRequest(std::string(), example_video_id()), |
| 494 GetWebContents(), CreateRequest(std::string(), example_video_id()), | 511 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 495 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 512 base::Unretained(this))); |
| 496 base::Unretained(this)))); | |
| 497 NotifyTabSpecificContentSettings(cam_controller.get()); | |
| 498 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( | 513 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( |
| 499 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 514 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 500 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( | 515 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( |
| 501 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 516 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 502 EXPECT_EQ(example_video_id(), | 517 EXPECT_EQ(example_video_id(), |
| 503 GetContentSettings()->media_stream_requested_video_device()); | 518 GetContentSettings()->media_stream_requested_video_device()); |
| 504 EXPECT_EQ(example_video_id(), | 519 EXPECT_EQ(example_video_id(), |
| 505 GetContentSettings()->media_stream_selected_video_device()); | 520 GetContentSettings()->media_stream_selected_video_device()); |
| 506 | 521 |
| 507 // Mic state should not have changed. | 522 // Mic state should not have changed. |
| 508 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( | 523 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( |
| 509 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 524 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 510 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( | 525 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( |
| 511 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 526 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 512 EXPECT_EQ(example_audio_id(), | 527 EXPECT_EQ(example_audio_id(), |
| 513 GetContentSettings()->media_stream_requested_audio_device()); | 528 GetContentSettings()->media_stream_requested_audio_device()); |
| 514 EXPECT_EQ(example_audio_id(), | 529 EXPECT_EQ(example_audio_id(), |
| 515 GetContentSettings()->media_stream_selected_audio_device()); | 530 GetContentSettings()->media_stream_selected_audio_device()); |
| 516 } | 531 } |
| 517 | 532 |
| 518 // Denying mic access after camera access should still show the camera as state. | 533 // Denying mic access after camera access should still show the camera as state. |
| 519 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, | 534 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, |
| 520 DenyMicDoesNotChangeCam) { | 535 DenyMicDoesNotChangeCam) { |
| 521 InitWithUrl(GURL("https://www.example.com")); | 536 InitWithUrl(GURL("https://www.example.com")); |
| 522 // Request cam and allow | 537 // Request cam and allow |
| 523 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); | 538 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); |
| 524 std::unique_ptr<MediaStreamDevicesController> cam_controller( | 539 // Ensure the prompt is accepted if necessary such that tab specific content |
| 525 CreateMediaStreamDevicesController( | 540 // settings are updated. |
| 526 GetWebContents(), CreateRequest(std::string(), example_video_id()), | 541 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 527 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 542 RequestPermissions( |
| 528 base::Unretained(this)))); | 543 GetWebContents(), CreateRequest(std::string(), example_video_id()), |
| 529 NotifyTabSpecificContentSettings(cam_controller.get()); | 544 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 545 base::Unretained(this))); |
| 530 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( | 546 EXPECT_TRUE(GetContentSettings()->IsContentAllowed( |
| 531 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 547 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 532 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( | 548 EXPECT_FALSE(GetContentSettings()->IsContentBlocked( |
| 533 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 549 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 534 EXPECT_EQ(example_video_id(), | 550 EXPECT_EQ(example_video_id(), |
| 535 GetContentSettings()->media_stream_requested_video_device()); | 551 GetContentSettings()->media_stream_requested_video_device()); |
| 536 EXPECT_EQ(example_video_id(), | 552 EXPECT_EQ(example_video_id(), |
| 537 GetContentSettings()->media_stream_selected_video_device()); | 553 GetContentSettings()->media_stream_selected_video_device()); |
| 538 EXPECT_EQ(TabSpecificContentSettings::CAMERA_ACCESSED, | 554 EXPECT_EQ(TabSpecificContentSettings::CAMERA_ACCESSED, |
| 539 GetContentSettings()->GetMicrophoneCameraState()); | 555 GetContentSettings()->GetMicrophoneCameraState()); |
| 540 | 556 |
| 541 // Simulate that an a video stream is now being captured. | 557 // Simulate that an a video stream is now being captured. |
| 542 content::MediaStreamDevice fake_video_device( | 558 content::MediaStreamDevice fake_video_device( |
| 543 content::MEDIA_DEVICE_VIDEO_CAPTURE, example_video_id(), | 559 content::MEDIA_DEVICE_VIDEO_CAPTURE, example_video_id(), |
| 544 example_video_id()); | 560 example_video_id()); |
| 545 content::MediaStreamDevices video_devices(1, fake_video_device); | 561 content::MediaStreamDevices video_devices(1, fake_video_device); |
| 546 MediaCaptureDevicesDispatcher* dispatcher = | 562 MediaCaptureDevicesDispatcher* dispatcher = |
| 547 MediaCaptureDevicesDispatcher::GetInstance(); | 563 MediaCaptureDevicesDispatcher::GetInstance(); |
| 548 dispatcher->SetTestVideoCaptureDevices(video_devices); | 564 dispatcher->SetTestVideoCaptureDevices(video_devices); |
| 549 std::unique_ptr<content::MediaStreamUI> video_stream_ui = | 565 std::unique_ptr<content::MediaStreamUI> video_stream_ui = |
| 550 dispatcher->GetMediaStreamCaptureIndicator()->RegisterMediaStream( | 566 dispatcher->GetMediaStreamCaptureIndicator()->RegisterMediaStream( |
| 551 GetWebContents(), video_devices); | 567 GetWebContents(), video_devices); |
| 552 video_stream_ui->OnStarted(base::Closure()); | 568 video_stream_ui->OnStarted(base::Closure()); |
| 553 | 569 |
| 554 // Request mic and deny. | 570 // Request mic and deny. |
| 555 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_DENIED); | 571 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_DENIED); |
| 556 std::unique_ptr<MediaStreamDevicesController> mic_controller( | 572 // Ensure the prompt is accepted if necessary such that tab specific content |
| 557 CreateMediaStreamDevicesController( | 573 // settings are updated. |
| 558 GetWebContents(), CreateRequest(example_audio_id(), std::string()), | 574 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 559 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 575 RequestPermissions( |
| 560 base::Unretained(this)))); | 576 GetWebContents(), CreateRequest(example_audio_id(), std::string()), |
| 561 NotifyTabSpecificContentSettings(mic_controller.get()); | 577 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 578 base::Unretained(this))); |
| 562 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( | 579 EXPECT_FALSE(GetContentSettings()->IsContentAllowed( |
| 563 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 580 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 564 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( | 581 EXPECT_TRUE(GetContentSettings()->IsContentBlocked( |
| 565 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); | 582 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 566 EXPECT_EQ(example_audio_id(), | 583 EXPECT_EQ(example_audio_id(), |
| 567 GetContentSettings()->media_stream_requested_audio_device()); | 584 GetContentSettings()->media_stream_requested_audio_device()); |
| 568 EXPECT_EQ(example_audio_id(), | 585 EXPECT_EQ(example_audio_id(), |
| 569 GetContentSettings()->media_stream_selected_audio_device()); | 586 GetContentSettings()->media_stream_selected_audio_device()); |
| 570 | 587 |
| 571 // Cam should still be included in the state. | 588 // Cam should still be included in the state. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 | 664 |
| 648 {CONTENT_SETTING_ASK, CONTENT_SETTING_ALLOW, false}, | 665 {CONTENT_SETTING_ASK, CONTENT_SETTING_ALLOW, false}, |
| 649 {CONTENT_SETTING_ASK, CONTENT_SETTING_ALLOW, true}, | 666 {CONTENT_SETTING_ASK, CONTENT_SETTING_ALLOW, true}, |
| 650 | 667 |
| 651 {CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK, false}, | 668 {CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK, false}, |
| 652 {CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK, true}, | 669 {CONTENT_SETTING_ASK, CONTENT_SETTING_BLOCK, true}, |
| 653 }; | 670 }; |
| 654 | 671 |
| 655 for (auto& test : tests) { | 672 for (auto& test : tests) { |
| 656 SetContentSettings(test.mic, test.cam); | 673 SetContentSettings(test.mic, test.cam); |
| 657 std::unique_ptr<MediaStreamDevicesController> controller( | |
| 658 CreateMediaStreamDevicesController( | |
| 659 GetWebContents(), | |
| 660 CreateRequest(example_audio_id(), example_video_id()), | |
| 661 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | |
| 662 base::Unretained(this)))); | |
| 663 | 674 |
| 664 // Check that the infobar is requesting the expected cam/mic values. | 675 prompt_delegate()->Reset(); |
| 665 ASSERT_EQ(test.ExpectMicInfobar(), IsAskingForAudio(controller.get())); | |
| 666 ASSERT_EQ(test.ExpectCamInfobar(), IsAskingForVideo(controller.get())); | |
| 667 | 676 |
| 668 // Accept or deny the infobar if it's showing. | 677 // Accept or deny the infobar if it's showing. |
| 669 if (test.ExpectMicInfobar() || test.ExpectCamInfobar()) { | 678 if (test.ExpectMicInfobar() || test.ExpectCamInfobar()) { |
| 670 if (test.accept_infobar) | 679 if (test.accept_infobar) { |
| 671 PermissionGranted(controller.get()); | 680 prompt_delegate()->set_response_type( |
| 672 else | 681 PermissionRequestManager::ACCEPT_ALL); |
| 673 PermissionDenied(controller.get()); | 682 } else { |
| 683 prompt_delegate()->set_response_type( |
| 684 PermissionRequestManager::DENY_ALL); |
| 685 } |
| 686 } else { |
| 687 prompt_delegate()->set_response_type(PermissionRequestManager::NONE); |
| 674 } | 688 } |
| 689 RequestPermissions( |
| 690 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), |
| 691 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 692 base::Unretained(this))); |
| 693 |
| 694 ASSERT_LE(prompt_delegate()->TotalRequestCount(), 2u); |
| 695 ASSERT_EQ( |
| 696 test.ExpectMicInfobar(), |
| 697 prompt_delegate()->WasRequested(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 698 ASSERT_EQ(test.ExpectCamInfobar(), |
| 699 prompt_delegate()->WasRequested( |
| 700 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 675 | 701 |
| 676 // Check the media stream result is expected and the devices returned are | 702 // Check the media stream result is expected and the devices returned are |
| 677 // expected; | 703 // expected; |
| 678 ASSERT_EQ(test.ExpectedMediaStreamResult(), media_stream_result()); | 704 ASSERT_EQ(test.ExpectedMediaStreamResult(), media_stream_result()); |
| 679 ASSERT_EQ(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE), | 705 ASSERT_EQ(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE), |
| 680 test.ExpectMicAllowed()); | 706 test.ExpectMicAllowed()); |
| 681 ASSERT_EQ(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE), | 707 ASSERT_EQ(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE), |
| 682 test.ExpectCamAllowed()); | 708 test.ExpectCamAllowed()); |
| 683 } | 709 } |
| 684 } | 710 } |
| 685 | 711 |
| 686 // Request and allow camera access on WebUI pages without prompting. | 712 // Request and allow camera access on WebUI pages without prompting. |
| 687 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, | 713 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, |
| 688 WebUIRequestAndAllowCam) { | 714 WebUIRequestAndAllowCam) { |
| 689 InitWithUrl(GURL("chrome://test-page")); | 715 InitWithUrl(GURL("chrome://test-page")); |
| 690 std::unique_ptr<MediaStreamDevicesController> controller( | 716 RequestPermissions( |
| 691 CreateMediaStreamDevicesController( | 717 GetWebContents(), CreateRequest(std::string(), example_video_id()), |
| 692 GetWebContents(), CreateRequest(std::string(), example_video_id()), | 718 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 693 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 719 base::Unretained(this))); |
| 694 base::Unretained(this)))); | |
| 695 | 720 |
| 696 ASSERT_FALSE(IsAskingForAudio(controller.get())); | 721 ASSERT_EQ(0u, prompt_delegate()->TotalRequestCount()); |
| 697 ASSERT_FALSE(IsAskingForVideo(controller.get())); | |
| 698 | 722 |
| 699 ASSERT_EQ(content::MEDIA_DEVICE_OK, media_stream_result()); | 723 ASSERT_EQ(content::MEDIA_DEVICE_OK, media_stream_result()); |
| 700 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); | 724 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); |
| 701 ASSERT_TRUE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); | 725 ASSERT_TRUE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); |
| 702 } | 726 } |
| 703 | 727 |
| 704 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, | 728 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, |
| 705 ExtensionRequestMicCam) { | 729 ExtensionRequestMicCam) { |
| 706 InitWithUrl(GURL("chrome-extension://test-page")); | 730 InitWithUrl(GURL("chrome-extension://test-page")); |
| 707 // Test that a prompt is required. | 731 // Test that a prompt is required. |
| 708 std::unique_ptr<MediaStreamDevicesController> controller( | 732 prompt_delegate()->set_response_type(PermissionRequestManager::ACCEPT_ALL); |
| 709 CreateMediaStreamDevicesController( | 733 RequestPermissions( |
| 710 GetWebContents(), | 734 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), |
| 711 CreateRequest(example_audio_id(), example_video_id()), | 735 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 712 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 736 base::Unretained(this))); |
| 713 base::Unretained(this)))); | 737 ASSERT_EQ(2u, prompt_delegate()->TotalRequestCount()); |
| 714 ASSERT_TRUE(IsAskingForAudio(controller.get())); | 738 ASSERT_TRUE(prompt_delegate()->WasRequested( |
| 715 ASSERT_TRUE(IsAskingForVideo(controller.get())); | 739 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 740 ASSERT_TRUE( |
| 741 prompt_delegate()->WasRequested(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); |
| 716 | 742 |
| 717 // Accept the prompt. | 743 // Accept the prompt. |
| 718 PermissionGranted(controller.get()); | |
| 719 ASSERT_EQ(content::MEDIA_DEVICE_OK, media_stream_result()); | 744 ASSERT_EQ(content::MEDIA_DEVICE_OK, media_stream_result()); |
| 720 ASSERT_TRUE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); | 745 ASSERT_TRUE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); |
| 721 ASSERT_TRUE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); | 746 ASSERT_TRUE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); |
| 722 | 747 |
| 723 // Check that re-requesting allows without prompting. | 748 // Check that re-requesting allows without prompting. |
| 724 std::unique_ptr<MediaStreamDevicesController> controller2( | 749 prompt_delegate()->Reset(); |
| 725 CreateMediaStreamDevicesController( | 750 RequestPermissions( |
| 726 GetWebContents(), | 751 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), |
| 727 CreateRequest(example_audio_id(), example_video_id()), | 752 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 728 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 753 base::Unretained(this))); |
| 729 base::Unretained(this)))); | 754 ASSERT_EQ(0u, prompt_delegate()->TotalRequestCount()); |
| 730 ASSERT_FALSE(IsAskingForAudio(controller2.get())); | |
| 731 ASSERT_FALSE(IsAskingForVideo(controller2.get())); | |
| 732 | 755 |
| 733 ASSERT_EQ(content::MEDIA_DEVICE_OK, media_stream_result()); | 756 ASSERT_EQ(content::MEDIA_DEVICE_OK, media_stream_result()); |
| 734 ASSERT_TRUE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); | 757 ASSERT_TRUE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); |
| 735 ASSERT_TRUE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); | 758 ASSERT_TRUE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); |
| 736 } | 759 } |
| 737 | 760 |
| 738 // For Pepper request from insecure origin, even if it's ALLOW, it won't be | 761 // For Pepper request from insecure origin, even if it's ALLOW, it won't be |
| 739 // changed to ASK. | 762 // changed to ASK. |
| 740 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, | 763 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, |
| 741 PepperRequestInsecure) { | 764 PepperRequestInsecure) { |
| 742 InitWithUrl(GURL("http://www.example.com")); | 765 InitWithUrl(GURL("http://www.example.com")); |
| 743 SetContentSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ALLOW); | 766 SetContentSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_ALLOW); |
| 744 | 767 |
| 745 std::unique_ptr<MediaStreamDevicesController> controller( | 768 RequestPermissions( |
| 746 CreateMediaStreamDevicesController( | 769 GetWebContents(), |
| 747 GetWebContents(), | 770 CreateRequestWithType(example_audio_id(), std::string(), |
| 748 CreateRequestWithType(example_audio_id(), std::string(), | 771 content::MEDIA_OPEN_DEVICE_PEPPER_ONLY), |
| 749 content::MEDIA_OPEN_DEVICE_PEPPER_ONLY), | 772 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 750 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 773 base::Unretained(this))); |
| 751 base::Unretained(this)))); | 774 ASSERT_EQ(0u, prompt_delegate()->TotalRequestCount()); |
| 752 ASSERT_FALSE(IsAskingForAudio(controller.get())); | |
| 753 ASSERT_FALSE(IsAskingForVideo(controller.get())); | |
| 754 } | 775 } |
| 755 | 776 |
| 756 // Request and block microphone and camera access with kill switch. | 777 // Request and block microphone and camera access with kill switch. |
| 757 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, | 778 IN_PROC_BROWSER_TEST_F(MediaStreamDevicesControllerTest, |
| 758 RequestAndKillSwitchMicCam) { | 779 RequestAndKillSwitchMicCam) { |
| 759 std::map<std::string, std::string> params; | 780 std::map<std::string, std::string> params; |
| 760 params[PermissionUtil::GetPermissionString( | 781 params[PermissionUtil::GetPermissionString( |
| 761 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)] = | 782 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)] = |
| 762 PermissionContextBase::kPermissionsKillSwitchBlockedValue; | 783 PermissionContextBase::kPermissionsKillSwitchBlockedValue; |
| 763 params[PermissionUtil::GetPermissionString( | 784 params[PermissionUtil::GetPermissionString( |
| 764 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)] = | 785 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)] = |
| 765 PermissionContextBase::kPermissionsKillSwitchBlockedValue; | 786 PermissionContextBase::kPermissionsKillSwitchBlockedValue; |
| 766 variations::AssociateVariationParams( | 787 variations::AssociateVariationParams( |
| 767 PermissionContextBase::kPermissionsKillSwitchFieldStudy, | 788 PermissionContextBase::kPermissionsKillSwitchFieldStudy, |
| 768 "TestGroup", params); | 789 "TestGroup", params); |
| 769 base::FieldTrialList::CreateFieldTrial( | 790 base::FieldTrialList::CreateFieldTrial( |
| 770 PermissionContextBase::kPermissionsKillSwitchFieldStudy, | 791 PermissionContextBase::kPermissionsKillSwitchFieldStudy, |
| 771 "TestGroup"); | 792 "TestGroup"); |
| 772 InitWithUrl(GURL("https://www.example.com")); | 793 InitWithUrl(GURL("https://www.example.com")); |
| 773 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_ALLOWED); | 794 SetDevicePolicy(DEVICE_TYPE_AUDIO, ACCESS_ALLOWED); |
| 774 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); | 795 SetDevicePolicy(DEVICE_TYPE_VIDEO, ACCESS_ALLOWED); |
| 775 std::unique_ptr<MediaStreamDevicesController> controller( | 796 RequestPermissions( |
| 776 CreateMediaStreamDevicesController( | 797 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), |
| 777 GetWebContents(), | 798 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 778 CreateRequest(example_audio_id(), example_video_id()), | 799 base::Unretained(this))); |
| 779 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | |
| 780 base::Unretained(this)))); | |
| 781 | 800 |
| 782 EXPECT_FALSE(IsAskingForAudio(controller.get())); | 801 ASSERT_EQ(0u, prompt_delegate()->TotalRequestCount()); |
| 783 EXPECT_FALSE(IsAskingForVideo(controller.get())); | |
| 784 | 802 |
| 785 ASSERT_EQ(content::MEDIA_DEVICE_KILL_SWITCH_ON, media_stream_result()); | 803 ASSERT_EQ(content::MEDIA_DEVICE_KILL_SWITCH_ON, media_stream_result()); |
| 786 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); | 804 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); |
| 787 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); | 805 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); |
| 788 } | 806 } |
| OLD | NEW |