OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <string> | 6 #include <string> |
7 #include <sys/epoll.h> | 7 #include <sys/epoll.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 using net::tools::test::QuicServerPeer; | 63 using net::tools::test::QuicServerPeer; |
64 using std::ostream; | 64 using std::ostream; |
65 using std::string; | 65 using std::string; |
66 using std::vector; | 66 using std::vector; |
67 | 67 |
68 namespace net { | 68 namespace net { |
69 namespace tools { | 69 namespace tools { |
70 namespace test { | 70 namespace test { |
71 namespace { | 71 namespace { |
72 | 72 |
73 const char* kFooResponseBody = "Artichoke hearts make me happy."; | 73 const char kFooResponseBody[] = "Artichoke hearts make me happy."; |
74 const char* kBarResponseBody = "Palm hearts are pretty delicious, also."; | 74 const char kBarResponseBody[] = "Palm hearts are pretty delicious, also."; |
75 | 75 |
76 // Run all tests with the cross products of all versions. | 76 // Run all tests with the cross products of all versions. |
77 struct TestParams { | 77 struct TestParams { |
78 TestParams(const QuicVersionVector& client_supported_versions, | 78 TestParams(const QuicVersionVector& client_supported_versions, |
79 const QuicVersionVector& server_supported_versions, | 79 const QuicVersionVector& server_supported_versions, |
80 QuicVersion negotiated_version, | 80 QuicVersion negotiated_version, |
81 bool use_pacing, | 81 bool use_pacing, |
82 bool use_fec, | 82 bool use_fec, |
83 QuicTag congestion_control_tag) | 83 QuicTag congestion_control_tag) |
84 : client_supported_versions(client_supported_versions), | 84 : client_supported_versions(client_supported_versions), |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 for (int use_pacing = 0; use_pacing < 2; ++use_pacing) { | 135 for (int use_pacing = 0; use_pacing < 2; ++use_pacing) { |
136 for (int spdy_version = 3; spdy_version <= 4; ++spdy_version) { | 136 for (int spdy_version = 3; spdy_version <= 4; ++spdy_version) { |
137 const QuicVersionVector* client_versions = | 137 const QuicVersionVector* client_versions = |
138 spdy_version == 3 ? &spdy3_versions : &spdy4_versions; | 138 spdy_version == 3 ? &spdy3_versions : &spdy4_versions; |
139 // Add an entry for server and client supporting all versions. | 139 // Add an entry for server and client supporting all versions. |
140 params.push_back(TestParams(*client_versions, all_supported_versions, | 140 params.push_back(TestParams(*client_versions, all_supported_versions, |
141 (*client_versions)[0], use_pacing != 0, | 141 (*client_versions)[0], use_pacing != 0, |
142 use_fec != 0, congestion_control_tag)); | 142 use_fec != 0, congestion_control_tag)); |
143 | 143 |
144 // Test client supporting all versions and server supporting 1 | 144 // Test client supporting all versions and server supporting 1 |
145 // version. | 145 // version. Simulate an old server and exercise version downgrade in |
146 // Simulate an old server and exercise version downgrade in the | 146 // the client. Protocol negotiation should occur. Skip the i = 0 case |
147 // client. | 147 // because it is essentially the same as the default case. |
148 // Protocol negotiation should occur. Skip the i = 0 case because it | |
149 // is | |
150 // essentially the same as the default case. | |
151 for (QuicVersion version : *client_versions) { | 148 for (QuicVersion version : *client_versions) { |
152 QuicVersionVector server_supported_versions; | 149 QuicVersionVector server_supported_versions; |
153 server_supported_versions.push_back(version); | 150 server_supported_versions.push_back(version); |
154 params.push_back( | 151 params.push_back( |
155 TestParams(*client_versions, server_supported_versions, | 152 TestParams(*client_versions, server_supported_versions, |
156 server_supported_versions[0], use_pacing != 0, | 153 server_supported_versions[0], use_pacing != 0, |
157 use_fec != 0, congestion_control_tag)); | 154 use_fec != 0, congestion_control_tag)); |
158 } | 155 } |
159 } | 156 } |
160 } | 157 } |
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 // Waits for up to 50 ms. | 1446 // Waits for up to 50 ms. |
1450 client_->client()->WaitForEvents(); | 1447 client_->client()->WaitForEvents(); |
1451 } | 1448 } |
1452 server_thread_->Resume(); | 1449 server_thread_->Resume(); |
1453 } | 1450 } |
1454 | 1451 |
1455 } // namespace | 1452 } // namespace |
1456 } // namespace test | 1453 } // namespace test |
1457 } // namespace tools | 1454 } // namespace tools |
1458 } // namespace net | 1455 } // namespace net |
OLD | NEW |