| 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 "net/quic/quic_client_session.h" | 5 #include "net/quic/quic_client_session.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "net/base/capturing_net_log.h" | 10 #include "net/base/capturing_net_log.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 class TestPacketWriter : public QuicDefaultPacketWriter { | 34 class TestPacketWriter : public QuicDefaultPacketWriter { |
| 35 public: | 35 public: |
| 36 TestPacketWriter(QuicVersion version) : version_(version) { | 36 TestPacketWriter(QuicVersion version) : version_(version) { |
| 37 } | 37 } |
| 38 | 38 |
| 39 // QuicPacketWriter | 39 // QuicPacketWriter |
| 40 virtual WriteResult WritePacket( | 40 virtual WriteResult WritePacket( |
| 41 const char* buffer, size_t buf_len, | 41 const char* buffer, size_t buf_len, |
| 42 const IPAddressNumber& self_address, | 42 const IPAddressNumber& self_address, |
| 43 const IPEndPoint& peer_address) OVERRIDE { | 43 const IPEndPoint& peer_address, |
| 44 base::Callback<void(WriteResult wr)> callback) OVERRIDE { |
| 44 SimpleQuicFramer framer(SupportedVersions(version_)); | 45 SimpleQuicFramer framer(SupportedVersions(version_)); |
| 45 QuicEncryptedPacket packet(buffer, buf_len); | 46 QuicEncryptedPacket packet(buffer, buf_len); |
| 46 EXPECT_TRUE(framer.ProcessPacket(packet)); | 47 EXPECT_TRUE(framer.ProcessPacket(packet)); |
| 47 header_ = framer.header(); | 48 header_ = framer.header(); |
| 48 return WriteResult(WRITE_STATUS_OK, packet.length()); | 49 return WriteResult(WRITE_STATUS_OK, packet.length()); |
| 49 } | 50 } |
| 50 | 51 |
| 51 virtual bool IsWriteBlockedDataBuffered() const OVERRIDE { | 52 virtual bool IsWriteBlockedDataBuffered() const OVERRIDE { |
| 52 // Chrome sockets' Write() methods buffer the data until the Write is | 53 // Chrome sockets' Write() methods buffer the data until the Write is |
| 53 // permitted. | 54 // permitted. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 165 |
| 165 // After receiving a GoAway, I should no longer be able to create outgoing | 166 // After receiving a GoAway, I should no longer be able to create outgoing |
| 166 // streams. | 167 // streams. |
| 167 session_.OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); | 168 session_.OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); |
| 168 EXPECT_EQ(NULL, session_.CreateOutgoingDataStream()); | 169 EXPECT_EQ(NULL, session_.CreateOutgoingDataStream()); |
| 169 } | 170 } |
| 170 | 171 |
| 171 } // namespace | 172 } // namespace |
| 172 } // namespace test | 173 } // namespace test |
| 173 } // namespace net | 174 } // namespace net |
| OLD | NEW |