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

Side by Side Diff: webrtc/pc/peerconnectionfactory_unittest.cc

Issue 2685093002: Switching some interfaces to use std::unique_ptr<>. (Closed)
Patch Set: Rebase onto master Created 3 years, 10 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 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 cricket::RelayServerConfig turn1("2401:fa00:4::", 1234, "test", kTurnPassword, 329 cricket::RelayServerConfig turn1("2401:fa00:4::", 1234, "test", kTurnPassword,
330 cricket::PROTO_UDP); 330 cricket::PROTO_UDP);
331 turn_servers.push_back(turn1); 331 turn_servers.push_back(turn1);
332 VerifyTurnServers(turn_servers); 332 VerifyTurnServers(turn_servers);
333 } 333 }
334 334
335 // This test verifies the captured stream is rendered locally using a 335 // This test verifies the captured stream is rendered locally using a
336 // local video track. 336 // local video track.
337 TEST_F(PeerConnectionFactoryTest, LocalRendering) { 337 TEST_F(PeerConnectionFactoryTest, LocalRendering) {
338 cricket::FakeVideoCapturer* capturer = new cricket::FakeVideoCapturer(); 338 cricket::FakeVideoCapturer* capturer = new cricket::FakeVideoCapturer();
339 // The source take ownership of |capturer|. 339 // The source takes ownership of |capturer|, but we keep a raw pointer to
340 // inject fake frames.
340 rtc::scoped_refptr<VideoTrackSourceInterface> source( 341 rtc::scoped_refptr<VideoTrackSourceInterface> source(
341 factory_->CreateVideoSource(capturer, NULL)); 342 factory_->CreateVideoSource(
343 std::unique_ptr<cricket::VideoCapturer>(capturer), NULL));
342 ASSERT_TRUE(source.get() != NULL); 344 ASSERT_TRUE(source.get() != NULL);
343 rtc::scoped_refptr<VideoTrackInterface> track( 345 rtc::scoped_refptr<VideoTrackInterface> track(
344 factory_->CreateVideoTrack("testlabel", source)); 346 factory_->CreateVideoTrack("testlabel", source));
345 ASSERT_TRUE(track.get() != NULL); 347 ASSERT_TRUE(track.get() != NULL);
346 FakeVideoTrackRenderer local_renderer(track); 348 FakeVideoTrackRenderer local_renderer(track);
347 349
348 EXPECT_EQ(0, local_renderer.num_rendered_frames()); 350 EXPECT_EQ(0, local_renderer.num_rendered_frames());
349 EXPECT_TRUE(capturer->CaptureFrame()); 351 EXPECT_TRUE(capturer->CaptureFrame());
350 EXPECT_EQ(1, local_renderer.num_rendered_frames()); 352 EXPECT_EQ(1, local_renderer.num_rendered_frames());
351 EXPECT_FALSE(local_renderer.black_frame()); 353 EXPECT_FALSE(local_renderer.black_frame());
352 354
353 track->set_enabled(false); 355 track->set_enabled(false);
354 EXPECT_TRUE(capturer->CaptureFrame()); 356 EXPECT_TRUE(capturer->CaptureFrame());
355 EXPECT_EQ(2, local_renderer.num_rendered_frames()); 357 EXPECT_EQ(2, local_renderer.num_rendered_frames());
356 EXPECT_TRUE(local_renderer.black_frame()); 358 EXPECT_TRUE(local_renderer.black_frame());
357 359
358 track->set_enabled(true); 360 track->set_enabled(true);
359 EXPECT_TRUE(capturer->CaptureFrame()); 361 EXPECT_TRUE(capturer->CaptureFrame());
360 EXPECT_EQ(3, local_renderer.num_rendered_frames()); 362 EXPECT_EQ(3, local_renderer.num_rendered_frames());
361 EXPECT_FALSE(local_renderer.black_frame()); 363 EXPECT_FALSE(local_renderer.black_frame());
362 } 364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698