| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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, |
| 11 * this list of conditions and the following disclaimer in the documentation | 11 * this list of conditions and the following disclaimer in the documentation |
| 12 * and/or other materials provided with the distribution. | 12 * and/or other materials provided with the distribution. |
| 13 * 3. The name of the author may not be used to endorse or promote products | 13 * 3. The name of the author may not be used to endorse or promote products |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 rtc::Buffer packet; | 152 rtc::Buffer packet; |
| 153 webrtc::WriteDataChannelOpenAckMessage(&packet); | 153 webrtc::WriteDataChannelOpenAckMessage(&packet); |
| 154 | 154 |
| 155 uint8_t message_type; | 155 uint8_t message_type; |
| 156 rtc::ByteBuffer buffer(packet.data(), packet.length()); | 156 rtc::ByteBuffer buffer(packet.data(), packet.length()); |
| 157 ASSERT_TRUE(buffer.ReadUInt8(&message_type)); | 157 ASSERT_TRUE(buffer.ReadUInt8(&message_type)); |
| 158 EXPECT_EQ(0x02, message_type); | 158 EXPECT_EQ(0x02, message_type); |
| 159 | 159 |
| 160 EXPECT_TRUE(webrtc::ParseDataChannelOpenAckMessage(packet)); | 160 EXPECT_TRUE(webrtc::ParseDataChannelOpenAckMessage(packet)); |
| 161 } | 161 } |
| 162 | |
| 163 TEST_F(SctpUtilsTest, TestIsOpenMessage) { | |
| 164 rtc::ByteBuffer open; | |
| 165 open.WriteUInt8(0x03); | |
| 166 EXPECT_TRUE(webrtc::IsOpenMessage(open)); | |
| 167 | |
| 168 rtc::ByteBuffer openAck; | |
| 169 openAck.WriteUInt8(0x02); | |
| 170 EXPECT_FALSE(webrtc::IsOpenMessage(open)); | |
| 171 | |
| 172 rtc::ByteBuffer invalid; | |
| 173 openAck.WriteUInt8(0x01); | |
| 174 EXPECT_FALSE(webrtc::IsOpenMessage(invalid)); | |
| 175 | |
| 176 rtc::ByteBuffer empty; | |
| 177 EXPECT_FALSE(webrtc::IsOpenMessage(empty)); | |
| 178 } | |
| OLD | NEW |