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

Side by Side Diff: content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc

Issue 586223002: Add new media request result MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 2 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 <string> 5 #include <string>
6 #include <queue> 6 #include <queue>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioOnly) { 448 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioOnly) {
449 StreamOptions options(true, false); 449 StreamOptions options(true, false);
450 450
451 SetupFakeUI(true); 451 SetupFakeUI(true);
452 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options); 452 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
453 453
454 EXPECT_EQ(host_->audio_devices_.size(), 1u); 454 EXPECT_EQ(host_->audio_devices_.size(), 1u);
455 EXPECT_EQ(host_->video_devices_.size(), 0u); 455 EXPECT_EQ(host_->video_devices_.size(), 0u);
456 } 456 }
457 457
458 // This test simulates a shutdown scenario: we don't setup a fake UI proxy for
459 // MediaStreamManager, so it will create an ordinary one which will not find
460 // a RenderFrameHostDelegate. This normally should only be the case at shutdown.
458 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithNothing) { 461 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithNothing) {
459 StreamOptions options(false, false); 462 StreamOptions options(false, false);
460 463
461 GenerateStreamAndWaitForFailure( 464 GenerateStreamAndWaitForFailure(
462 kRenderId, 465 kRenderId,
463 kPageRequestId, 466 kPageRequestId,
464 options, 467 options,
465 MEDIA_DEVICE_INVALID_STATE); 468 MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN);
466 } 469 }
467 470
468 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioAndVideo) { 471 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioAndVideo) {
469 StreamOptions options(true, true); 472 StreamOptions options(true, true);
470 473
471 SetupFakeUI(true); 474 SetupFakeUI(true);
472 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options); 475 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, options);
473 476
474 EXPECT_EQ(host_->audio_devices_.size(), 1u); 477 EXPECT_EQ(host_->audio_devices_.size(), 1u);
475 EXPECT_EQ(host_->video_devices_.size(), 1u); 478 EXPECT_EQ(host_->video_devices_.size(), 1u);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 915
913 TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccess) { 916 TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccess) {
914 SetupFakeUI(false); 917 SetupFakeUI(false);
915 stream_ui_->SetCameraAccess(false); 918 stream_ui_->SetCameraAccess(false);
916 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId, 919 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId,
917 MEDIA_DEVICE_VIDEO_CAPTURE); 920 MEDIA_DEVICE_VIDEO_CAPTURE);
918 EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_)); 921 EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_));
919 } 922 }
920 923
921 }; // namespace content 924 }; // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/media/media_stream_devices_controller.cc ('k') | content/browser/renderer_host/media/media_stream_ui_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698