| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "webrtc/p2p/base/stun.h" | 13 #include "webrtc/p2p/base/stun.h" |
| 14 #include "webrtc/base/arraysize.h" | 14 #include "webrtc/base/arraysize.h" |
| 15 #include "webrtc/base/bytebuffer.h" | 15 #include "webrtc/base/bytebuffer.h" |
| 16 #include "webrtc/base/gunit.h" | 16 #include "webrtc/base/gunit.h" |
| 17 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
| 18 #include "webrtc/base/messagedigest.h" | 18 #include "webrtc/base/messagedigest.h" |
| 19 #include "webrtc/base/scoped_ptr.h" | |
| 20 #include "webrtc/base/socketaddress.h" | 19 #include "webrtc/base/socketaddress.h" |
| 21 | 20 |
| 22 namespace cricket { | 21 namespace cricket { |
| 23 | 22 |
| 24 class StunTest : public ::testing::Test { | 23 class StunTest : public ::testing::Test { |
| 25 protected: | 24 protected: |
| 26 void CheckStunHeader(const StunMessage& msg, StunMessageType expected_type, | 25 void CheckStunHeader(const StunMessage& msg, StunMessageType expected_type, |
| 27 size_t expected_length) { | 26 size_t expected_length) { |
| 28 ASSERT_EQ(expected_type, msg.type()); | 27 ASSERT_EQ(expected_type, msg.type()); |
| 29 ASSERT_EQ(expected_length, msg.length()); | 28 ASSERT_EQ(expected_length, msg.length()); |
| (...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 EXPECT_TRUE(msg2.Write(&out2)); | 1445 EXPECT_TRUE(msg2.Write(&out2)); |
| 1447 EXPECT_EQ(size, out2.Length()); | 1446 EXPECT_EQ(size, out2.Length()); |
| 1448 size_t len2 = out2.Length(); | 1447 size_t len2 = out2.Length(); |
| 1449 rtc::ByteBufferReader read_buf2(out2); | 1448 rtc::ByteBufferReader read_buf2(out2); |
| 1450 std::string outstring2; | 1449 std::string outstring2; |
| 1451 read_buf2.ReadString(&outstring2, len2); | 1450 read_buf2.ReadString(&outstring2, len2); |
| 1452 EXPECT_EQ(0, memcmp(outstring2.c_str(), input, len2)); | 1451 EXPECT_EQ(0, memcmp(outstring2.c_str(), input, len2)); |
| 1453 } | 1452 } |
| 1454 | 1453 |
| 1455 } // namespace cricket | 1454 } // namespace cricket |
| OLD | NEW |