| 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 <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "webrtc/base/gunit.h" | |
| 15 #include "webrtc/base/logging.h" | |
| 16 #include "webrtc/base/ptr_util.h" | |
| 17 #include "webrtc/base/testclient.h" | |
| 18 #include "webrtc/base/thread.h" | |
| 19 #include "webrtc/base/virtualsocketserver.h" | |
| 20 #include "webrtc/p2p/base/stunserver.h" | 14 #include "webrtc/p2p/base/stunserver.h" |
| 15 #include "webrtc/rtc_base/gunit.h" |
| 16 #include "webrtc/rtc_base/logging.h" |
| 17 #include "webrtc/rtc_base/ptr_util.h" |
| 18 #include "webrtc/rtc_base/testclient.h" |
| 19 #include "webrtc/rtc_base/thread.h" |
| 20 #include "webrtc/rtc_base/virtualsocketserver.h" |
| 21 | 21 |
| 22 using namespace cricket; | 22 using namespace cricket; |
| 23 | 23 |
| 24 static const rtc::SocketAddress server_addr("99.99.99.1", 3478); | 24 static const rtc::SocketAddress server_addr("99.99.99.1", 3478); |
| 25 static const rtc::SocketAddress client_addr("1.2.3.4", 1234); | 25 static const rtc::SocketAddress client_addr("1.2.3.4", 1234); |
| 26 | 26 |
| 27 class StunServerTest : public testing::Test { | 27 class StunServerTest : public testing::Test { |
| 28 public: | 28 public: |
| 29 StunServerTest() : ss_(new rtc::VirtualSocketServer()), network_(ss_.get()) {} | 29 StunServerTest() : ss_(new rtc::VirtualSocketServer()), network_(ss_.get()) {} |
| 30 virtual void SetUp() { | 30 virtual void SetUp() { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 #endif // if !defined(THREAD_SANITIZER) | 98 #endif // if !defined(THREAD_SANITIZER) |
| 99 | 99 |
| 100 TEST_F(StunServerTest, TestBad) { | 100 TEST_F(StunServerTest, TestBad) { |
| 101 const char* bad = "this is a completely nonsensical message whose only " | 101 const char* bad = "this is a completely nonsensical message whose only " |
| 102 "purpose is to make the parser go 'ack'. it doesn't " | 102 "purpose is to make the parser go 'ack'. it doesn't " |
| 103 "look anything like a normal stun message"; | 103 "look anything like a normal stun message"; |
| 104 Send(bad, static_cast<int>(strlen(bad))); | 104 Send(bad, static_cast<int>(strlen(bad))); |
| 105 | 105 |
| 106 ASSERT_TRUE(ReceiveFails()); | 106 ASSERT_TRUE(ReceiveFails()); |
| 107 } | 107 } |
| OLD | NEW |