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

Side by Side Diff: content/renderer/media/rtc_peer_connection_handler_unittest.cc

Issue 1438153002: Fix leak of RTCPeerConnectionHandler if PeerConnection.close() is called from js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // Weak reference to the mocked native peer connection implementation. 327 // Weak reference to the mocked native peer connection implementation.
328 MockPeerConnectionImpl* mock_peer_connection_; 328 MockPeerConnectionImpl* mock_peer_connection_;
329 }; 329 };
330 330
331 TEST_F(RTCPeerConnectionHandlerTest, Destruct) { 331 TEST_F(RTCPeerConnectionHandlerTest, Destruct) {
332 EXPECT_CALL(*mock_tracker_.get(), UnregisterPeerConnection(pc_handler_.get())) 332 EXPECT_CALL(*mock_tracker_.get(), UnregisterPeerConnection(pc_handler_.get()))
333 .Times(1); 333 .Times(1);
334 pc_handler_.reset(NULL); 334 pc_handler_.reset(NULL);
335 } 335 }
336 336
337 TEST_F(RTCPeerConnectionHandlerTest, DestructAllHandlers) {
338 EXPECT_CALL(*mock_client_.get(), releasePeerConnectionHandler())
339 .Times(1);
340 RTCPeerConnectionHandler::DestructAllHandlers();
341 }
337 TEST_F(RTCPeerConnectionHandlerTest, CreateOffer) { 342 TEST_F(RTCPeerConnectionHandlerTest, CreateOffer) {
338 blink::WebRTCSessionDescriptionRequest request; 343 blink::WebRTCSessionDescriptionRequest request;
339 blink::WebMediaConstraints options; 344 blink::WebMediaConstraints options;
340 EXPECT_CALL(*mock_tracker_.get(), TrackCreateOffer(pc_handler_.get(), _)); 345 EXPECT_CALL(*mock_tracker_.get(), TrackCreateOffer(pc_handler_.get(), _));
341 346
342 // TODO(perkj): Can blink::WebRTCSessionDescriptionRequest be changed so 347 // TODO(perkj): Can blink::WebRTCSessionDescriptionRequest be changed so
343 // the |reqest| requestSucceeded can be tested? Currently the |request| object 348 // the |reqest| requestSucceeded can be tested? Currently the |request| object
344 // can not be initialized from a unit test. 349 // can not be initialized from a unit test.
345 EXPECT_FALSE(mock_peer_connection_->created_session_description() != NULL); 350 EXPECT_FALSE(mock_peer_connection_->created_session_description() != NULL);
346 pc_handler_->createOffer(request, options); 351 pc_handler_->createOffer(request, options);
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 EXPECT_CALL(*mock_tracker_.get(), 994 EXPECT_CALL(*mock_tracker_.get(),
990 TrackCreateDTMFSender(pc_handler_.get(), 995 TrackCreateDTMFSender(pc_handler_.get(),
991 testing::Ref(tracks[0]))); 996 testing::Ref(tracks[0])));
992 997
993 scoped_ptr<blink::WebRTCDTMFSenderHandler> sender( 998 scoped_ptr<blink::WebRTCDTMFSenderHandler> sender(
994 pc_handler_->createDTMFSender(tracks[0])); 999 pc_handler_->createDTMFSender(tracks[0]));
995 EXPECT_TRUE(sender.get()); 1000 EXPECT_TRUE(sender.get());
996 } 1001 }
997 1002
998 } // namespace content 1003 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698