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

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

Issue 2430643002: Use microsecond-style WebRtcVideoFrame constructor. (Closed)
Patch Set: Created 4 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
« 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 "content/renderer/media/webrtc/media_stream_remote_video_source.h" 5 #include "content/renderer/media/webrtc/media_stream_remote_video_source.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 rtc::scoped_refptr<webrtc::I420Buffer> buffer( 129 rtc::scoped_refptr<webrtc::I420Buffer> buffer(
130 new rtc::RefCountedObject<webrtc::I420Buffer>(320, 240)); 130 new rtc::RefCountedObject<webrtc::I420Buffer>(320, 240));
131 131
132 buffer->SetToBlack(); 132 buffer->SetToBlack();
133 133
134 source()->SinkInterfaceForTest()->OnFrame( 134 source()->SinkInterfaceForTest()->OnFrame(
135 cricket::WebRtcVideoFrame(buffer, 1, webrtc::kVideoRotation_0)); 135 cricket::WebRtcVideoFrame(buffer, webrtc::kVideoRotation_0, 1000));
136 run_loop.Run(); 136 run_loop.Run();
137 137
138 EXPECT_EQ(1, sink.number_of_frames()); 138 EXPECT_EQ(1, sink.number_of_frames());
139 track->RemoveSink(&sink); 139 track->RemoveSink(&sink);
140 } 140 }
141 141
142 TEST_F(MediaStreamRemoteVideoSourceTest, RemoteTrackStop) { 142 TEST_F(MediaStreamRemoteVideoSourceTest, RemoteTrackStop) {
143 std::unique_ptr<MediaStreamVideoTrack> track(CreateTrack()); 143 std::unique_ptr<MediaStreamVideoTrack> track(CreateTrack());
144 144
145 MockMediaStreamVideoSink sink; 145 MockMediaStreamVideoSink sink;
146 track->AddSink(&sink, sink.GetDeliverFrameCB(), false); 146 track->AddSink(&sink, sink.GetDeliverFrameCB(), false);
147 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive, sink.state()); 147 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive, sink.state());
148 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive, 148 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive,
149 webkit_source().getReadyState()); 149 webkit_source().getReadyState());
150 StopWebRtcTrack(); 150 StopWebRtcTrack();
151 base::RunLoop().RunUntilIdle(); 151 base::RunLoop().RunUntilIdle();
152 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, 152 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded,
153 webkit_source().getReadyState()); 153 webkit_source().getReadyState());
154 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, sink.state()); 154 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, sink.state());
155 155
156 track->RemoveSink(&sink); 156 track->RemoveSink(&sink);
157 } 157 }
158 158
159 } // namespace content 159 } // 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