| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/child/child_process.h" | 8 #include "content/child/child_process.h" |
| 9 #include "content/renderer/media/media_stream_video_track.h" | 9 #include "content/renderer/media/media_stream_video_track.h" |
| 10 #include "content/renderer/media/mock_media_stream_video_sink.h" | 10 #include "content/renderer/media/mock_media_stream_video_sink.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void StopWebRtcTrack() { | 77 void StopWebRtcTrack() { |
| 78 static_cast<MockWebRtcVideoTrack*>(webrtc_video_track_.get())->set_state( | 78 static_cast<MockWebRtcVideoTrack*>(webrtc_video_track_.get())->set_state( |
| 79 webrtc::MediaStreamTrackInterface::kEnded); | 79 webrtc::MediaStreamTrackInterface::kEnded); |
| 80 } | 80 } |
| 81 | 81 |
| 82 const blink::WebMediaStreamSource& webkit_source() const { | 82 const blink::WebMediaStreamSource& webkit_source() const { |
| 83 return webkit_source_; | 83 return webkit_source_; |
| 84 } | 84 } |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 void OnConstraintsApplied(MediaStreamSource* source, bool success) { | 87 void OnConstraintsApplied(MediaStreamSource* source, |
| 88 MediaStreamRequestResult result, |
| 89 const blink::WebString& result_name) { |
| 88 ASSERT_EQ(source, remote_source_); | 90 ASSERT_EQ(source, remote_source_); |
| 89 if (success) | 91 if (result == MEDIA_DEVICE_OK) |
| 90 ++number_of_successful_constraints_applied_; | 92 ++number_of_successful_constraints_applied_; |
| 91 else | 93 else |
| 92 ++number_of_failed_constraints_applied_; | 94 ++number_of_failed_constraints_applied_; |
| 93 } | 95 } |
| 94 | 96 |
| 95 base::MessageLoopForUI message_loop_; | 97 base::MessageLoopForUI message_loop_; |
| 96 scoped_ptr<ChildProcess> child_process_; | 98 scoped_ptr<ChildProcess> child_process_; |
| 97 scoped_ptr<MockPeerConnectionDependencyFactory> mock_factory_; | 99 scoped_ptr<MockPeerConnectionDependencyFactory> mock_factory_; |
| 98 scoped_refptr<webrtc::VideoTrackInterface> webrtc_video_track_; | 100 scoped_refptr<webrtc::VideoTrackInterface> webrtc_video_track_; |
| 99 // |remote_source_| is owned by |webkit_source_|. | 101 // |remote_source_| is owned by |webkit_source_|. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 webkit_source().readyState()); | 134 webkit_source().readyState()); |
| 133 StopWebRtcTrack(); | 135 StopWebRtcTrack(); |
| 134 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, | 136 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, |
| 135 webkit_source().readyState()); | 137 webkit_source().readyState()); |
| 136 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, sink.state()); | 138 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, sink.state()); |
| 137 | 139 |
| 138 track->RemoveSink(&sink); | 140 track->RemoveSink(&sink); |
| 139 } | 141 } |
| 140 | 142 |
| 141 } // namespace content | 143 } // namespace content |
| OLD | NEW |