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

Side by Side Diff: content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc

Issue 1462003002: Changed MediaStreamRemoteVideoSource unit test to use correct WebRtcVideoFrame.InitToBlack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "content/child/child_process.h" 9 #include "content/child/child_process.h"
10 #include "content/renderer/media/media_stream_video_track.h" 10 #include "content/renderer/media/media_stream_video_track.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 scoped_ptr<MediaStreamVideoTrack> track(CreateTrack()); 120 scoped_ptr<MediaStreamVideoTrack> track(CreateTrack());
121 EXPECT_EQ(1, NumberOfSuccessConstraintsCallbacks()); 121 EXPECT_EQ(1, NumberOfSuccessConstraintsCallbacks());
122 122
123 MockMediaStreamVideoSink sink; 123 MockMediaStreamVideoSink sink;
124 track->AddSink(&sink, sink.GetDeliverFrameCB()); 124 track->AddSink(&sink, sink.GetDeliverFrameCB());
125 base::RunLoop run_loop; 125 base::RunLoop run_loop;
126 base::Closure quit_closure = run_loop.QuitClosure(); 126 base::Closure quit_closure = run_loop.QuitClosure();
127 EXPECT_CALL(sink, OnVideoFrame()).WillOnce( 127 EXPECT_CALL(sink, OnVideoFrame()).WillOnce(
128 RunClosure(quit_closure)); 128 RunClosure(quit_closure));
129 cricket::WebRtcVideoFrame webrtc_frame; 129 cricket::WebRtcVideoFrame webrtc_frame;
130 webrtc_frame.InitToBlack(320, 240, 1, 1, 0, 1); 130 webrtc_frame.InitToBlack(320, 240, 1, 1, 1);
131 source()->RenderInterfaceForTest()->RenderFrame(&webrtc_frame); 131 source()->RenderInterfaceForTest()->RenderFrame(&webrtc_frame);
132 run_loop.Run(); 132 run_loop.Run();
133 133
134 EXPECT_EQ(1, sink.number_of_frames()); 134 EXPECT_EQ(1, sink.number_of_frames());
135 track->RemoveSink(&sink); 135 track->RemoveSink(&sink);
136 } 136 }
137 137
138 TEST_F(MediaStreamRemoteVideoSourceTest, RemoteTrackStop) { 138 TEST_F(MediaStreamRemoteVideoSourceTest, RemoteTrackStop) {
139 scoped_ptr<MediaStreamVideoTrack> track(CreateTrack()); 139 scoped_ptr<MediaStreamVideoTrack> track(CreateTrack());
140 140
141 MockMediaStreamVideoSink sink; 141 MockMediaStreamVideoSink sink;
142 track->AddSink(&sink, sink.GetDeliverFrameCB()); 142 track->AddSink(&sink, sink.GetDeliverFrameCB());
143 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive, sink.state()); 143 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive, sink.state());
144 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive, 144 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive,
145 webkit_source().readyState()); 145 webkit_source().readyState());
146 StopWebRtcTrack(); 146 StopWebRtcTrack();
147 base::RunLoop().RunUntilIdle(); 147 base::RunLoop().RunUntilIdle();
148 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, 148 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded,
149 webkit_source().readyState()); 149 webkit_source().readyState());
150 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, sink.state()); 150 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, sink.state());
151 151
152 track->RemoveSink(&sink); 152 track->RemoveSink(&sink);
153 } 153 }
154 154
155 } // namespace content 155 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698