| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 QuicTag congestion_control_tag; | 110 QuicTag congestion_control_tag; |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 // Constructs various test permutations. | 113 // Constructs various test permutations. |
| 114 vector<TestParams> GetTestParams() { | 114 vector<TestParams> GetTestParams() { |
| 115 vector<TestParams> params; | 115 vector<TestParams> params; |
| 116 QuicVersionVector all_supported_versions = QuicSupportedVersions(); | 116 QuicVersionVector all_supported_versions = QuicSupportedVersions(); |
| 117 // TODO(rtenneti): Add kTBBR after BBR code is checked in. | 117 // TODO(rtenneti): Add kTBBR after BBR code is checked in. |
| 118 // QuicTag congestion_control_tags[] = {kRENO, kTBBR, kQBIC}; | 118 // QuicTag congestion_control_tags[] = {kRENO, kTBBR, kQBIC}; |
| 119 QuicTag congestion_control_tags[] = {kRENO, kQBIC}; | 119 QuicTag congestion_control_tags[] = {kRENO, kQBIC}; |
| 120 QuicVersionVector spdy3_versions; |
| 121 QuicVersionVector spdy4_versions; |
| 122 for (QuicVersion version : all_supported_versions) { |
| 123 if (version > QUIC_VERSION_23) { |
| 124 spdy4_versions.push_back(version); |
| 125 } else { |
| 126 spdy3_versions.push_back(version); |
| 127 } |
| 128 } |
| 120 for (size_t congestion_control_index = 0; | 129 for (size_t congestion_control_index = 0; |
| 121 congestion_control_index < arraysize(congestion_control_tags); | 130 congestion_control_index < arraysize(congestion_control_tags); |
| 122 congestion_control_index++) { | 131 congestion_control_index++) { |
| 123 QuicTag congestion_control_tag = | 132 QuicTag congestion_control_tag = |
| 124 congestion_control_tags[congestion_control_index]; | 133 congestion_control_tags[congestion_control_index]; |
| 125 for (int use_fec = 0; use_fec < 2; ++use_fec) { | 134 for (int use_fec = 0; use_fec < 2; ++use_fec) { |
| 126 for (int use_pacing = 0; use_pacing < 2; ++use_pacing) { | 135 for (int use_pacing = 0; use_pacing < 2; ++use_pacing) { |
| 127 // Add an entry for server and client supporting all versions. | 136 for (int spdy_version = 3; spdy_version <= 4; ++spdy_version) { |
| 128 params.push_back(TestParams(all_supported_versions, | 137 const QuicVersionVector* client_versions = |
| 129 all_supported_versions, | 138 spdy_version == 3 ? &spdy3_versions : &spdy4_versions; |
| 130 all_supported_versions[0], | 139 // Add an entry for server and client supporting all versions. |
| 131 use_pacing != 0, | 140 params.push_back(TestParams(*client_versions, all_supported_versions, |
| 132 use_fec != 0, | 141 (*client_versions)[0], use_pacing != 0, |
| 133 congestion_control_tag)); | 142 use_fec != 0, congestion_control_tag)); |
| 134 | 143 |
| 135 // Test client supporting all versions and server supporting 1 version. | 144 // Test client supporting all versions and server supporting 1 |
| 136 // Simulate an old server and exercise version downgrade in the client. | 145 // version. |
| 137 // Protocol negotiation should occur. Skip the i = 0 case because it is | 146 // Simulate an old server and exercise version downgrade in the |
| 138 // essentially the same as the default case. | 147 // client. |
| 139 for (size_t i = 1; i < all_supported_versions.size(); ++i) { | 148 // Protocol negotiation should occur. Skip the i = 0 case because it |
| 140 QuicVersionVector server_supported_versions; | 149 // is |
| 141 server_supported_versions.push_back(all_supported_versions[i]); | 150 // essentially the same as the default case. |
| 142 params.push_back(TestParams(all_supported_versions, | 151 for (QuicVersion version : *client_versions) { |
| 143 server_supported_versions, | 152 QuicVersionVector server_supported_versions; |
| 144 server_supported_versions[0], | 153 server_supported_versions.push_back(version); |
| 145 use_pacing != 0, | 154 params.push_back( |
| 146 use_fec != 0, | 155 TestParams(*client_versions, server_supported_versions, |
| 147 congestion_control_tag)); | 156 server_supported_versions[0], use_pacing != 0, |
| 157 use_fec != 0, congestion_control_tag)); |
| 158 } |
| 148 } | 159 } |
| 149 } | 160 } |
| 150 } | 161 } |
| 151 } | 162 } |
| 152 return params; | 163 return params; |
| 153 } | 164 } |
| 154 | 165 |
| 155 class ServerDelegate : public PacketDroppingTestWriter::Delegate { | 166 class ServerDelegate : public PacketDroppingTestWriter::Delegate { |
| 156 public: | 167 public: |
| 157 ServerDelegate(TestWriterFactory* writer_factory, | 168 ServerDelegate(TestWriterFactory* writer_factory, |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1438 // Waits for up to 50 ms. | 1449 // Waits for up to 50 ms. |
| 1439 client_->client()->WaitForEvents(); | 1450 client_->client()->WaitForEvents(); |
| 1440 } | 1451 } |
| 1441 server_thread_->Resume(); | 1452 server_thread_->Resume(); |
| 1442 } | 1453 } |
| 1443 | 1454 |
| 1444 } // namespace | 1455 } // namespace |
| 1445 } // namespace test | 1456 } // namespace test |
| 1446 } // namespace tools | 1457 } // namespace tools |
| 1447 } // namespace net | 1458 } // namespace net |
| OLD | NEW |