| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/hpack_encoder.h" | 5 #include "net/spdy/hpack_encoder.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 void TakeString(string* out) { | 57 void TakeString(string* out) { |
| 58 encoder_->output_stream_.TakeString(out); | 58 encoder_->output_stream_.TakeString(out); |
| 59 } | 59 } |
| 60 void UpdateCharacterCounts(StringPiece str) { | 60 void UpdateCharacterCounts(StringPiece str) { |
| 61 encoder_->UpdateCharacterCounts(str); | 61 encoder_->UpdateCharacterCounts(str); |
| 62 } | 62 } |
| 63 static void CookieToCrumbs(StringPiece cookie, | 63 static void CookieToCrumbs(StringPiece cookie, |
| 64 std::vector<StringPiece>* out) { | 64 std::vector<StringPiece>* out) { |
| 65 Representations tmp; | 65 Representations tmp; |
| 66 HpackEncoder::CookieToCrumbs(make_pair("", cookie), &tmp); | 66 HpackEncoder::CookieToCrumbs(std::make_pair("", cookie), &tmp); |
| 67 | 67 |
| 68 out->clear(); | 68 out->clear(); |
| 69 for (size_t i = 0; i != tmp.size(); ++i) { | 69 for (size_t i = 0; i != tmp.size(); ++i) { |
| 70 out->push_back(tmp[i].second); | 70 out->push_back(tmp[i].second); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 static void DecomposeRepresentation(StringPiece value, | 73 static void DecomposeRepresentation(StringPiece value, |
| 74 std::vector<StringPiece>* out) { | 74 std::vector<StringPiece>* out) { |
| 75 Representations tmp; | 75 Representations tmp; |
| 76 HpackEncoder::DecomposeRepresentation(make_pair("foobar", value), &tmp); | 76 HpackEncoder::DecomposeRepresentation(std::make_pair("foobar", value), |
| 77 &tmp); |
| 77 | 78 |
| 78 out->clear(); | 79 out->clear(); |
| 79 for (size_t i = 0; i != tmp.size(); ++i) { | 80 for (size_t i = 0; i != tmp.size(); ++i) { |
| 80 out->push_back(tmp[i].second); | 81 out->push_back(tmp[i].second); |
| 81 } | 82 } |
| 82 } | 83 } |
| 83 | 84 |
| 84 private: | 85 private: |
| 85 HpackEncoder* encoder_; | 86 HpackEncoder* encoder_; |
| 86 }; | 87 }; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 expected_.AppendUint32(62); | 463 expected_.AppendUint32(62); |
| 463 expected_.AppendPrefix(kStringLiteralIdentityEncoded); | 464 expected_.AppendPrefix(kStringLiteralIdentityEncoded); |
| 464 expected_.AppendUint32(3); | 465 expected_.AppendUint32(3); |
| 465 expected_.AppendBytes("bar"); | 466 expected_.AppendBytes("bar"); |
| 466 CompareWithExpectedEncoding(headers); | 467 CompareWithExpectedEncoding(headers); |
| 467 } | 468 } |
| 468 | 469 |
| 469 } // namespace | 470 } // namespace |
| 470 | 471 |
| 471 } // namespace net | 472 } // namespace net |
| OLD | NEW |