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 "content/renderer/media/rtc_peer_connection_handler.h" | 5 #include "content/renderer/media/rtc_peer_connection_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "testing/gmock/include/gmock/gmock.h" | 36 #include "testing/gmock/include/gmock/gmock.h" |
37 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
38 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 38 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
39 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 39 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
40 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 40 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
41 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 41 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
42 #include "third_party/WebKit/public/platform/WebRTCConfiguration.h" | 42 #include "third_party/WebKit/public/platform/WebRTCConfiguration.h" |
43 #include "third_party/WebKit/public/platform/WebRTCDTMFSenderHandler.h" | 43 #include "third_party/WebKit/public/platform/WebRTCDTMFSenderHandler.h" |
44 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandler.h" | 44 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandler.h" |
45 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h" | 45 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h" |
| 46 #include "third_party/WebKit/public/platform/WebRTCError.h" |
46 #include "third_party/WebKit/public/platform/WebRTCICECandidate.h" | 47 #include "third_party/WebKit/public/platform/WebRTCICECandidate.h" |
47 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandlerClient.h
" | 48 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandlerClient.h
" |
48 #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h" | 49 #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h" |
49 #include "third_party/WebKit/public/platform/WebRTCSessionDescriptionRequest.h" | 50 #include "third_party/WebKit/public/platform/WebRTCSessionDescriptionRequest.h" |
50 #include "third_party/WebKit/public/platform/WebRTCStatsRequest.h" | 51 #include "third_party/WebKit/public/platform/WebRTCStatsRequest.h" |
51 #include "third_party/WebKit/public/platform/WebRTCVoidRequest.h" | 52 #include "third_party/WebKit/public/platform/WebRTCVoidRequest.h" |
52 #include "third_party/WebKit/public/platform/WebURL.h" | 53 #include "third_party/WebKit/public/platform/WebURL.h" |
53 #include "third_party/WebKit/public/web/WebHeap.h" | 54 #include "third_party/WebKit/public/web/WebHeap.h" |
54 #include "third_party/webrtc/api/peerconnectioninterface.h" | 55 #include "third_party/webrtc/api/peerconnectioninterface.h" |
55 #include "third_party/webrtc/stats/test/rtcteststats.h" | 56 #include "third_party/webrtc/stats/test/rtcteststats.h" |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 } | 578 } |
578 | 579 |
579 TEST_F(RTCPeerConnectionHandlerTest, setConfiguration) { | 580 TEST_F(RTCPeerConnectionHandlerTest, setConfiguration) { |
580 blink::WebRTCConfiguration config; | 581 blink::WebRTCConfiguration config; |
581 | 582 |
582 EXPECT_CALL(*mock_tracker_.get(), | 583 EXPECT_CALL(*mock_tracker_.get(), |
583 TrackSetConfiguration(pc_handler_.get(), _)); | 584 TrackSetConfiguration(pc_handler_.get(), _)); |
584 // TODO(perkj): Test that the parameters in |config| can be translated when a | 585 // TODO(perkj): Test that the parameters in |config| can be translated when a |
585 // WebRTCConfiguration can be constructed. It's WebKit class and can't be | 586 // WebRTCConfiguration can be constructed. It's WebKit class and can't be |
586 // initialized from a test. | 587 // initialized from a test. |
587 EXPECT_TRUE(pc_handler_->setConfiguration(config)); | 588 EXPECT_EQ(blink::WebRTCErrorType::kNone, |
| 589 pc_handler_->setConfiguration(config)); |
| 590 } |
| 591 |
| 592 // Test that when an error occurs in SetConfiguration, it's converted to a |
| 593 // blink error and false is returned. |
| 594 TEST_F(RTCPeerConnectionHandlerTest, setConfigurationError) { |
| 595 blink::WebRTCConfiguration config; |
| 596 |
| 597 mock_peer_connection_->set_setconfiguration_error_type( |
| 598 webrtc::RTCErrorType::INVALID_MODIFICATION); |
| 599 EXPECT_CALL(*mock_tracker_.get(), |
| 600 TrackSetConfiguration(pc_handler_.get(), _)); |
| 601 EXPECT_EQ(blink::WebRTCErrorType::kInvalidModification, |
| 602 pc_handler_->setConfiguration(config)); |
588 } | 603 } |
589 | 604 |
590 TEST_F(RTCPeerConnectionHandlerTest, addICECandidate) { | 605 TEST_F(RTCPeerConnectionHandlerTest, addICECandidate) { |
591 blink::WebRTCICECandidate candidate; | 606 blink::WebRTCICECandidate candidate; |
592 candidate.initialize(kDummySdp, "sdpMid", 1); | 607 candidate.initialize(kDummySdp, "sdpMid", 1); |
593 | 608 |
594 EXPECT_CALL(*mock_tracker_.get(), | 609 EXPECT_CALL(*mock_tracker_.get(), |
595 TrackAddIceCandidate(pc_handler_.get(), | 610 TrackAddIceCandidate(pc_handler_.get(), |
596 testing::Ref(candidate), | 611 testing::Ref(candidate), |
597 PeerConnectionTracker::SOURCE_REMOTE, | 612 PeerConnectionTracker::SOURCE_REMOTE, |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 testing::Ref(tracks[0]))); | 1308 testing::Ref(tracks[0]))); |
1294 | 1309 |
1295 std::unique_ptr<blink::WebRTCDTMFSenderHandler> sender( | 1310 std::unique_ptr<blink::WebRTCDTMFSenderHandler> sender( |
1296 pc_handler_->createDTMFSender(tracks[0])); | 1311 pc_handler_->createDTMFSender(tracks[0])); |
1297 EXPECT_TRUE(sender.get()); | 1312 EXPECT_TRUE(sender.get()); |
1298 | 1313 |
1299 StopAllTracks(local_stream); | 1314 StopAllTracks(local_stream); |
1300 } | 1315 } |
1301 | 1316 |
1302 } // namespace content | 1317 } // namespace content |
OLD | NEW |