| OLD | NEW | 
|     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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   224         new RTCPeerConnectionHandlerUnderTest( |   224         new RTCPeerConnectionHandlerUnderTest( | 
|   225             mock_client_.get(), mock_dependency_factory_.get())); |   225             mock_client_.get(), mock_dependency_factory_.get())); | 
|   226     mock_tracker_.reset(new NiceMock<MockPeerConnectionTracker>()); |   226     mock_tracker_.reset(new NiceMock<MockPeerConnectionTracker>()); | 
|   227     blink::WebRTCConfiguration config; |   227     blink::WebRTCConfiguration config; | 
|   228     blink::WebMediaConstraints constraints; |   228     blink::WebMediaConstraints constraints; | 
|   229     EXPECT_TRUE(pc_handler_->InitializeForTest( |   229     EXPECT_TRUE(pc_handler_->InitializeForTest( | 
|   230         config, constraints, mock_tracker_.get()->AsWeakPtr())); |   230         config, constraints, mock_tracker_.get()->AsWeakPtr())); | 
|   231  |   231  | 
|   232     mock_peer_connection_ = pc_handler_->native_peer_connection(); |   232     mock_peer_connection_ = pc_handler_->native_peer_connection(); | 
|   233     ASSERT_TRUE(mock_peer_connection_); |   233     ASSERT_TRUE(mock_peer_connection_); | 
 |   234     EXPECT_CALL(*mock_peer_connection_, Close()); | 
|   234   } |   235   } | 
|   235  |   236  | 
|   236   void TearDown() override { |   237   void TearDown() override { | 
|   237     pc_handler_.reset(); |   238     pc_handler_.reset(); | 
|   238     mock_tracker_.reset(); |   239     mock_tracker_.reset(); | 
|   239     mock_dependency_factory_.reset(); |   240     mock_dependency_factory_.reset(); | 
|   240     mock_client_.reset(); |   241     mock_client_.reset(); | 
|   241     blink::WebHeap::collectAllGarbageForTesting(); |   242     blink::WebHeap::collectAllGarbageForTesting(); | 
|   242   } |   243   } | 
|   243  |   244  | 
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   327   // Weak reference to the mocked native peer connection implementation. |   328   // Weak reference to the mocked native peer connection implementation. | 
|   328   MockPeerConnectionImpl* mock_peer_connection_; |   329   MockPeerConnectionImpl* mock_peer_connection_; | 
|   329 }; |   330 }; | 
|   330  |   331  | 
|   331 TEST_F(RTCPeerConnectionHandlerTest, Destruct) { |   332 TEST_F(RTCPeerConnectionHandlerTest, Destruct) { | 
|   332   EXPECT_CALL(*mock_tracker_.get(), UnregisterPeerConnection(pc_handler_.get())) |   333   EXPECT_CALL(*mock_tracker_.get(), UnregisterPeerConnection(pc_handler_.get())) | 
|   333       .Times(1); |   334       .Times(1); | 
|   334   pc_handler_.reset(NULL); |   335   pc_handler_.reset(NULL); | 
|   335 } |   336 } | 
|   336  |   337  | 
 |   338 TEST_F(RTCPeerConnectionHandlerTest, DestructAllHandlers) { | 
 |   339   EXPECT_CALL(*mock_client_.get(), releasePeerConnectionHandler()) | 
 |   340       .Times(1); | 
 |   341   RTCPeerConnectionHandler::DestructAllHandlers(); | 
 |   342 } | 
|   337 TEST_F(RTCPeerConnectionHandlerTest, CreateOffer) { |   343 TEST_F(RTCPeerConnectionHandlerTest, CreateOffer) { | 
|   338   blink::WebRTCSessionDescriptionRequest request; |   344   blink::WebRTCSessionDescriptionRequest request; | 
|   339   blink::WebMediaConstraints options; |   345   blink::WebMediaConstraints options; | 
|   340   EXPECT_CALL(*mock_tracker_.get(), TrackCreateOffer(pc_handler_.get(), _)); |   346   EXPECT_CALL(*mock_tracker_.get(), TrackCreateOffer(pc_handler_.get(), _)); | 
|   341  |   347  | 
|   342   // TODO(perkj): Can blink::WebRTCSessionDescriptionRequest be changed so |   348   // TODO(perkj): Can blink::WebRTCSessionDescriptionRequest be changed so | 
|   343   // the |reqest| requestSucceeded can be tested? Currently the |request| object |   349   // the |reqest| requestSucceeded can be tested? Currently the |request| object | 
|   344   // can not be initialized from a unit test. |   350   // can not be initialized from a unit test. | 
|   345   EXPECT_FALSE(mock_peer_connection_->created_session_description() != NULL); |   351   EXPECT_FALSE(mock_peer_connection_->created_session_description() != NULL); | 
|   346   pc_handler_->createOffer(request, options); |   352   pc_handler_->createOffer(request, options); | 
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   989   EXPECT_CALL(*mock_tracker_.get(), |   995   EXPECT_CALL(*mock_tracker_.get(), | 
|   990               TrackCreateDTMFSender(pc_handler_.get(), |   996               TrackCreateDTMFSender(pc_handler_.get(), | 
|   991                                     testing::Ref(tracks[0]))); |   997                                     testing::Ref(tracks[0]))); | 
|   992  |   998  | 
|   993   scoped_ptr<blink::WebRTCDTMFSenderHandler> sender( |   999   scoped_ptr<blink::WebRTCDTMFSenderHandler> sender( | 
|   994       pc_handler_->createDTMFSender(tracks[0])); |  1000       pc_handler_->createDTMFSender(tracks[0])); | 
|   995   EXPECT_TRUE(sender.get()); |  1001   EXPECT_TRUE(sender.get()); | 
|   996 } |  1002 } | 
|   997  |  1003  | 
|   998 }  // namespace content |  1004 }  // namespace content | 
| OLD | NEW |