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

Side by Side Diff: chrome/browser/media/media_stream_device_permission_context_unittest.cc

Issue 1686903002: [Abandoned] Rename PermissionBubbleManager to PermissionRequestManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests compile Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/macros.h" 8 #include "base/macros.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
11 #include "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/permissions/permission_request_id.h" 12 #include "chrome/browser/permissions/permission_request_id.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/permission_type.h" 18 #include "content/public/browser/permission_type.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "content/public/test/mock_render_process_host.h" 20 #include "content/public/test/mock_render_process_host.h"
21 #include "content/public/test/web_contents_tester.h" 21 #include "content/public/test/web_contents_tester.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 #if !defined(OS_ANDROID) 24 #if !defined(OS_ANDROID)
25 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 25 #include "chrome/browser/permissions/permission_request_manager.h"
26 #endif 26 #endif
27 27
28 namespace { 28 namespace {
29 class TestPermissionContext : public MediaStreamDevicePermissionContext { 29 class TestPermissionContext : public MediaStreamDevicePermissionContext {
30 public: 30 public:
31 TestPermissionContext(Profile* profile, 31 TestPermissionContext(Profile* profile,
32 const ContentSettingsType permission_type) 32 const ContentSettingsType permission_type)
33 : MediaStreamDevicePermissionContext( 33 : MediaStreamDevicePermissionContext(
34 profile, 34 profile,
35 permission_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA 35 permission_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 permission_context.GetPermissionStatus(secure_url, secure_url)); 96 permission_context.GetPermissionStatus(secure_url, secure_url));
97 } 97 }
98 98
99 private: 99 private:
100 // ChromeRenderViewHostTestHarness: 100 // ChromeRenderViewHostTestHarness:
101 void SetUp() override { 101 void SetUp() override {
102 ChromeRenderViewHostTestHarness::SetUp(); 102 ChromeRenderViewHostTestHarness::SetUp();
103 #if defined(OS_ANDROID) 103 #if defined(OS_ANDROID)
104 InfoBarService::CreateForWebContents(web_contents()); 104 InfoBarService::CreateForWebContents(web_contents());
105 #else 105 #else
106 PermissionBubbleManager::CreateForWebContents(web_contents()); 106 PermissionRequestManager::CreateForWebContents(web_contents());
107 #endif 107 #endif
108 } 108 }
109 109
110 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicePermissionContextTests); 110 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicePermissionContextTests);
111 }; 111 };
112 112
113 // MEDIASTREAM_MIC permission status should be ask for insecure origin to 113 // MEDIASTREAM_MIC permission status should be ask for insecure origin to
114 // accommodate the usage case of Flash. 114 // accommodate the usage case of Flash.
115 TEST_F(MediaStreamDevicePermissionContextTests, TestMicInsecureQueryingUrl) { 115 TEST_F(MediaStreamDevicePermissionContextTests, TestMicInsecureQueryingUrl) {
116 TestInsecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); 116 TestInsecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
117 } 117 }
118 118
119 // MEDIASTREAM_CAMERA permission status should be ask for insecure origin to 119 // MEDIASTREAM_CAMERA permission status should be ask for insecure origin to
120 // accommodate the usage case of Flash. 120 // accommodate the usage case of Flash.
121 TEST_F(MediaStreamDevicePermissionContextTests, TestCameraInsecureQueryingUrl) { 121 TEST_F(MediaStreamDevicePermissionContextTests, TestCameraInsecureQueryingUrl) {
122 TestInsecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); 122 TestInsecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
123 } 123 }
124 124
125 // MEDIASTREAM_MIC permission status should be ask for Secure origin. 125 // MEDIASTREAM_MIC permission status should be ask for Secure origin.
126 TEST_F(MediaStreamDevicePermissionContextTests, TestMicSecureQueryingUrl) { 126 TEST_F(MediaStreamDevicePermissionContextTests, TestMicSecureQueryingUrl) {
127 TestSecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); 127 TestSecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
128 } 128 }
129 129
130 // MEDIASTREAM_CAMERA permission status should be ask for Secure origin. 130 // MEDIASTREAM_CAMERA permission status should be ask for Secure origin.
131 TEST_F(MediaStreamDevicePermissionContextTests, TestCameraSecureQueryingUrl) { 131 TEST_F(MediaStreamDevicePermissionContextTests, TestCameraSecureQueryingUrl) {
132 TestSecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); 132 TestSecureQueryingUrl(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
133 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698