| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "content/public/test/mock_render_process_host.h" | 28 #include "content/public/test/mock_render_process_host.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 30 | 30 |
| 31 class MediaStreamDevicesControllerTest : public WebRtcTestBase { | 31 class MediaStreamDevicesControllerTest : public WebRtcTestBase { |
| 32 public: | 32 public: |
| 33 // TODO(raymes): When crbug.com/606138 is finished and the | 33 // TODO(raymes): When crbug.com/606138 is finished and the |
| 34 // PermissionRequestManager is used to show all prompts on Android/Desktop | 34 // PermissionRequestManager is used to show all prompts on Android/Desktop |
| 35 // we should remove PermissionPromptDelegate and just use | 35 // we should remove PermissionPromptDelegate and just use |
| 36 // MockPermissionPromptFactory instead. The APIs are the same. | 36 // MockPermissionPromptFactory instead. The APIs are the same. |
| 37 class TestPermissionPromptDelegate | 37 class TestPermissionPromptDelegate |
| 38 : public MediaStreamDevicesController::PermissionPromptDelegate { | 38 : public internal::PermissionPromptDelegate { |
| 39 public: | 39 public: |
| 40 void ShowPrompt( | 40 void ShowPrompt( |
| 41 bool user_gesture, | 41 bool user_gesture, |
| 42 content::WebContents* web_contents, | 42 content::WebContents* web_contents, |
| 43 std::unique_ptr<MediaStreamDevicesController> controller) override { | 43 std::unique_ptr<MediaStreamDevicesController> controller) override { |
| 44 if (controller->IsAskingForAudio()) | 44 if (controller->IsAskingForAudio()) |
| 45 last_requests_.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); | 45 last_requests_.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 46 if (controller->IsAskingForVideo()) | 46 if (controller->IsAskingForVideo()) |
| 47 last_requests_.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 47 last_requests_.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 48 | 48 |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), | 797 GetWebContents(), CreateRequest(example_audio_id(), example_video_id()), |
| 798 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, | 798 base::Bind(&MediaStreamDevicesControllerTest::OnMediaStreamResponse, |
| 799 base::Unretained(this))); | 799 base::Unretained(this))); |
| 800 | 800 |
| 801 ASSERT_EQ(0u, prompt_delegate()->TotalRequestCount()); | 801 ASSERT_EQ(0u, prompt_delegate()->TotalRequestCount()); |
| 802 | 802 |
| 803 ASSERT_EQ(content::MEDIA_DEVICE_KILL_SWITCH_ON, media_stream_result()); | 803 ASSERT_EQ(content::MEDIA_DEVICE_KILL_SWITCH_ON, media_stream_result()); |
| 804 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); | 804 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); |
| 805 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); | 805 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); |
| 806 } | 806 } |
| OLD | NEW |