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

Side by Side Diff: net/tools/quic/quic_server_test.cc

Issue 2611613003: Add quic_logging (Closed)
Patch Set: fix failed test? Created 3 years, 11 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 | « net/tools/quic/quic_server.cc ('k') | net/tools/quic/quic_simple_server_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/tools/quic/quic_server.h" 5 #include "net/tools/quic/quic_server.h"
6 6
7 #include "net/quic/core/crypto/quic_random.h" 7 #include "net/quic/core/crypto/quic_random.h"
8 #include "net/quic/core/quic_utils.h" 8 #include "net/quic/core/quic_utils.h"
9 #include "net/quic/platform/api/quic_logging.h"
9 #include "net/quic/platform/api/quic_socket_address.h" 10 #include "net/quic/platform/api/quic_socket_address.h"
10 #include "net/quic/test_tools/crypto_test_utils.h" 11 #include "net/quic/test_tools/crypto_test_utils.h"
11 #include "net/quic/test_tools/mock_quic_dispatcher.h" 12 #include "net/quic/test_tools/mock_quic_dispatcher.h"
12 #include "net/tools/quic/quic_epoll_alarm_factory.h" 13 #include "net/tools/quic/quic_epoll_alarm_factory.h"
13 #include "net/tools/quic/quic_epoll_connection_helper.h" 14 #include "net/tools/quic/quic_epoll_connection_helper.h"
14 #include "net/tools/quic/quic_simple_crypto_server_stream_helper.h" 15 #include "net/tools/quic/quic_simple_crypto_server_stream_helper.h"
15 #include "net/tools/quic/test_tools/quic_server_peer.h" 16 #include "net/tools/quic/test_tools/quic_server_peer.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 using ::testing::_; 19 using ::testing::_;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 public: 81 public:
81 QuicServerEpollInTest() 82 QuicServerEpollInTest()
82 : port_(net::test::kTestPort), 83 : port_(net::test::kTestPort),
83 server_address_(QuicIpAddress::Loopback4(), port_) {} 84 server_address_(QuicIpAddress::Loopback4(), port_) {}
84 85
85 void StartListening() { 86 void StartListening() {
86 server_.CreateUDPSocketAndListen(server_address_); 87 server_.CreateUDPSocketAndListen(server_address_);
87 ASSERT_TRUE(QuicServerPeer::SetSmallSocket(&server_)); 88 ASSERT_TRUE(QuicServerPeer::SetSmallSocket(&server_));
88 89
89 if (!server_.overflow_supported()) { 90 if (!server_.overflow_supported()) {
90 LOG(WARNING) << "Overflow not supported. Not testing."; 91 QUIC_LOG(WARNING) << "Overflow not supported. Not testing.";
91 return; 92 return;
92 } 93 }
93 } 94 }
94 95
95 protected: 96 protected:
96 QuicFlagSaver saver_; 97 QuicFlagSaver saver_;
97 int port_; 98 int port_;
98 QuicSocketAddress server_address_; 99 QuicSocketAddress server_address_;
99 TestQuicServer server_; 100 TestQuicServer server_;
100 }; 101 };
(...skipping 25 matching lines...) Expand all
126 int fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP); 127 int fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP);
127 ASSERT_LT(0, fd); 128 ASSERT_LT(0, fd);
128 129
129 char buf[1024]; 130 char buf[1024];
130 memset(buf, 0, arraysize(buf)); 131 memset(buf, 0, arraysize(buf));
131 sockaddr_storage storage = server_address_.generic_address(); 132 sockaddr_storage storage = server_address_.generic_address();
132 socklen_t storage_size = sizeof(storage); 133 socklen_t storage_size = sizeof(storage);
133 int rc = sendto(fd, buf, arraysize(buf), 0, 134 int rc = sendto(fd, buf, arraysize(buf), 0,
134 reinterpret_cast<sockaddr*>(&storage), storage_size); 135 reinterpret_cast<sockaddr*>(&storage), storage_size);
135 if (rc < 0) { 136 if (rc < 0) {
136 DVLOG(1) << errno << " " << strerror(errno); 137 QUIC_DLOG(INFO) << errno << " " << strerror(errno);
137 } 138 }
138 139
139 while (more_chlos) { 140 while (more_chlos) {
140 server_.WaitForEvents(); 141 server_.WaitForEvents();
141 } 142 }
142 } 143 }
143 144
144 class QuicServerDispatchPacketTest : public ::testing::Test { 145 class QuicServerDispatchPacketTest : public ::testing::Test {
145 public: 146 public:
146 QuicServerDispatchPacketTest() 147 QuicServerDispatchPacketTest()
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 reinterpret_cast<char*>(valid_packet), arraysize(valid_packet), 198 reinterpret_cast<char*>(valid_packet), arraysize(valid_packet),
198 QuicTime::Zero(), false); 199 QuicTime::Zero(), false);
199 200
200 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1); 201 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1);
201 DispatchPacket(encrypted_valid_packet); 202 DispatchPacket(encrypted_valid_packet);
202 } 203 }
203 204
204 } // namespace 205 } // namespace
205 } // namespace test 206 } // namespace test
206 } // namespace net 207 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server.cc ('k') | net/tools/quic/quic_simple_server_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698