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

Side by Side Diff: talk/app/webrtc/webrtcsdp_unittest.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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
« no previous file with comments | « talk/app/webrtc/webrtcsdp.cc ('k') | talk/app/webrtc/webrtcsession.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 using webrtc::IceCandidateCollection; 68 using webrtc::IceCandidateCollection;
69 using webrtc::IceCandidateInterface; 69 using webrtc::IceCandidateInterface;
70 using webrtc::JsepIceCandidate; 70 using webrtc::JsepIceCandidate;
71 using webrtc::JsepSessionDescription; 71 using webrtc::JsepSessionDescription;
72 using webrtc::SdpParseError; 72 using webrtc::SdpParseError;
73 using webrtc::SessionDescriptionInterface; 73 using webrtc::SessionDescriptionInterface;
74 74
75 typedef std::vector<AudioCodec> AudioCodecs; 75 typedef std::vector<AudioCodec> AudioCodecs;
76 typedef std::vector<Candidate> Candidates; 76 typedef std::vector<Candidate> Candidates;
77 77
78 static const uint32 kDefaultSctpPort = 5000; 78 static const uint32_t kDefaultSctpPort = 5000;
79 static const char kSessionTime[] = "t=0 0\r\n"; 79 static const char kSessionTime[] = "t=0 0\r\n";
80 static const uint32 kCandidatePriority = 2130706432U; // pref = 1.0 80 static const uint32_t kCandidatePriority = 2130706432U; // pref = 1.0
81 static const char kCandidateUfragVoice[] = "ufrag_voice"; 81 static const char kCandidateUfragVoice[] = "ufrag_voice";
82 static const char kCandidatePwdVoice[] = "pwd_voice"; 82 static const char kCandidatePwdVoice[] = "pwd_voice";
83 static const char kAttributeIcePwdVoice[] = "a=ice-pwd:pwd_voice\r\n"; 83 static const char kAttributeIcePwdVoice[] = "a=ice-pwd:pwd_voice\r\n";
84 static const char kCandidateUfragVideo[] = "ufrag_video"; 84 static const char kCandidateUfragVideo[] = "ufrag_video";
85 static const char kCandidatePwdVideo[] = "pwd_video"; 85 static const char kCandidatePwdVideo[] = "pwd_video";
86 static const char kCandidateUfragData[] = "ufrag_data"; 86 static const char kCandidateUfragData[] = "ufrag_data";
87 static const char kCandidatePwdData[] = "pwd_data"; 87 static const char kCandidatePwdData[] = "pwd_data";
88 static const char kAttributeIcePwdVideo[] = "a=ice-pwd:pwd_video\r\n"; 88 static const char kAttributeIcePwdVideo[] = "a=ice-pwd:pwd_video\r\n";
89 static const uint32 kCandidateGeneration = 2; 89 static const uint32_t kCandidateGeneration = 2;
90 static const char kCandidateFoundation1[] = "a0+B/1"; 90 static const char kCandidateFoundation1[] = "a0+B/1";
91 static const char kCandidateFoundation2[] = "a0+B/2"; 91 static const char kCandidateFoundation2[] = "a0+B/2";
92 static const char kCandidateFoundation3[] = "a0+B/3"; 92 static const char kCandidateFoundation3[] = "a0+B/3";
93 static const char kCandidateFoundation4[] = "a0+B/4"; 93 static const char kCandidateFoundation4[] = "a0+B/4";
94 static const char kAttributeCryptoVoice[] = 94 static const char kAttributeCryptoVoice[] =
95 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " 95 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 "
96 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " 96 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 "
97 "dummy_session_params\r\n"; 97 "dummy_session_params\r\n";
98 static const char kAttributeCryptoVideo[] = 98 static const char kAttributeCryptoVideo[] =
99 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " 99 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
100 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n"; 100 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n";
101 static const char kFingerprint[] = "a=fingerprint:sha-1 " 101 static const char kFingerprint[] = "a=fingerprint:sha-1 "
102 "4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB\r\n"; 102 "4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB\r\n";
103 static const int kExtmapId = 1; 103 static const int kExtmapId = 1;
104 static const char kExtmapUri[] = "http://example.com/082005/ext.htm#ttime"; 104 static const char kExtmapUri[] = "http://example.com/082005/ext.htm#ttime";
105 static const char kExtmap[] = 105 static const char kExtmap[] =
106 "a=extmap:1 http://example.com/082005/ext.htm#ttime\r\n"; 106 "a=extmap:1 http://example.com/082005/ext.htm#ttime\r\n";
107 static const char kExtmapWithDirectionAndAttribute[] = 107 static const char kExtmapWithDirectionAndAttribute[] =
108 "a=extmap:1/sendrecv http://example.com/082005/ext.htm#ttime a1 a2\r\n"; 108 "a=extmap:1/sendrecv http://example.com/082005/ext.htm#ttime a1 a2\r\n";
109 109
110 static const uint8 kIdentityDigest[] = {0x4A, 0xAD, 0xB9, 0xB1, 110 static const uint8_t kIdentityDigest[] = {
111 0x3F, 0x82, 0x18, 0x3B, 111 0x4A, 0xAD, 0xB9, 0xB1, 0x3F, 0x82, 0x18, 0x3B, 0x54, 0x02,
112 0x54, 0x02, 0x12, 0xDF, 112 0x12, 0xDF, 0x3E, 0x5D, 0x49, 0x6B, 0x19, 0xE5, 0x7C, 0xAB};
113 0x3E, 0x5D, 0x49, 0x6B,
114 0x19, 0xE5, 0x7C, 0xAB};
115 113
116 static const char kDtlsSctp[] = "DTLS/SCTP"; 114 static const char kDtlsSctp[] = "DTLS/SCTP";
117 static const char kUdpDtlsSctp[] = "UDP/DTLS/SCTP"; 115 static const char kUdpDtlsSctp[] = "UDP/DTLS/SCTP";
118 static const char kTcpDtlsSctp[] = "TCP/DTLS/SCTP"; 116 static const char kTcpDtlsSctp[] = "TCP/DTLS/SCTP";
119 117
120 struct CodecParams { 118 struct CodecParams {
121 int max_ptime; 119 int max_ptime;
122 int ptime; 120 int ptime;
123 int min_ptime; 121 int min_ptime;
124 int sprop_stereo; 122 int sprop_stereo;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 400
403 // Content name 401 // Content name
404 static const char kAudioContentName[] = "audio_content_name"; 402 static const char kAudioContentName[] = "audio_content_name";
405 static const char kVideoContentName[] = "video_content_name"; 403 static const char kVideoContentName[] = "video_content_name";
406 static const char kDataContentName[] = "data_content_name"; 404 static const char kDataContentName[] = "data_content_name";
407 405
408 // MediaStream 1 406 // MediaStream 1
409 static const char kStreamLabel1[] = "local_stream_1"; 407 static const char kStreamLabel1[] = "local_stream_1";
410 static const char kStream1Cname[] = "stream_1_cname"; 408 static const char kStream1Cname[] = "stream_1_cname";
411 static const char kAudioTrackId1[] = "audio_track_id_1"; 409 static const char kAudioTrackId1[] = "audio_track_id_1";
412 static const uint32 kAudioTrack1Ssrc = 1; 410 static const uint32_t kAudioTrack1Ssrc = 1;
413 static const char kVideoTrackId1[] = "video_track_id_1"; 411 static const char kVideoTrackId1[] = "video_track_id_1";
414 static const uint32 kVideoTrack1Ssrc = 2; 412 static const uint32_t kVideoTrack1Ssrc = 2;
415 static const char kVideoTrackId2[] = "video_track_id_2"; 413 static const char kVideoTrackId2[] = "video_track_id_2";
416 static const uint32 kVideoTrack2Ssrc = 3; 414 static const uint32_t kVideoTrack2Ssrc = 3;
417 415
418 // MediaStream 2 416 // MediaStream 2
419 static const char kStreamLabel2[] = "local_stream_2"; 417 static const char kStreamLabel2[] = "local_stream_2";
420 static const char kStream2Cname[] = "stream_2_cname"; 418 static const char kStream2Cname[] = "stream_2_cname";
421 static const char kAudioTrackId2[] = "audio_track_id_2"; 419 static const char kAudioTrackId2[] = "audio_track_id_2";
422 static const uint32 kAudioTrack2Ssrc = 4; 420 static const uint32_t kAudioTrack2Ssrc = 4;
423 static const char kVideoTrackId3[] = "video_track_id_3"; 421 static const char kVideoTrackId3[] = "video_track_id_3";
424 static const uint32 kVideoTrack3Ssrc = 5; 422 static const uint32_t kVideoTrack3Ssrc = 5;
425 static const uint32 kVideoTrack4Ssrc = 6; 423 static const uint32_t kVideoTrack4Ssrc = 6;
426 424
427 // DataChannel 425 // DataChannel
428 static const char kDataChannelLabel[] = "data_channel"; 426 static const char kDataChannelLabel[] = "data_channel";
429 static const char kDataChannelMsid[] = "data_channeld0"; 427 static const char kDataChannelMsid[] = "data_channeld0";
430 static const char kDataChannelCname[] = "data_channel_cname"; 428 static const char kDataChannelCname[] = "data_channel_cname";
431 static const uint32 kDataChannelSsrc = 10; 429 static const uint32_t kDataChannelSsrc = 10;
432 430
433 // Candidate 431 // Candidate
434 static const char kDummyMid[] = "dummy_mid"; 432 static const char kDummyMid[] = "dummy_mid";
435 static const int kDummyIndex = 123; 433 static const int kDummyIndex = 123;
436 434
437 // Misc 435 // Misc
438 static const char kDummyString[] = "dummy"; 436 static const char kDummyString[] = "dummy";
439 437
440 // Helper functions 438 // Helper functions
441 439
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
2150 // Remove the "\n" at the end. 2148 // Remove the "\n" at the end.
2151 sdp_with_data = sdp_with_data.substr(0, sdp_with_data.size() - 1); 2149 sdp_with_data = sdp_with_data.substr(0, sdp_with_data.size() - 1);
2152 JsepSessionDescription jdesc_output(kDummyString); 2150 JsepSessionDescription jdesc_output(kDummyString);
2153 2151
2154 EXPECT_FALSE(SdpDeserialize(sdp_with_data, &jdesc_output)); 2152 EXPECT_FALSE(SdpDeserialize(sdp_with_data, &jdesc_output));
2155 // No crash is a pass. 2153 // No crash is a pass.
2156 } 2154 }
2157 2155
2158 TEST_F(WebRtcSdpTest, DeserializeSdpWithSctpDataChannelAndNewPort) { 2156 TEST_F(WebRtcSdpTest, DeserializeSdpWithSctpDataChannelAndNewPort) {
2159 AddSctpDataChannel(); 2157 AddSctpDataChannel();
2160 const uint16 kUnusualSctpPort = 9556; 2158 const uint16_t kUnusualSctpPort = 9556;
2161 char default_portstr[16]; 2159 char default_portstr[16];
2162 char unusual_portstr[16]; 2160 char unusual_portstr[16];
2163 rtc::sprintfn(default_portstr, sizeof(default_portstr), "%d", 2161 rtc::sprintfn(default_portstr, sizeof(default_portstr), "%d",
2164 kDefaultSctpPort); 2162 kDefaultSctpPort);
2165 rtc::sprintfn(unusual_portstr, sizeof(unusual_portstr), "%d", 2163 rtc::sprintfn(unusual_portstr, sizeof(unusual_portstr), "%d",
2166 kUnusualSctpPort); 2164 kUnusualSctpPort);
2167 2165
2168 // First setup the expected JsepSessionDescription. 2166 // First setup the expected JsepSessionDescription.
2169 JsepSessionDescription jdesc(kDummyString); 2167 JsepSessionDescription jdesc(kDummyString);
2170 // take our pre-built session description and change the SCTP port. 2168 // take our pre-built session description and change the SCTP port.
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 const cricket::MediaContentDescription* mdesc = 2662 const cricket::MediaContentDescription* mdesc =
2665 static_cast<const cricket::MediaContentDescription*>( 2663 static_cast<const cricket::MediaContentDescription*>(
2666 desc->contents()[i].description); 2664 desc->contents()[i].description);
2667 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); 2665 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type());
2668 } 2666 }
2669 2667
2670 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); 2668 std::string serialized_sdp = webrtc::SdpSerialize(jdesc);
2671 EXPECT_EQ(sdp_string, serialized_sdp); 2669 EXPECT_EQ(sdp_string, serialized_sdp);
2672 } 2670 }
2673 } 2671 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsdp.cc ('k') | talk/app/webrtc/webrtcsession.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698