OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.h" | 5 #include "net/spdy/spdy_test_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 DCHECK_LE(total_len, buff_len); | 738 DCHECK_LE(total_len, buff_len); |
739 char* ptr = buff; | 739 char* ptr = buff; |
740 for (int i = 0; i < num_frames; ++i) { | 740 for (int i = 0; i < num_frames; ++i) { |
741 int len = frames[i]->length() + spdy::SpdyFrame::size(); | 741 int len = frames[i]->length() + spdy::SpdyFrame::size(); |
742 memcpy(ptr, frames[i]->data(), len); | 742 memcpy(ptr, frames[i]->data(), len); |
743 ptr += len; | 743 ptr += len; |
744 } | 744 } |
745 return total_len; | 745 return total_len; |
746 } | 746 } |
747 | 747 |
748 // This creates a proxy for testing purposes. | |
749 // |proxy| should be in the form "myproxy:70". | |
750 ProxyService* SpdyCreateFixedProxyService(const std::string& proxy) { | |
751 net::ProxyConfig proxy_config; | |
752 proxy_config.proxy_rules().ParseFromString(proxy); | |
753 return ProxyService::CreateFixed(proxy_config); | |
754 } | |
755 | |
756 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type) { | 748 const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type) { |
757 const SpdyHeaderInfo kHeader = { | 749 const SpdyHeaderInfo kHeader = { |
758 type, // Kind = Syn | 750 type, // Kind = Syn |
759 1, // Stream ID | 751 1, // Stream ID |
760 0, // Associated stream ID | 752 0, // Associated stream ID |
761 2, // Priority | 753 2, // Priority |
762 spdy::CONTROL_FLAG_FIN, // Control Flags | 754 spdy::CONTROL_FLAG_FIN, // Control Flags |
763 false, // Compressed | 755 false, // Compressed |
764 spdy::INVALID, // Status | 756 spdy::INVALID, // Status |
765 NULL, // Data | 757 NULL, // Data |
766 0, // Length | 758 0, // Length |
767 spdy::DATA_FLAG_NONE // Data Flags | 759 spdy::DATA_FLAG_NONE // Data Flags |
768 }; | 760 }; |
769 return kHeader; | 761 return kHeader; |
770 } | 762 } |
771 } // namespace net | 763 } // namespace net |
OLD | NEW |