| 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/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/stl_util.h" |
| 11 #include "base/test/scoped_feature_list.h" | 12 #include "base/test/scoped_feature_list.h" |
| 12 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 14 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 15 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 15 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" | 16 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" |
| 16 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h" | 17 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h" |
| 17 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" | 18 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" |
| 18 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" | 19 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" |
| 19 #include "chrome/browser/permissions/permission_context_base.h" | 20 #include "chrome/browser/permissions/permission_context_base.h" |
| 20 #include "chrome/browser/permissions/permission_request.h" | 21 #include "chrome/browser/permissions/permission_request.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 69 } |
| 69 | 70 |
| 70 void set_response_type( | 71 void set_response_type( |
| 71 PermissionRequestManager::AutoResponseType response_type) { | 72 PermissionRequestManager::AutoResponseType response_type) { |
| 72 response_type_ = response_type; | 73 response_type_ = response_type; |
| 73 } | 74 } |
| 74 | 75 |
| 75 size_t TotalRequestCount() { return last_requests_.size(); } | 76 size_t TotalRequestCount() { return last_requests_.size(); } |
| 76 | 77 |
| 77 bool WasRequested(ContentSettingsType type) { | 78 bool WasRequested(ContentSettingsType type) { |
| 78 return std::find(last_requests_.begin(), last_requests_.end(), type) != | 79 return base::ContainsValue(last_requests_, type); |
| 79 last_requests_.end(); | |
| 80 } | 80 } |
| 81 | 81 |
| 82 void Reset() { last_requests_.clear(); } | 82 void Reset() { last_requests_.clear(); } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 PermissionRequestManager::AutoResponseType response_type_ = | 85 PermissionRequestManager::AutoResponseType response_type_ = |
| 86 PermissionRequestManager::NONE; | 86 PermissionRequestManager::NONE; |
| 87 std::vector<ContentSettingsType> last_requests_; | 87 std::vector<ContentSettingsType> last_requests_; |
| 88 }; | 88 }; |
| 89 | 89 |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 ASSERT_EQ(content::MEDIA_DEVICE_KILL_SWITCH_ON, media_stream_result()); | 923 ASSERT_EQ(content::MEDIA_DEVICE_KILL_SWITCH_ON, media_stream_result()); |
| 924 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); | 924 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_AUDIO_CAPTURE)); |
| 925 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); | 925 ASSERT_FALSE(CheckDevicesListContains(content::MEDIA_DEVICE_VIDEO_CAPTURE)); |
| 926 } | 926 } |
| 927 | 927 |
| 928 INSTANTIATE_TEST_CASE_P( | 928 INSTANTIATE_TEST_CASE_P( |
| 929 MediaStreamDevicesControllerTestInstance, | 929 MediaStreamDevicesControllerTestInstance, |
| 930 MediaStreamDevicesControllerTest, | 930 MediaStreamDevicesControllerTest, |
| 931 ::testing::Values(TestType::DEFAULT, | 931 ::testing::Values(TestType::DEFAULT, |
| 932 TestType::TEST_WITH_GROUPED_MEDIA_REQUESTS)); | 932 TestType::TEST_WITH_GROUPED_MEDIA_REQUESTS)); |
| OLD | NEW |