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

Side by Side Diff: webrtc/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionTest.java

Issue 2666873002: Adding Java wrapper for DtmfSender. (Closed)
Patch Set: Merge with 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 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2013 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 for (IceCandidate candidate : answeringExpectations.getAtLeastOneIceCandidat e()) { 709 for (IceCandidate candidate : answeringExpectations.getAtLeastOneIceCandidat e()) {
710 offeringPC.addIceCandidate(candidate); 710 offeringPC.addIceCandidate(candidate);
711 } 711 }
712 712
713 assertTrue(offeringExpectations.waitForAllExpectationsToBeSatisfied(TIMEOUT_ SECONDS)); 713 assertTrue(offeringExpectations.waitForAllExpectationsToBeSatisfied(TIMEOUT_ SECONDS));
714 assertTrue(answeringExpectations.waitForAllExpectationsToBeSatisfied(TIMEOUT _SECONDS)); 714 assertTrue(answeringExpectations.waitForAllExpectationsToBeSatisfied(TIMEOUT _SECONDS));
715 715
716 assertEquals(PeerConnection.SignalingState.STABLE, offeringPC.signalingState ()); 716 assertEquals(PeerConnection.SignalingState.STABLE, offeringPC.signalingState ());
717 assertEquals(PeerConnection.SignalingState.STABLE, answeringPC.signalingStat e()); 717 assertEquals(PeerConnection.SignalingState.STABLE, answeringPC.signalingStat e());
718 718
719 // Set a bitrate limit for the outgoing video stream for the offerer. 719 // Test some of the RtpSender API.
720 RtpSender videoSender = null; 720 RtpSender videoSender = null;
721 RtpSender audioSender = null;
721 for (RtpSender sender : offeringPC.getSenders()) { 722 for (RtpSender sender : offeringPC.getSenders()) {
722 if (sender.track().kind().equals("video")) { 723 if (sender.track().kind().equals("video")) {
723 videoSender = sender; 724 videoSender = sender;
725 } else {
726 audioSender = sender;
724 } 727 }
725 } 728 }
726 assertNotNull(videoSender); 729 assertNotNull(videoSender);
730 assertNotNull(audioSender);
731
732 // Set a bitrate limit for the outgoing video stream for the offerer.
727 RtpParameters rtpParameters = videoSender.getParameters(); 733 RtpParameters rtpParameters = videoSender.getParameters();
728 assertNotNull(rtpParameters); 734 assertNotNull(rtpParameters);
729 assertEquals(1, rtpParameters.encodings.size()); 735 assertEquals(1, rtpParameters.encodings.size());
730 assertNull(rtpParameters.encodings.get(0).maxBitrateBps); 736 assertNull(rtpParameters.encodings.get(0).maxBitrateBps);
731 737
732 rtpParameters.encodings.get(0).maxBitrateBps = 300000; 738 rtpParameters.encodings.get(0).maxBitrateBps = 300000;
733 assertTrue(videoSender.setParameters(rtpParameters)); 739 assertTrue(videoSender.setParameters(rtpParameters));
734 740
741 // Create a DTMF sender.
742 DtmfSender dtmfSender = audioSender.dtmf();
743 assertNotNull(dtmfSender);
744 assertTrue(dtmfSender.canInsertDtmf());
745 assertTrue(dtmfSender.insertDtmf("123", 300, 100));
746
735 // Verify that we can read back the updated value. 747 // Verify that we can read back the updated value.
736 rtpParameters = videoSender.getParameters(); 748 rtpParameters = videoSender.getParameters();
737 assertEquals(300000, (int) rtpParameters.encodings.get(0).maxBitrateBps); 749 assertEquals(300000, (int) rtpParameters.encodings.get(0).maxBitrateBps);
738 750
739 // Test send & receive UTF-8 text. 751 // Test send & receive UTF-8 text.
740 answeringExpectations.expectMessage( 752 answeringExpectations.expectMessage(
741 ByteBuffer.wrap("hello!".getBytes(Charset.forName("UTF-8"))), false); 753 ByteBuffer.wrap("hello!".getBytes(Charset.forName("UTF-8"))), false);
742 DataChannel.Buffer buffer = 754 DataChannel.Buffer buffer =
743 new DataChannel.Buffer(ByteBuffer.wrap("hello!".getBytes(Charset.forName ("UTF-8"))), false); 755 new DataChannel.Buffer(ByteBuffer.wrap("hello!".getBytes(Charset.forName ("UTF-8"))), false);
744 assertTrue(offeringExpectations.dataChannel.send(buffer)); 756 assertTrue(offeringExpectations.dataChannel.send(buffer));
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 TreeSet<String> threads = new TreeSet<String>(); 1066 TreeSet<String> threads = new TreeSet<String>();
1055 // This pokes at /proc instead of using the Java APIs because we're also 1067 // This pokes at /proc instead of using the Java APIs because we're also
1056 // looking for libjingle/webrtc native threads, most of which won't have 1068 // looking for libjingle/webrtc native threads, most of which won't have
1057 // attached to the JVM. 1069 // attached to the JVM.
1058 for (String threadId : (new File("/proc/self/task")).list()) { 1070 for (String threadId : (new File("/proc/self/task")).list()) {
1059 threads.add(threadId); 1071 threads.add(threadId);
1060 } 1072 }
1061 return threads; 1073 return threads;
1062 } 1074 }
1063 } 1075 }
OLDNEW
« no previous file with comments | « webrtc/sdk/android/api/org/webrtc/RtpSender.java ('k') | webrtc/sdk/android/src/jni/peerconnection_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698