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 4ebf35c6125b8e8dd8b3c0ff1b7ab121d6620fa5..cd87e36a1606b0a38c9327b29f77185a9b3cc5d1 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 |
@@ -54,7 +54,9 @@ class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost, |
MOCK_METHOD4(OnStreamGenerated, |
void(int routing_id, int request_id, int audio_array_size, |
int video_array_size)); |
- MOCK_METHOD2(OnStreamGenerationFailed, void(int routing_id, int request_id)); |
+ MOCK_METHOD3(OnStreamGenerationFailed, void(int routing_id, |
+ int request_id, |
+ MediaStreamRequestResult result)); |
MOCK_METHOD1(OnDeviceStopped, void(int routing_id)); |
MOCK_METHOD2(OnDeviceOpened, void(int routing_id, int request_id)); |
@@ -148,8 +150,11 @@ class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost, |
video_devices_ = video_device_list; |
} |
- void OnStreamGenerationFailed(const IPC::Message& msg, int request_id) { |
- OnStreamGenerationFailed(msg.routing_id(), request_id); |
+ void OnStreamGenerationFailed( |
+ const IPC::Message& msg, |
+ int request_id, |
+ content::MediaStreamRequestResult result) { |
+ OnStreamGenerationFailed(msg.routing_id(), request_id, result); |
if (!quit_closures_.empty()) { |
base::Closure quit_closure = quit_closures_.front(); |
quit_closures_.pop(); |
@@ -271,12 +276,16 @@ class MediaStreamDispatcherHostTest : public testing::Test { |
EXPECT_TRUE(DoesEveryDeviceMapToRawId(host_->video_devices_, origin_)); |
} |
- void GenerateStreamAndWaitForFailure(int render_view_id, |
- int page_request_id, |
- const StreamOptions& options) { |
+ void GenerateStreamAndWaitForFailure( |
+ int render_view_id, |
+ int page_request_id, |
+ const StreamOptions& options, |
+ MediaStreamRequestResult expected_result) { |
base::RunLoop run_loop; |
EXPECT_CALL(*host_.get(), |
- OnStreamGenerationFailed(render_view_id, page_request_id)); |
+ OnStreamGenerationFailed(render_view_id, |
+ page_request_id, |
+ expected_result)); |
host_->OnGenerateStream(render_view_id, page_request_id, options, origin_, |
run_loop.QuitClosure()); |
run_loop.Run(); |
@@ -399,7 +408,11 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioOnly) { |
TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithNothing) { |
StreamOptions options(false, false); |
- GenerateStreamAndWaitForFailure(kRenderId, kPageRequestId, options); |
+ GenerateStreamAndWaitForFailure( |
+ kRenderId, |
+ kPageRequestId, |
+ options, |
+ MEDIA_DEVICE_INVALID_STATE); |
} |
TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioAndVideo) { |
@@ -611,7 +624,11 @@ TEST_F(MediaStreamDispatcherHostTest, |
StreamOptions options(true, true); |
AddSourceIdConstraint("invalid source id", &options.mandatory_video); |
- GenerateStreamAndWaitForFailure(kRenderId, kPageRequestId, options); |
+ GenerateStreamAndWaitForFailure( |
+ kRenderId, |
+ kPageRequestId, |
+ options, |
+ MEDIA_DEVICE_CAPTURE_FAILURE); |
} |
// Test that generating a stream with an invalid mandatory audio source id fail. |
@@ -620,7 +637,11 @@ TEST_F(MediaStreamDispatcherHostTest, |
StreamOptions options(true, true); |
AddSourceIdConstraint("invalid source id", &options.mandatory_audio); |
- GenerateStreamAndWaitForFailure(kRenderId, kPageRequestId, options); |
+ GenerateStreamAndWaitForFailure( |
+ kRenderId, |
+ kPageRequestId, |
+ options, |
+ MEDIA_DEVICE_CAPTURE_FAILURE); |
} |
// Test that generating a stream with an invalid optional video source id |