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 <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 pool_->enable_sending_initial_settings_ = enabled; | 510 pool_->enable_sending_initial_settings_ = enabled; |
511 } | 511 } |
512 | 512 |
513 NextProto NextProtoFromSpdyVersion(int spdy_version) { | 513 NextProto NextProtoFromSpdyVersion(int spdy_version) { |
514 switch (spdy_version) { | 514 switch (spdy_version) { |
515 case kSpdyVersion2: | 515 case kSpdyVersion2: |
516 return kProtoSPDY2; | 516 return kProtoSPDY2; |
517 case kSpdyVersion3: | 517 case kSpdyVersion3: |
518 return kProtoSPDY3; | 518 return kProtoSPDY3; |
519 case kSpdyVersion4: | 519 case kSpdyVersion4: |
520 return kProtoSPDY4a1; | 520 return kProtoSPDY4a2; |
521 default: | 521 default: |
522 NOTREACHED(); | 522 NOTREACHED(); |
523 return kProtoUnknown; | 523 return kProtoUnknown; |
524 } | 524 } |
525 } | 525 } |
526 | 526 |
527 int SpdyVersionFromNextProto(NextProto next_proto) { | 527 int SpdyVersionFromNextProto(NextProto next_proto) { |
528 switch (next_proto) { | 528 switch (next_proto) { |
529 case kProtoSPDY2: | 529 case kProtoSPDY2: |
530 case kProtoSPDY21: | 530 case kProtoSPDY21: |
531 return kSpdyVersion2; | 531 return kSpdyVersion2; |
532 case kProtoSPDY3: | 532 case kProtoSPDY3: |
533 case kProtoSPDY31: | 533 case kProtoSPDY31: |
534 return kSpdyVersion3; | 534 return kSpdyVersion3; |
535 case kProtoSPDY4a1: | 535 case kProtoSPDY4a2: |
536 return kSpdyVersion4; | 536 return kSpdyVersion4; |
537 default: | 537 default: |
538 NOTREACHED(); | 538 NOTREACHED(); |
539 return 0; | 539 return 0; |
540 } | 540 } |
541 } | 541 } |
542 | 542 |
543 SpdyTestUtil::SpdyTestUtil(NextProto protocol) | 543 SpdyTestUtil::SpdyTestUtil(NextProto protocol) |
544 : protocol_(protocol), | 544 : protocol_(protocol), |
545 spdy_version_(SpdyVersionFromNextProto(protocol)) { | 545 spdy_version_(SpdyVersionFromNextProto(protocol)) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 DATA_FLAG_NONE | 659 DATA_FLAG_NONE |
660 }; | 660 }; |
661 scoped_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock()); | 661 scoped_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock()); |
662 AppendToHeaderBlock(extra_headers, extra_header_count, headers.get()); | 662 AppendToHeaderBlock(extra_headers, extra_header_count, headers.get()); |
663 if (kHeaders && kHeadersSize) | 663 if (kHeaders && kHeadersSize) |
664 AppendToHeaderBlock(kHeaders, kHeadersSize / 2, headers.get()); | 664 AppendToHeaderBlock(kHeaders, kHeadersSize / 2, headers.get()); |
665 return ConstructSpdyFrame(kSynStartHeader, headers.Pass()); | 665 return ConstructSpdyFrame(kSynStartHeader, headers.Pass()); |
666 } | 666 } |
667 | 667 |
668 } // namespace net | 668 } // namespace net |
OLD | NEW |