| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/spdy/spdy_test_util_common.h" | 5 #include "net/spdy/spdy_test_util_common.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 return response_spdy_framer_.SerializeFrame(spdy_headers); | 1036 return response_spdy_framer_.SerializeFrame(spdy_headers); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, | 1039 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, |
| 1040 const SpdyHeaderBlock& block, | 1040 const SpdyHeaderBlock& block, |
| 1041 RequestPriority priority, | 1041 RequestPriority priority, |
| 1042 bool fin) { | 1042 bool fin) { |
| 1043 // Get the stream id of the next highest priority request | 1043 // Get the stream id of the next highest priority request |
| 1044 // (most recent request of the same priority, or last request of | 1044 // (most recent request of the same priority, or last request of |
| 1045 // an earlier priority). | 1045 // an earlier priority). |
| 1046 // Note that this is a duplicate of the logic in Http2PriorityDependencies, |
| 1047 // and hence tests using this function do not effectively test that logic. |
| 1048 // That logic is tested by the Http2PriorityDependencies unit tests. |
| 1046 int parent_stream_id = 0; | 1049 int parent_stream_id = 0; |
| 1047 for (int q = priority; q >= IDLE; --q) { | 1050 for (int q = priority; q <= HIGHEST; ++q) { |
| 1048 if (!priority_to_stream_id_list_[q].empty()) { | 1051 if (!priority_to_stream_id_list_[q].empty()) { |
| 1049 parent_stream_id = priority_to_stream_id_list_[q].back(); | 1052 parent_stream_id = priority_to_stream_id_list_[q].back(); |
| 1050 break; | 1053 break; |
| 1051 } | 1054 } |
| 1052 } | 1055 } |
| 1053 | 1056 |
| 1054 priority_to_stream_id_list_[priority].push_back(stream_id); | 1057 priority_to_stream_id_list_[priority].push_back(stream_id); |
| 1055 | 1058 |
| 1056 if (protocol_ < kProtoHTTP2) { | 1059 if (protocol_ < kProtoHTTP2) { |
| 1057 SpdySynStreamIR syn_stream(stream_id); | 1060 SpdySynStreamIR syn_stream(stream_id); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 } | 1272 } |
| 1270 } | 1273 } |
| 1271 | 1274 |
| 1272 void SpdyTestUtil::SetPriority(RequestPriority priority, | 1275 void SpdyTestUtil::SetPriority(RequestPriority priority, |
| 1273 SpdySynStreamIR* ir) const { | 1276 SpdySynStreamIR* ir) const { |
| 1274 ir->set_priority(ConvertRequestPriorityToSpdyPriority( | 1277 ir->set_priority(ConvertRequestPriorityToSpdyPriority( |
| 1275 priority, spdy_version())); | 1278 priority, spdy_version())); |
| 1276 } | 1279 } |
| 1277 | 1280 |
| 1278 } // namespace net | 1281 } // namespace net |
| OLD | NEW |