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

Unified Diff: content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc

Issue 323313003: Add flag in device enumeration request to control label clearing and don't clear for pepper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
index 9e060d497b8df527cb5a53b3b69b2b1038547ece..99c701f11e046750a797339e1e14a2607cbef323 100644
--- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
+++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
@@ -99,10 +99,12 @@ class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost,
int page_request_id,
MediaStreamType type,
const GURL& security_origin,
+ bool hide_labels_if_no_access,
const base::Closure& quit_closure) {
quit_closures_.push(quit_closure);
MediaStreamDispatcherHost::OnEnumerateDevices(
- render_view_id, page_request_id, type, security_origin);
+ render_view_id, page_request_id, type, security_origin,
+ hide_labels_if_no_access);
}
std::string label_;
@@ -327,10 +329,11 @@ class MediaStreamDispatcherHostTest : public testing::Test {
void EnumerateDevicesAndWaitForResult(int render_view_id,
int page_request_id,
- MediaStreamType type) {
+ MediaStreamType type,
+ bool hide_labels_if_no_access) {
base::RunLoop run_loop;
host_->OnEnumerateDevices(render_view_id, page_request_id, type, origin_,
- run_loop.QuitClosure());
+ hide_labels_if_no_access, run_loop.QuitClosure());
run_loop.Run();
ASSERT_FALSE(host_->enumerated_devices_.empty());
EXPECT_FALSE(DoesContainRawIds(host_->enumerated_devices_));
@@ -878,32 +881,52 @@ TEST_F(MediaStreamDispatcherHostTest, VideoDeviceUnplugged) {
TEST_F(MediaStreamDispatcherHostTest, EnumerateAudioDevices) {
EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId,
- MEDIA_DEVICE_AUDIO_CAPTURE);
+ MEDIA_DEVICE_AUDIO_CAPTURE, true);
EXPECT_TRUE(DoesContainLabels(host_->enumerated_devices_));
}
TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevices) {
EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId,
- MEDIA_DEVICE_VIDEO_CAPTURE);
+ MEDIA_DEVICE_VIDEO_CAPTURE, true);
EXPECT_TRUE(DoesContainLabels(host_->enumerated_devices_));
}
-TEST_F(MediaStreamDispatcherHostTest, EnumerateAudioDevicesNoAccess) {
+TEST_F(MediaStreamDispatcherHostTest, EnumerateAudioDevicesNoAccessHideLabels) {
MockResourceContext* mock_resource_context =
static_cast<MockResourceContext*>(browser_context_.GetResourceContext());
mock_resource_context->set_mic_access(false);
EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId,
- MEDIA_DEVICE_AUDIO_CAPTURE);
+ MEDIA_DEVICE_AUDIO_CAPTURE, true);
EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_));
}
-TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccess) {
+TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccessHideLabels) {
MockResourceContext* mock_resource_context =
static_cast<MockResourceContext*>(browser_context_.GetResourceContext());
mock_resource_context->set_camera_access(false);
EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId,
- MEDIA_DEVICE_VIDEO_CAPTURE);
+ MEDIA_DEVICE_VIDEO_CAPTURE, true);
EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_));
}
+TEST_F(MediaStreamDispatcherHostTest,
+ EnumerateAudioDevicesNoAccessNoHideLabels) {
+ MockResourceContext* mock_resource_context =
+ static_cast<MockResourceContext*>(browser_context_.GetResourceContext());
+ mock_resource_context->set_mic_access(false);
+ EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId,
+ MEDIA_DEVICE_AUDIO_CAPTURE, false);
+ EXPECT_TRUE(DoesContainLabels(host_->enumerated_devices_));
+}
+
+TEST_F(MediaStreamDispatcherHostTest,
+ EnumerateVideoDevicesNoAccessNoHideLabels) {
+ MockResourceContext* mock_resource_context =
+ static_cast<MockResourceContext*>(browser_context_.GetResourceContext());
+ mock_resource_context->set_camera_access(false);
+ EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId,
+ MEDIA_DEVICE_VIDEO_CAPTURE, false);
+ EXPECT_TRUE(DoesContainLabels(host_->enumerated_devices_));
+}
+
}; // namespace content
« no previous file with comments | « content/browser/renderer_host/media/media_stream_dispatcher_host.cc ('k') | content/common/media/media_stream_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698