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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 183743021: Implement MediaCaptureDevices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 #include "components/policy/core/common/policy_pref_names.h" 89 #include "components/policy/core/common/policy_pref_names.h"
90 #include "components/policy/core/common/policy_service.h" 90 #include "components/policy/core/common/policy_service.h"
91 #include "components/policy/core/common/policy_service_impl.h" 91 #include "components/policy/core/common/policy_service_impl.h"
92 #include "content/public/browser/browser_child_process_host_iterator.h" 92 #include "content/public/browser/browser_child_process_host_iterator.h"
93 #include "content/public/browser/browser_context.h" 93 #include "content/public/browser/browser_context.h"
94 #include "content/public/browser/browser_thread.h" 94 #include "content/public/browser/browser_thread.h"
95 #include "content/public/browser/child_process_data.h" 95 #include "content/public/browser/child_process_data.h"
96 #include "content/public/browser/download_item.h" 96 #include "content/public/browser/download_item.h"
97 #include "content/public/browser/download_manager.h" 97 #include "content/public/browser/download_manager.h"
98 #include "content/public/browser/gpu_data_manager.h" 98 #include "content/public/browser/gpu_data_manager.h"
99 #include "content/public/browser/media_capture_devices.h"
99 #include "content/public/browser/notification_details.h" 100 #include "content/public/browser/notification_details.h"
100 #include "content/public/browser/notification_observer.h" 101 #include "content/public/browser/notification_observer.h"
101 #include "content/public/browser/notification_registrar.h" 102 #include "content/public/browser/notification_registrar.h"
102 #include "content/public/browser/notification_service.h" 103 #include "content/public/browser/notification_service.h"
103 #include "content/public/browser/notification_source.h" 104 #include "content/public/browser/notification_source.h"
104 #include "content/public/browser/notification_types.h" 105 #include "content/public/browser/notification_types.h"
105 #include "content/public/browser/plugin_service.h" 106 #include "content/public/browser/plugin_service.h"
106 #include "content/public/browser/render_process_host.h" 107 #include "content/public/browser/render_process_host.h"
107 #include "content/public/browser/render_view_host.h" 108 #include "content/public/browser/render_view_host.h"
108 #include "content/public/browser/web_contents.h" 109 #include "content/public/browser/web_contents.h"
(...skipping 2660 matching lines...) Expand 10 before | Expand all | Expand 10 after
2769 content::MediaStreamDevice fake_audio_device( 2770 content::MediaStreamDevice fake_audio_device(
2770 content::MEDIA_DEVICE_AUDIO_CAPTURE, "fake_dev", "Fake Audio Device"); 2771 content::MEDIA_DEVICE_AUDIO_CAPTURE, "fake_dev", "Fake Audio Device");
2771 audio_devices.push_back(fake_audio_device); 2772 audio_devices.push_back(fake_audio_device);
2772 2773
2773 PolicyMap policies; 2774 PolicyMap policies;
2774 ConfigurePolicyMap(&policies, key::kAudioCaptureAllowed, NULL, NULL); 2775 ConfigurePolicyMap(&policies, key::kAudioCaptureAllowed, NULL, NULL);
2775 UpdateProviderPolicy(policies); 2776 UpdateProviderPolicy(policies);
2776 2777
2777 content::BrowserThread::PostTaskAndReply( 2778 content::BrowserThread::PostTaskAndReply(
2778 content::BrowserThread::IO, FROM_HERE, 2779 content::BrowserThread::IO, FROM_HERE,
2779 base::Bind(&MediaCaptureDevicesDispatcher::OnAudioCaptureDevicesChanged, 2780 base::Bind(&MediaCaptureDevicesDispatcher::SetTestAudioCaptureDevices,
2780 base::Unretained(MediaCaptureDevicesDispatcher::GetInstance()), 2781 base::Unretained(MediaCaptureDevicesDispatcher::GetInstance()),
2781 audio_devices), 2782 audio_devices),
2782 base::Bind(&MediaStreamDevicesControllerBrowserTest::FinishAudioTest, 2783 base::Bind(&MediaStreamDevicesControllerBrowserTest::FinishAudioTest,
2783 this)); 2784 this));
2784 2785
2785 base::MessageLoop::current()->Run(); 2786 base::MessageLoop::current()->Run();
2786 } 2787 }
2787 2788
2788 IN_PROC_BROWSER_TEST_P(MediaStreamDevicesControllerBrowserTest, 2789 IN_PROC_BROWSER_TEST_P(MediaStreamDevicesControllerBrowserTest,
2789 AudioCaptureAllowedUrls) { 2790 AudioCaptureAllowedUrls) {
(...skipping 12 matching lines...) Expand all
2802 2803
2803 for (size_t i = 0; i < arraysize(allow_pattern); ++i) { 2804 for (size_t i = 0; i < arraysize(allow_pattern); ++i) {
2804 PolicyMap policies; 2805 PolicyMap policies;
2805 ConfigurePolicyMap(&policies, key::kAudioCaptureAllowed, 2806 ConfigurePolicyMap(&policies, key::kAudioCaptureAllowed,
2806 key::kAudioCaptureAllowedUrls, allow_pattern[i]); 2807 key::kAudioCaptureAllowedUrls, allow_pattern[i]);
2807 UpdateProviderPolicy(policies); 2808 UpdateProviderPolicy(policies);
2808 2809
2809 content::BrowserThread::PostTaskAndReply( 2810 content::BrowserThread::PostTaskAndReply(
2810 content::BrowserThread::IO, FROM_HERE, 2811 content::BrowserThread::IO, FROM_HERE,
2811 base::Bind( 2812 base::Bind(
2812 &MediaCaptureDevicesDispatcher::OnAudioCaptureDevicesChanged, 2813 &MediaCaptureDevicesDispatcher::SetTestAudioCaptureDevices,
2813 base::Unretained(MediaCaptureDevicesDispatcher::GetInstance()), 2814 base::Unretained(MediaCaptureDevicesDispatcher::GetInstance()),
2814 audio_devices), 2815 audio_devices),
2815 base::Bind( 2816 base::Bind(
2816 &MediaStreamDevicesControllerBrowserTest::FinishAudioTest, 2817 &MediaStreamDevicesControllerBrowserTest::FinishAudioTest,
2817 this)); 2818 this));
2818 2819
2819 base::MessageLoop::current()->Run(); 2820 base::MessageLoop::current()->Run();
2820 } 2821 }
2821 } 2822 }
2822 2823
2823 IN_PROC_BROWSER_TEST_P(MediaStreamDevicesControllerBrowserTest, 2824 IN_PROC_BROWSER_TEST_P(MediaStreamDevicesControllerBrowserTest,
2824 VideoCaptureAllowed) { 2825 VideoCaptureAllowed) {
2825 content::MediaStreamDevices video_devices; 2826 content::MediaStreamDevices video_devices;
2826 content::MediaStreamDevice fake_video_device( 2827 content::MediaStreamDevice fake_video_device(
2827 content::MEDIA_DEVICE_VIDEO_CAPTURE, "fake_dev", "Fake Video Device"); 2828 content::MEDIA_DEVICE_VIDEO_CAPTURE, "fake_dev", "Fake Video Device");
2828 video_devices.push_back(fake_video_device); 2829 video_devices.push_back(fake_video_device);
2829 2830
2830 PolicyMap policies; 2831 PolicyMap policies;
2831 ConfigurePolicyMap(&policies, key::kVideoCaptureAllowed, NULL, NULL); 2832 ConfigurePolicyMap(&policies, key::kVideoCaptureAllowed, NULL, NULL);
2832 UpdateProviderPolicy(policies); 2833 UpdateProviderPolicy(policies);
2833 2834
2834 content::BrowserThread::PostTaskAndReply( 2835 content::BrowserThread::PostTaskAndReply(
2835 content::BrowserThread::IO, FROM_HERE, 2836 content::BrowserThread::IO, FROM_HERE,
2836 base::Bind(&MediaCaptureDevicesDispatcher::OnVideoCaptureDevicesChanged, 2837 base::Bind(&MediaCaptureDevicesDispatcher::SetTestVideoCaptureDevices,
2837 base::Unretained(MediaCaptureDevicesDispatcher::GetInstance()), 2838 base::Unretained(MediaCaptureDevicesDispatcher::GetInstance()),
2838 video_devices), 2839 video_devices),
2839 base::Bind(&MediaStreamDevicesControllerBrowserTest::FinishVideoTest, 2840 base::Bind(&MediaStreamDevicesControllerBrowserTest::FinishVideoTest,
2840 this)); 2841 this));
2841 2842
2842 base::MessageLoop::current()->Run(); 2843 base::MessageLoop::current()->Run();
2843 } 2844 }
2844 2845
2845 IN_PROC_BROWSER_TEST_P(MediaStreamDevicesControllerBrowserTest, 2846 IN_PROC_BROWSER_TEST_P(MediaStreamDevicesControllerBrowserTest,
2846 VideoCaptureAllowedUrls) { 2847 VideoCaptureAllowedUrls) {
(...skipping 11 matching lines...) Expand all
2858 }; 2859 };
2859 2860
2860 for (size_t i = 0; i < arraysize(allow_pattern); ++i) { 2861 for (size_t i = 0; i < arraysize(allow_pattern); ++i) {
2861 PolicyMap policies; 2862 PolicyMap policies;
2862 ConfigurePolicyMap(&policies, key::kVideoCaptureAllowed, 2863 ConfigurePolicyMap(&policies, key::kVideoCaptureAllowed,
2863 key::kVideoCaptureAllowedUrls, allow_pattern[i]); 2864 key::kVideoCaptureAllowedUrls, allow_pattern[i]);
2864 UpdateProviderPolicy(policies); 2865 UpdateProviderPolicy(policies);
2865 2866
2866 content::BrowserThread::PostTaskAndReply( 2867 content::BrowserThread::PostTaskAndReply(
2867 content::BrowserThread::IO, FROM_HERE, 2868 content::BrowserThread::IO, FROM_HERE,
2868 base::Bind( 2869 base::Bind(&MediaCaptureDevicesDispatcher::SetTestVideoCaptureDevices,
2869 &MediaCaptureDevicesDispatcher::OnVideoCaptureDevicesChanged,
2870 base::Unretained(MediaCaptureDevicesDispatcher::GetInstance()), 2870 base::Unretained(MediaCaptureDevicesDispatcher::GetInstance()),
2871 video_devices), 2871 video_devices),
2872 base::Bind( 2872 base::Bind(
2873 &MediaStreamDevicesControllerBrowserTest::FinishVideoTest, 2873 &MediaStreamDevicesControllerBrowserTest::FinishVideoTest,
2874 this)); 2874 this));
2875 2875
2876 base::MessageLoop::current()->Run(); 2876 base::MessageLoop::current()->Run();
2877 } 2877 }
2878 } 2878 }
2879 2879
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2958 PrefService* prefs = browser()->profile()->GetPrefs(); 2958 PrefService* prefs = browser()->profile()->GetPrefs();
2959 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( 2959 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed(
2960 prefs, "host.name")); 2960 prefs, "host.name"));
2961 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( 2961 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed(
2962 prefs, "other.host.name")); 2962 prefs, "other.host.name"));
2963 } 2963 }
2964 2964
2965 #endif // !defined(CHROME_OS) 2965 #endif // !defined(CHROME_OS)
2966 2966
2967 } // namespace policy 2967 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698