Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: net/quic/quic_client_session_test.cc

Issue 340433002: Port QuicServer to Chrome network stack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments and fix blocked writers using callbacks Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/quic/quic_connection.h » ('j') | net/quic/quic_connection.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698