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

Unified Diff: net/quic/quic_framer_test.cc

Issue 123303003: Move all the packet parsing logic into QuicDispatcher from the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_framer.cc ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_framer_test.cc
diff --git a/net/quic/quic_framer_test.cc b/net/quic/quic_framer_test.cc
index 6fa07e093d9fd6badbe0c9fe2a048c8f88f42cce..6249bb2d40faa8259634020e7e20b0b396a8d341 100644
--- a/net/quic/quic_framer_test.cc
+++ b/net/quic/quic_framer_test.cc
@@ -188,7 +188,8 @@ class TestQuicVisitor : public ::net::QuicFramerVisitorInterface {
fec_count_(0),
complete_packets_(0),
revived_packets_(0),
- accept_packet_(true) {
+ accept_packet_(true),
+ accept_public_header_(true) {
}
virtual ~TestQuicVisitor() {
@@ -232,6 +233,12 @@ class TestQuicVisitor : public ::net::QuicFramerVisitorInterface {
return accept_packet_;
}
+ virtual bool OnUnauthenticatedPublicHeader(
+ const QuicPacketPublicHeader& header) OVERRIDE {
+ public_header_.reset(new QuicPacketPublicHeader(header));
+ return accept_public_header_;
+ }
+
virtual bool OnUnauthenticatedHeader(
const QuicPacketHeader& header) OVERRIDE {
return true;
@@ -295,8 +302,10 @@ class TestQuicVisitor : public ::net::QuicFramerVisitorInterface {
int complete_packets_;
int revived_packets_;
bool accept_packet_;
+ bool accept_public_header_;
scoped_ptr<QuicPacketHeader> header_;
+ scoped_ptr<QuicPacketPublicHeader> public_header_;
scoped_ptr<QuicPublicResetPacket> public_reset_packet_;
scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_;
vector<QuicStreamFrame*> stream_frames_;
@@ -1491,6 +1500,25 @@ TEST_P(QuicFramerTest, RejectPacket) {
EXPECT_EQ(0u, visitor_.ack_frames_.size());
}
+TEST_P(QuicFramerTest, RejectPublicHeader) {
+ visitor_.accept_public_header_ = false;
+
+ unsigned char packet[] = {
+ // public flags (8 byte guid)
+ 0x3C,
+ // guid
+ 0x10, 0x32, 0x54, 0x76,
+ 0x98, 0xBA, 0xDC, 0xFE,
+ };
+
+ QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
+ EXPECT_TRUE(framer_.ProcessPacket(encrypted));
+
+ EXPECT_EQ(QUIC_NO_ERROR, framer_.error());
+ ASSERT_TRUE(visitor_.public_header_.get());
+ ASSERT_FALSE(visitor_.header_.get());
+}
+
TEST_P(QuicFramerTest, RevivedStreamFrame) {
unsigned char payload[] = {
// frame type (stream frame with fin)
« no previous file with comments | « net/quic/quic_framer.cc ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698