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

Unified Diff: net/quic/crypto/crypto_framer_test.cc

Issue 14718011: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/crypto/crypto_framer.cc ('k') | net/quic/crypto/crypto_protocol.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/crypto_framer_test.cc
diff --git a/net/quic/crypto/crypto_framer_test.cc b/net/quic/crypto/crypto_framer_test.cc
index 1335e8b002808968757460aef89e3abdd22c0a06..0cdbd40a4a7283ec00d92ee1efa0eba820d3a704 100644
--- a/net/quic/crypto/crypto_framer_test.cc
+++ b/net/quic/crypto/crypto_framer_test.cc
@@ -71,20 +71,20 @@ TEST(CryptoFramerTest, ConstructHandshakeMessage) {
0x33, 0x77, 0xAA, 0xFF,
// num entries
0x03, 0x00,
+ // padding
+ 0x00, 0x00,
// tag 1
0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x06, 0x00, 0x00, 0x00,
// tag 2
0x79, 0x56, 0x34, 0x12,
+ // end offset 2
+ 0x0b, 0x00, 0x00, 0x00,
// tag 3
0x7A, 0x56, 0x34, 0x12,
- // len 1
- 0x06, 0x00,
- // len 2
- 0x05, 0x00,
- // len 3
- 0x07, 0x00,
- // padding
- 0x00, 0x00,
+ // end offset 3
+ 0x12, 0x00, 0x00, 0x00,
// value 1
'a', 'b', 'c', 'd',
'e', 'f',
@@ -115,14 +115,16 @@ TEST(CryptoFramerTest, ConstructHandshakeMessageWithTwoKeys) {
0x33, 0x77, 0xAA, 0xFF,
// num entries
0x02, 0x00,
+ // padding
+ 0x00, 0x00,
// tag 1
0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x06, 0x00, 0x00, 0x00,
// tag 2
0x79, 0x56, 0x34, 0x12,
- // len 1
- 0x06, 0x00,
- // len 2
- 0x05, 0x00,
+ // end offset 2
+ 0x0b, 0x00, 0x00, 0x00,
// value 1
'a', 'b', 'c', 'd',
'e', 'f',
@@ -150,12 +152,12 @@ TEST(CryptoFramerTest, ConstructHandshakeMessageZeroLength) {
0x33, 0x77, 0xAA, 0xFF,
// num entries
0x01, 0x00,
- // tag 1
- 0x78, 0x56, 0x34, 0x12,
- // len 1
- 0x00, 0x00,
// padding
0x00, 0x00,
+ // tag 1
+ 0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x00, 0x00, 0x00, 0x00,
};
CryptoFramer framer;
@@ -189,14 +191,16 @@ TEST(CryptoFramerTest, ProcessInput) {
0x33, 0x77, 0xAA, 0xFF,
// num entries
0x02, 0x00,
+ // padding
+ 0x00, 0x00,
// tag 1
0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x06, 0x00, 0x00, 0x00,
// tag 2
0x79, 0x56, 0x34, 0x12,
- // len 1
- 0x06, 0x00,
- // len 2
- 0x05, 0x00,
+ // end offset 2
+ 0x0b, 0x00, 0x00, 0x00,
// value 1
'a', 'b', 'c', 'd',
'e', 'f',
@@ -226,20 +230,20 @@ TEST(CryptoFramerTest, ProcessInputWithThreeKeys) {
0x33, 0x77, 0xAA, 0xFF,
// num entries
0x03, 0x00,
+ // padding
+ 0x00, 0x00,
// tag 1
0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x06, 0x00, 0x00, 0x00,
// tag 2
0x79, 0x56, 0x34, 0x12,
+ // end offset 2
+ 0x0b, 0x00, 0x00, 0x00,
// tag 3
0x7A, 0x56, 0x34, 0x12,
- // len 1
- 0x06, 0x00,
- // len 2
- 0x05, 0x00,
- // len 3
- 0x07, 0x00,
- // padding
- 0x00, 0x00,
+ // end offset 3
+ 0x12, 0x00, 0x00, 0x00,
// value 1
'a', 'b', 'c', 'd',
'e', 'f',
@@ -273,14 +277,16 @@ TEST(CryptoFramerTest, ProcessInputIncrementally) {
0x33, 0x77, 0xAA, 0xFF,
// num entries
0x02, 0x00,
+ // padding
+ 0x00, 0x00,
// tag 1
0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x06, 0x00, 0x00, 0x00,
// tag 2
0x79, 0x56, 0x34, 0x12,
- // len 1
- 0x06, 0x00,
- // len 2
- 0x05, 0x00,
+ // end offset 2
+ 0x0b, 0x00, 0x00, 0x00,
// value 1
'a', 'b', 'c', 'd',
'e', 'f',
@@ -311,10 +317,16 @@ TEST(CryptoFramerTest, ProcessInputTagsOutOfOrder) {
0x33, 0x77, 0xAA, 0xFF,
// num entries
0x02, 0x00,
+ // padding
+ 0x00, 0x00,
// tag 1
0x78, 0x56, 0x34, 0x13,
+ // end offset 1
+ 0x01, 0x00, 0x00, 0x00,
// tag 2
0x79, 0x56, 0x34, 0x12,
+ // end offset 2
+ 0x02, 0x00, 0x00, 0x00,
};
EXPECT_FALSE(
@@ -322,7 +334,7 @@ TEST(CryptoFramerTest, ProcessInputTagsOutOfOrder) {
EXPECT_EQ(QUIC_CRYPTO_TAGS_OUT_OF_ORDER, framer.error());
}
-TEST(CryptoFramerTest, ProcessInputTooManyEntries) {
+TEST(CryptoFramerTest, ProcessEndOffsetsOutOfOrder) {
test::TestCryptoVisitor visitor;
CryptoFramer framer;
framer.set_visitor(&visitor);
@@ -331,15 +343,25 @@ TEST(CryptoFramerTest, ProcessInputTooManyEntries) {
// tag
0x33, 0x77, 0xAA, 0xFF,
// num entries
- 0xA0, 0x00,
+ 0x02, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 0x79, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x01, 0x00, 0x00, 0x00,
+ // tag 2
+ 0x78, 0x56, 0x34, 0x13,
+ // end offset 2
+ 0x00, 0x00, 0x00, 0x00,
};
- EXPECT_FALSE(
- framer.ProcessInput(StringPiece(AsChars(input), arraysize(input))));
- EXPECT_EQ(QUIC_CRYPTO_TOO_MANY_ENTRIES, framer.error());
+ EXPECT_FALSE(framer.ProcessInput(StringPiece(AsChars(input),
+ arraysize(input))));
+ EXPECT_EQ(QUIC_CRYPTO_TAGS_OUT_OF_ORDER, framer.error());
}
-TEST(CryptoFramerTest, ProcessInputZeroLength) {
+TEST(CryptoFramerTest, ProcessInputTooManyEntries) {
test::TestCryptoVisitor visitor;
CryptoFramer framer;
framer.set_visitor(&visitor);
@@ -348,22 +370,17 @@ TEST(CryptoFramerTest, ProcessInputZeroLength) {
// tag
0x33, 0x77, 0xAA, 0xFF,
// num entries
- 0x02, 0x00,
- // tag 1
- 0x78, 0x56, 0x34, 0x12,
- // tag 2
- 0x79, 0x56, 0x34, 0x12,
- // len 1
+ 0xA0, 0x00,
+ // padding
0x00, 0x00,
- // len 2
- 0x05, 0x00,
};
- EXPECT_TRUE(
- framer.ProcessInput(StringPiece(AsChars(input), arraysize(input))));
+ EXPECT_FALSE(framer.ProcessInput(StringPiece(AsChars(input),
+ arraysize(input))));
+ EXPECT_EQ(QUIC_CRYPTO_TOO_MANY_ENTRIES, framer.error());
}
-TEST(CryptoFramerTest, ProcessInputInvalidLengthPadding) {
+TEST(CryptoFramerTest, ProcessInputZeroLength) {
test::TestCryptoVisitor visitor;
CryptoFramer framer;
framer.set_visitor(&visitor);
@@ -372,18 +389,21 @@ TEST(CryptoFramerTest, ProcessInputInvalidLengthPadding) {
// tag
0x33, 0x77, 0xAA, 0xFF,
// num entries
- 0x01, 0x00,
+ 0x02, 0x00,
+ // padding
+ 0x00, 0x00,
// tag 1
0x78, 0x56, 0x34, 0x12,
- // len 1
- 0x05, 0x00,
- // padding
- 0x05, 0x00,
+ // end offset 1
+ 0x00, 0x00, 0x00, 0x00,
+ // tag 2
+ 0x79, 0x56, 0x34, 0x12,
+ // end offset 2
+ 0x05, 0x00, 0x00, 0x00,
};
- EXPECT_FALSE(
- framer.ProcessInput(StringPiece(AsChars(input), arraysize(input))));
- EXPECT_EQ(QUIC_CRYPTO_INVALID_VALUE_LENGTH, framer.error());
+ EXPECT_TRUE(framer.ProcessInput(StringPiece(AsChars(input),
+ arraysize(input))));
}
} // namespace test
« no previous file with comments | « net/quic/crypto/crypto_framer.cc ('k') | net/quic/crypto/crypto_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698