OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/media/media_stream_device_permission_context.h" | 5 #include "chrome/browser/media/media_stream_device_permission_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "chrome/browser/permissions/permission_queue_controller.h" | 10 #include "chrome/browser/permissions/permission_infobar_manager.h" |
11 #include "chrome/browser/permissions/permission_request_id.h" | 11 #include "chrome/browser/permissions/permission_request_id.h" |
12 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 12 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
13 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 13 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
15 #include "components/content_settings/core/browser/host_content_settings_map.h" | 15 #include "components/content_settings/core/browser/host_content_settings_map.h" |
16 #include "components/content_settings/core/common/content_settings.h" | 16 #include "components/content_settings/core/common/content_settings.h" |
17 #include "components/content_settings/core/common/content_settings_types.h" | 17 #include "components/content_settings/core/common/content_settings_types.h" |
18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
19 #include "content/public/test/mock_render_process_host.h" | 19 #include "content/public/test/mock_render_process_host.h" |
20 #include "content/public/test/web_contents_tester.h" | 20 #include "content/public/test/web_contents_tester.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 EXPECT_EQ(CONTENT_SETTING_ASK, | 85 EXPECT_EQ(CONTENT_SETTING_ASK, |
86 permission_context.GetPermissionStatus(secure_url, secure_url)); | 86 permission_context.GetPermissionStatus(secure_url, secure_url)); |
87 } | 87 } |
88 | 88 |
89 private: | 89 private: |
90 // ChromeRenderViewHostTestHarness: | 90 // ChromeRenderViewHostTestHarness: |
91 void SetUp() override { | 91 void SetUp() override { |
92 ChromeRenderViewHostTestHarness::SetUp(); | 92 ChromeRenderViewHostTestHarness::SetUp(); |
93 InfoBarService::CreateForWebContents(web_contents()); | 93 InfoBarService::CreateForWebContents(web_contents()); |
94 PermissionBubbleManager::CreateForWebContents(web_contents()); | 94 PermissionBubbleManager::CreateForWebContents(web_contents()); |
| 95 PermissionInfoBarManager::CreateForWebContents(web_contents()); |
95 } | 96 } |
96 | 97 |
97 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicePermissionContextTests); | 98 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicePermissionContextTests); |
98 }; | 99 }; |
99 | 100 |
100 // MEDIASTREAM_MIC permission status should be ask for insecure origin to | 101 // MEDIASTREAM_MIC permission status should be ask for insecure origin to |
101 // accommodate the usage case of Flash. | 102 // accommodate the usage case of Flash. |
102 TEST_F(MediaStreamDevicePermissionContextTests, TestMicInsecureQueryingUrl) { | 103 TEST_F(MediaStreamDevicePermissionContextTests, TestMicInsecureQueryingUrl) { |
103 TestInsecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); | 104 TestInsecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
104 } | 105 } |
105 | 106 |
106 // MEDIASTREAM_CAMERA permission status should be ask for insecure origin to | 107 // MEDIASTREAM_CAMERA permission status should be ask for insecure origin to |
107 // accommodate the usage case of Flash. | 108 // accommodate the usage case of Flash. |
108 TEST_F(MediaStreamDevicePermissionContextTests, TestCameraInsecureQueryingUrl) { | 109 TEST_F(MediaStreamDevicePermissionContextTests, TestCameraInsecureQueryingUrl) { |
109 TestInsecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 110 TestInsecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
110 } | 111 } |
111 | 112 |
112 // MEDIASTREAM_MIC permission status should be ask for Secure origin. | 113 // MEDIASTREAM_MIC permission status should be ask for Secure origin. |
113 TEST_F(MediaStreamDevicePermissionContextTests, TestMicSecureQueryingUrl) { | 114 TEST_F(MediaStreamDevicePermissionContextTests, TestMicSecureQueryingUrl) { |
114 TestSecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); | 115 TestSecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
115 } | 116 } |
116 | 117 |
117 // MEDIASTREAM_CAMERA permission status should be ask for Secure origin. | 118 // MEDIASTREAM_CAMERA permission status should be ask for Secure origin. |
118 TEST_F(MediaStreamDevicePermissionContextTests, TestCameraSecureQueryingUrl) { | 119 TEST_F(MediaStreamDevicePermissionContextTests, TestCameraSecureQueryingUrl) { |
119 TestSecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 120 TestSecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
120 } | 121 } |
OLD | NEW |