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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 std::string SpdyTestUtil::ConstructSpdyReplyString( | 862 std::string SpdyTestUtil::ConstructSpdyReplyString( |
863 const SpdyHeaderBlock& headers) const { | 863 const SpdyHeaderBlock& headers) const { |
864 std::string reply_string; | 864 std::string reply_string; |
865 for (SpdyHeaderBlock::const_iterator it = headers.begin(); | 865 for (SpdyHeaderBlock::const_iterator it = headers.begin(); |
866 it != headers.end(); ++it) { | 866 it != headers.end(); ++it) { |
867 std::string key = it->first; | 867 std::string key = it->first; |
868 // Remove leading colon from "special" headers (for SPDY3 and | 868 // Remove leading colon from "special" headers (for SPDY3 and |
869 // above). | 869 // above). |
870 if (spdy_version() >= SPDY3 && key[0] == ':') | 870 if (spdy_version() >= SPDY3 && key[0] == ':') |
871 key = key.substr(1); | 871 key = key.substr(1); |
872 std::vector<std::string> values; | 872 for (const std::string& value : |
873 base::SplitString(it->second, '\0', &values); | 873 base::SplitString(it->second, base::StringPiece("\0", 1), |
874 for (std::vector<std::string>::const_iterator it2 = values.begin(); | 874 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
875 it2 != values.end(); ++it2) { | 875 reply_string += key + ": " + value + "\n"; |
876 reply_string += key + ": " + *it2 + "\n"; | |
877 } | 876 } |
878 } | 877 } |
879 return reply_string; | 878 return reply_string; |
880 } | 879 } |
881 | 880 |
882 // TODO(jgraettinger): Eliminate uses of this method in tests (prefer | 881 // TODO(jgraettinger): Eliminate uses of this method in tests (prefer |
883 // SpdySettingsIR). | 882 // SpdySettingsIR). |
884 SpdyFrame* SpdyTestUtil::ConstructSpdySettings( | 883 SpdyFrame* SpdyTestUtil::ConstructSpdySettings( |
885 const SettingsMap& settings) const { | 884 const SettingsMap& settings) const { |
886 SpdySettingsIR settings_ir; | 885 SpdySettingsIR settings_ir; |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 } | 1329 } |
1331 } | 1330 } |
1332 | 1331 |
1333 void SpdyTestUtil::SetPriority(RequestPriority priority, | 1332 void SpdyTestUtil::SetPriority(RequestPriority priority, |
1334 SpdySynStreamIR* ir) const { | 1333 SpdySynStreamIR* ir) const { |
1335 ir->set_priority(ConvertRequestPriorityToSpdyPriority( | 1334 ir->set_priority(ConvertRequestPriorityToSpdyPriority( |
1336 priority, spdy_version())); | 1335 priority, spdy_version())); |
1337 } | 1336 } |
1338 | 1337 |
1339 } // namespace net | 1338 } // namespace net |
OLD | NEW |