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

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

Issue 2631433002: Rename RTCPeerConnection.updateIce to setConfiguration and make it work. (Closed)
Patch Set: Fixing mock PC handler, using DCHECK for default case in switch statement Created 3 years, 11 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 // 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
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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 } 574 }
574 575
575 TEST_F(RTCPeerConnectionHandlerTest, setConfiguration) { 576 TEST_F(RTCPeerConnectionHandlerTest, setConfiguration) {
576 blink::WebRTCConfiguration config; 577 blink::WebRTCConfiguration config;
577 578
578 EXPECT_CALL(*mock_tracker_.get(), 579 EXPECT_CALL(*mock_tracker_.get(),
579 TrackSetConfiguration(pc_handler_.get(), _)); 580 TrackSetConfiguration(pc_handler_.get(), _));
580 // TODO(perkj): Test that the parameters in |config| can be translated when a 581 // TODO(perkj): Test that the parameters in |config| can be translated when a
581 // WebRTCConfiguration can be constructed. It's WebKit class and can't be 582 // WebRTCConfiguration can be constructed. It's WebKit class and can't be
582 // initialized from a test. 583 // initialized from a test.
583 EXPECT_TRUE(pc_handler_->setConfiguration(config)); 584 blink::WebRTCError error;
585 EXPECT_TRUE(pc_handler_->setConfiguration(config, error));
586 }
587
588 // Test that when an error occurs in SetConfiguration, it's converted to a
589 // blink error and false is returned.
590 TEST_F(RTCPeerConnectionHandlerTest, setConfigurationError) {
591 blink::WebRTCConfiguration config;
592
593 mock_peer_connection_->set_setconfiguration_error_type(
594 webrtc::RTCErrorType::INVALID_MODIFICATION);
595 EXPECT_CALL(*mock_tracker_.get(),
596 TrackSetConfiguration(pc_handler_.get(), _));
597 blink::WebRTCError error;
598 EXPECT_FALSE(pc_handler_->setConfiguration(config, error));
599 EXPECT_EQ(blink::WebRTCErrorType::kInvalidModification, error.type());
584 } 600 }
585 601
586 TEST_F(RTCPeerConnectionHandlerTest, addICECandidate) { 602 TEST_F(RTCPeerConnectionHandlerTest, addICECandidate) {
587 blink::WebRTCICECandidate candidate; 603 blink::WebRTCICECandidate candidate;
588 candidate.initialize(kDummySdp, "sdpMid", 1); 604 candidate.initialize(kDummySdp, "sdpMid", 1);
589 605
590 EXPECT_CALL(*mock_tracker_.get(), 606 EXPECT_CALL(*mock_tracker_.get(),
591 TrackAddIceCandidate(pc_handler_.get(), 607 TrackAddIceCandidate(pc_handler_.get(),
592 testing::Ref(candidate), 608 testing::Ref(candidate),
593 PeerConnectionTracker::SOURCE_REMOTE, 609 PeerConnectionTracker::SOURCE_REMOTE,
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 testing::Ref(tracks[0]))); 1298 testing::Ref(tracks[0])));
1283 1299
1284 std::unique_ptr<blink::WebRTCDTMFSenderHandler> sender( 1300 std::unique_ptr<blink::WebRTCDTMFSenderHandler> sender(
1285 pc_handler_->createDTMFSender(tracks[0])); 1301 pc_handler_->createDTMFSender(tracks[0]));
1286 EXPECT_TRUE(sender.get()); 1302 EXPECT_TRUE(sender.get());
1287 1303
1288 StopAllTracks(local_stream); 1304 StopAllTracks(local_stream);
1289 } 1305 }
1290 1306
1291 } // namespace content 1307 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698