OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <memory> | 5 #include <memory> |
6 #include <ostream> | 6 #include <ostream> |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 | 126 |
127 } // namespace | 127 } // namespace |
128 | 128 |
129 // Helper class to encapsulate MockReads and MockWrites for QUIC. | 129 // Helper class to encapsulate MockReads and MockWrites for QUIC. |
130 // Simplify ownership issues and the interaction with the MockSocketFactory. | 130 // Simplify ownership issues and the interaction with the MockSocketFactory. |
131 class MockQuicData { | 131 class MockQuicData { |
132 public: | 132 public: |
133 MockQuicData() : packet_number_(0) {} | 133 MockQuicData() : packet_number_(0) {} |
134 | 134 |
135 ~MockQuicData() { STLDeleteElements(&packets_); } | 135 ~MockQuicData() { base::STLDeleteElements(&packets_); } |
136 | 136 |
137 void AddSynchronousRead(std::unique_ptr<QuicEncryptedPacket> packet) { | 137 void AddSynchronousRead(std::unique_ptr<QuicEncryptedPacket> packet) { |
138 reads_.push_back(MockRead(SYNCHRONOUS, packet->data(), packet->length(), | 138 reads_.push_back(MockRead(SYNCHRONOUS, packet->data(), packet->length(), |
139 packet_number_++)); | 139 packet_number_++)); |
140 packets_.push_back(packet.release()); | 140 packets_.push_back(packet.release()); |
141 } | 141 } |
142 | 142 |
143 void AddRead(std::unique_ptr<QuicEncryptedPacket> packet) { | 143 void AddRead(std::unique_ptr<QuicEncryptedPacket> packet) { |
144 reads_.push_back( | 144 reads_.push_back( |
145 MockRead(ASYNC, packet->data(), packet->length(), packet_number_++)); | 145 MockRead(ASYNC, packet->data(), packet->length(), packet_number_++)); |
(...skipping 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2775 AddHangingSocketData(); | 2775 AddHangingSocketData(); |
2776 | 2776 |
2777 SendRequestAndExpectQuicResponse(origin1_); | 2777 SendRequestAndExpectQuicResponse(origin1_); |
2778 SendRequestAndExpectQuicResponse(origin2_); | 2778 SendRequestAndExpectQuicResponse(origin2_); |
2779 | 2779 |
2780 EXPECT_TRUE(AllDataConsumed()); | 2780 EXPECT_TRUE(AllDataConsumed()); |
2781 } | 2781 } |
2782 | 2782 |
2783 } // namespace test | 2783 } // namespace test |
2784 } // namespace net | 2784 } // namespace net |
OLD | NEW |