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 <algorithm> | 5 #include <algorithm> |
6 #include <iostream> | 6 #include <iostream> |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 } | 1005 } |
1006 } | 1006 } |
1007 | 1007 |
1008 TEST_P(SpdyFramerTest, DuplicateHeader) { | 1008 TEST_P(SpdyFramerTest, DuplicateHeader) { |
1009 SpdyFramer framer(spdy_version_); | 1009 SpdyFramer framer(spdy_version_); |
1010 // Frame builder with plentiful buffer size. | 1010 // Frame builder with plentiful buffer size. |
1011 SpdyFrameBuilder frame(1024); | 1011 SpdyFrameBuilder frame(1024); |
1012 if (spdy_version_ < 4) { | 1012 if (spdy_version_ < 4) { |
1013 frame.WriteControlFrameHeader(framer, SYN_STREAM, CONTROL_FLAG_NONE); | 1013 frame.WriteControlFrameHeader(framer, SYN_STREAM, CONTROL_FLAG_NONE); |
1014 frame.WriteUInt32(3); // stream_id | 1014 frame.WriteUInt32(3); // stream_id |
| 1015 frame.WriteUInt32(0); // associated stream id |
| 1016 frame.WriteUInt16(0); // Priority. |
1015 } else { | 1017 } else { |
1016 frame.WriteFramePrefix(framer, SYN_STREAM, CONTROL_FLAG_NONE, 3); | 1018 frame.WriteFramePrefix(framer, HEADERS, HEADERS_FLAG_PRIORITY, 3); |
| 1019 frame.WriteUInt32(framer.GetHighestPriority()); |
1017 } | 1020 } |
1018 | 1021 |
1019 frame.WriteUInt32(0); // associated stream id | |
1020 frame.WriteUInt16(0); // Priority. | |
1021 | |
1022 if (IsSpdy2()) { | 1022 if (IsSpdy2()) { |
1023 frame.WriteUInt16(2); // Number of headers. | 1023 frame.WriteUInt16(2); // Number of headers. |
1024 frame.WriteString("name"); | 1024 frame.WriteString("name"); |
1025 frame.WriteString("value1"); | 1025 frame.WriteString("value1"); |
1026 frame.WriteString("name"); | 1026 frame.WriteString("name"); |
1027 frame.WriteString("value2"); | 1027 frame.WriteString("value2"); |
1028 } else { | 1028 } else { |
1029 frame.WriteUInt32(2); // Number of headers. | 1029 frame.WriteUInt32(2); // Number of headers. |
1030 frame.WriteStringPiece32("name"); | 1030 frame.WriteStringPiece32("name"); |
1031 frame.WriteStringPiece32("value1"); | 1031 frame.WriteStringPiece32("value1"); |
(...skipping 14 matching lines...) Expand all Loading... |
1046 &new_headers)); | 1046 &new_headers)); |
1047 } | 1047 } |
1048 | 1048 |
1049 TEST_P(SpdyFramerTest, MultiValueHeader) { | 1049 TEST_P(SpdyFramerTest, MultiValueHeader) { |
1050 SpdyFramer framer(spdy_version_); | 1050 SpdyFramer framer(spdy_version_); |
1051 // Frame builder with plentiful buffer size. | 1051 // Frame builder with plentiful buffer size. |
1052 SpdyFrameBuilder frame(1024); | 1052 SpdyFrameBuilder frame(1024); |
1053 if (spdy_version_ < 4) { | 1053 if (spdy_version_ < 4) { |
1054 frame.WriteControlFrameHeader(framer, SYN_STREAM, CONTROL_FLAG_NONE); | 1054 frame.WriteControlFrameHeader(framer, SYN_STREAM, CONTROL_FLAG_NONE); |
1055 frame.WriteUInt32(3); // stream_id | 1055 frame.WriteUInt32(3); // stream_id |
| 1056 frame.WriteUInt32(0); // associated stream id |
| 1057 frame.WriteUInt16(0); // Priority. |
1056 } else { | 1058 } else { |
1057 frame.WriteFramePrefix(framer, SYN_STREAM, CONTROL_FLAG_NONE, 3); | 1059 frame.WriteFramePrefix(framer, HEADERS, HEADERS_FLAG_PRIORITY, 3); |
| 1060 frame.WriteUInt32(framer.GetHighestPriority()); |
1058 } | 1061 } |
1059 | 1062 |
1060 frame.WriteUInt32(0); // associated stream id | |
1061 frame.WriteUInt16(0); // Priority. | |
1062 | |
1063 string value("value1\0value2"); | 1063 string value("value1\0value2"); |
1064 if (IsSpdy2()) { | 1064 if (IsSpdy2()) { |
1065 frame.WriteUInt16(1); // Number of headers. | 1065 frame.WriteUInt16(1); // Number of headers. |
1066 frame.WriteString("name"); | 1066 frame.WriteString("name"); |
1067 frame.WriteString(value); | 1067 frame.WriteString(value); |
1068 } else { | 1068 } else { |
1069 frame.WriteUInt32(1); // Number of headers. | 1069 frame.WriteUInt32(1); // Number of headers. |
1070 frame.WriteStringPiece32("name"); | 1070 frame.WriteStringPiece32("name"); |
1071 frame.WriteStringPiece32(value); | 1071 frame.WriteStringPiece32(value); |
1072 } | 1072 } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 0x00, 0x00, 0x00, 0x03, // DATA on Stream #3 | 1318 0x00, 0x00, 0x00, 0x03, // DATA on Stream #3 |
1319 0x00, 0x00, 0x00, 0x00, | 1319 0x00, 0x00, 0x00, 0x00, |
1320 | 1320 |
1321 0x80, spdy_version_ch_, 0x00, 0x03, // RST_STREAM on Stream #3 | 1321 0x80, spdy_version_ch_, 0x00, 0x03, // RST_STREAM on Stream #3 |
1322 0x00, 0x00, 0x00, 0x08, | 1322 0x00, 0x00, 0x00, 0x08, |
1323 0x00, 0x00, 0x00, 0x03, | 1323 0x00, 0x00, 0x00, 0x03, |
1324 0x00, 0x00, 0x00, 0x00, | 1324 0x00, 0x00, 0x00, 0x00, |
1325 }; | 1325 }; |
1326 | 1326 |
1327 const unsigned char kV4Input[] = { | 1327 const unsigned char kV4Input[] = { |
1328 0x00, 0x1e, 0x01, 0x00, // SYN_STREAM #1 | 1328 0x00, 0x1c, 0x08, 0x08, // SYN_STREAM #1 |
1329 0x00, 0x00, 0x00, 0x01, | 1329 0x00, 0x00, 0x00, 0x01, |
1330 0x00, 0x00, 0x00, 0x00, | 1330 0x00, 0x00, 0x00, 0x00, |
1331 0x00, 0x00, 0x00, 0x00, | 1331 0x00, 0x00, 0x00, 0x01, |
1332 0x00, 0x01, 0x00, 0x00, | |
1333 0x00, 0x02, 'h', 'h', | |
1334 0x00, 0x00, 0x00, 0x02, | 1332 0x00, 0x00, 0x00, 0x02, |
1335 'v', 'v', | 1333 'h', 'h', 0x00, 0x00, |
| 1334 0x00, 0x02, 'v', 'v', |
1336 | 1335 |
1337 0x00, 0x24, 0x08, 0x00, // HEADERS on Stream #1 | 1336 0x00, 0x24, 0x08, 0x00, // HEADERS on Stream #1 |
1338 0x00, 0x00, 0x00, 0x01, | 1337 0x00, 0x00, 0x00, 0x01, |
1339 0x00, 0x00, 0x00, 0x02, | 1338 0x00, 0x00, 0x00, 0x02, |
1340 0x00, 0x00, 0x00, 0x02, | 1339 0x00, 0x00, 0x00, 0x02, |
1341 'h', '2', 0x00, 0x00, | 1340 'h', '2', 0x00, 0x00, |
1342 0x00, 0x02, 'v', '2', | 1341 0x00, 0x02, 'v', '2', |
1343 0x00, 0x00, 0x00, 0x02, | 1342 0x00, 0x00, 0x00, 0x02, |
1344 'h', '3', 0x00, 0x00, | 1343 'h', '3', 0x00, 0x00, |
1345 0x00, 0x02, 'v', '3', | 1344 0x00, 0x02, 'v', '3', |
1346 | 1345 |
1347 0x00, 0x14, 0x00, 0x00, // DATA on Stream #1 | 1346 0x00, 0x14, 0x00, 0x00, // DATA on Stream #1 |
1348 0x00, 0x00, 0x00, 0x01, | 1347 0x00, 0x00, 0x00, 0x01, |
1349 0xde, 0xad, 0xbe, 0xef, | 1348 0xde, 0xad, 0xbe, 0xef, |
1350 0xde, 0xad, 0xbe, 0xef, | 1349 0xde, 0xad, 0xbe, 0xef, |
1351 0xde, 0xad, 0xbe, 0xef, | 1350 0xde, 0xad, 0xbe, 0xef, |
1352 | 1351 |
1353 0x00, 0x12, 0x01, 0x00, // SYN Stream #3 | 1352 0x00, 0x10, 0x08, 0x08, // SYN Stream #3 |
1354 0x00, 0x00, 0x00, 0x03, | 1353 0x00, 0x00, 0x00, 0x03, |
1355 0x00, 0x00, 0x00, 0x00, | 1354 0x00, 0x00, 0x00, 0x00, |
1356 0x00, 0x00, 0x00, 0x00, | 1355 0x00, 0x00, 0x00, 0x00, |
1357 0x00, 0x00, | |
1358 | 1356 |
1359 0x00, 0x10, 0x00, 0x00, // DATA on Stream #3 | 1357 0x00, 0x10, 0x00, 0x00, // DATA on Stream #3 |
1360 0x00, 0x00, 0x00, 0x03, | 1358 0x00, 0x00, 0x00, 0x03, |
1361 0xde, 0xad, 0xbe, 0xef, | 1359 0xde, 0xad, 0xbe, 0xef, |
1362 0xde, 0xad, 0xbe, 0xef, | 1360 0xde, 0xad, 0xbe, 0xef, |
1363 | 1361 |
1364 0x00, 0x0c, 0x00, 0x00, // DATA on Stream #1 | 1362 0x00, 0x0c, 0x00, 0x00, // DATA on Stream #1 |
1365 0x00, 0x00, 0x00, 0x01, | 1363 0x00, 0x00, 0x00, 0x01, |
1366 0xde, 0xad, 0xbe, 0xef, | 1364 0xde, 0xad, 0xbe, 0xef, |
1367 | 1365 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 0x00, 0x00, 0x00, 0x0c, | 1446 0x00, 0x00, 0x00, 0x0c, |
1449 0xde, 0xad, 0xbe, 0xef, | 1447 0xde, 0xad, 0xbe, 0xef, |
1450 0xde, 0xad, 0xbe, 0xef, | 1448 0xde, 0xad, 0xbe, 0xef, |
1451 0xde, 0xad, 0xbe, 0xef, | 1449 0xde, 0xad, 0xbe, 0xef, |
1452 | 1450 |
1453 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1, with EOF | 1451 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1, with EOF |
1454 0x01, 0x00, 0x00, 0x04, | 1452 0x01, 0x00, 0x00, 0x04, |
1455 0xde, 0xad, 0xbe, 0xef, | 1453 0xde, 0xad, 0xbe, 0xef, |
1456 }; | 1454 }; |
1457 const unsigned char kV4Input[] = { | 1455 const unsigned char kV4Input[] = { |
1458 0x00, 0x1e, 0x01, 0x00, // SYN_STREAM #1 | 1456 0x00, 0x1c, 0x08, 0x08, // SYN_STREAM #1 |
1459 0x00, 0x00, 0x00, 0x01, | 1457 0x00, 0x00, 0x00, 0x01, |
1460 0x00, 0x00, 0x00, 0x00, | 1458 0x00, 0x00, 0x00, 0x00, |
1461 0x00, 0x00, 0x00, 0x00, | 1459 0x00, 0x00, 0x00, 0x01, |
1462 0x00, 0x01, 0x00, 0x00, | |
1463 0x00, 0x02, 'h', 'h', | |
1464 0x00, 0x00, 0x00, 0x02, | 1460 0x00, 0x00, 0x00, 0x02, |
1465 'v', 'v', | 1461 'h', 'h', 0x00, 0x00, |
| 1462 0x00, 0x02, 'v', 'v', |
1466 | 1463 |
1467 0x00, 0x18, 0x02, 0x00, // SYN REPLY Stream #1 | 1464 0x00, 0x18, 0x08, 0x00, // SYN REPLY Stream #1 |
1468 0x00, 0x00, 0x00, 0x01, | 1465 0x00, 0x00, 0x00, 0x01, |
1469 0x00, 0x00, 0x00, 0x01, | 1466 0x00, 0x00, 0x00, 0x01, |
1470 0x00, 0x00, 0x00, 0x02, | 1467 0x00, 0x00, 0x00, 0x02, |
1471 'a', 'a', 0x00, 0x00, | 1468 'a', 'a', 0x00, 0x00, |
1472 0x00, 0x02, 'b', 'b', | 1469 0x00, 0x02, 'b', 'b', |
1473 | 1470 |
1474 0x00, 0x14, 0x00, 0x00, // DATA on Stream #1 | 1471 0x00, 0x14, 0x00, 0x00, // DATA on Stream #1 |
1475 0x00, 0x00, 0x00, 0x01, | 1472 0x00, 0x00, 0x00, 0x01, |
1476 0xde, 0xad, 0xbe, 0xef, | 1473 0xde, 0xad, 0xbe, 0xef, |
1477 0xde, 0xad, 0xbe, 0xef, | 1474 0xde, 0xad, 0xbe, 0xef, |
1478 0xde, 0xad, 0xbe, 0xef, | 1475 0xde, 0xad, 0xbe, 0xef, |
1479 | 1476 |
1480 0x00, 0x0c, 0x00, 0x01, // DATA on Stream #1, with FIN | 1477 0x00, 0x0c, 0x00, 0x01, // DATA on Stream #1, with FIN |
1481 0x00, 0x00, 0x00, 0x01, | 1478 0x00, 0x00, 0x00, 0x01, |
1482 0xde, 0xad, 0xbe, 0xef, | 1479 0xde, 0xad, 0xbe, 0xef, |
1483 }; | 1480 }; |
1484 | 1481 |
1485 TestSpdyVisitor visitor(spdy_version_); | 1482 TestSpdyVisitor visitor(spdy_version_); |
1486 if (IsSpdy2()) { | 1483 if (IsSpdy2()) { |
1487 visitor.SimulateInFramer(kV2Input, sizeof(kV2Input)); | 1484 visitor.SimulateInFramer(kV2Input, sizeof(kV2Input)); |
1488 } else if (IsSpdy3()) { | 1485 } else if (IsSpdy3()) { |
1489 visitor.SimulateInFramer(kV3Input, sizeof(kV3Input)); | 1486 visitor.SimulateInFramer(kV3Input, sizeof(kV3Input)); |
1490 } else { | 1487 } else { |
1491 visitor.SimulateInFramer(kV4Input, sizeof(kV4Input)); | 1488 visitor.SimulateInFramer(kV4Input, sizeof(kV4Input)); |
1492 } | 1489 } |
1493 | 1490 |
1494 EXPECT_EQ(0, visitor.error_count_); | 1491 EXPECT_EQ(0, visitor.error_count_); |
1495 EXPECT_EQ(1, visitor.syn_frame_count_); | 1492 EXPECT_EQ(1, visitor.syn_frame_count_); |
1496 EXPECT_EQ(1, visitor.syn_reply_frame_count_); | 1493 if (IsSpdy4()) { |
1497 EXPECT_EQ(0, visitor.headers_frame_count_); | 1494 EXPECT_EQ(0, visitor.syn_reply_frame_count_); |
| 1495 EXPECT_EQ(1, visitor.headers_frame_count_); |
| 1496 } else { |
| 1497 EXPECT_EQ(1, visitor.syn_reply_frame_count_); |
| 1498 EXPECT_EQ(0, visitor.headers_frame_count_); |
| 1499 } |
1498 EXPECT_EQ(16, visitor.data_bytes_); | 1500 EXPECT_EQ(16, visitor.data_bytes_); |
1499 EXPECT_EQ(0, visitor.fin_frame_count_); | 1501 EXPECT_EQ(0, visitor.fin_frame_count_); |
1500 EXPECT_EQ(0, visitor.fin_flag_count_); | 1502 EXPECT_EQ(0, visitor.fin_flag_count_); |
1501 EXPECT_EQ(1, visitor.zero_length_data_frame_count_); | 1503 EXPECT_EQ(1, visitor.zero_length_data_frame_count_); |
1502 EXPECT_EQ(2, visitor.data_frame_count_); | 1504 EXPECT_EQ(2, visitor.data_frame_count_); |
1503 } | 1505 } |
1504 | 1506 |
1505 // Test that the FIN flag on a SYN reply frame signifies EOF. | 1507 // Test that the FIN flag on a SYN reply frame signifies EOF. |
1506 TEST_P(SpdyFramerTest, FinOnSynReplyFrame) { | 1508 TEST_P(SpdyFramerTest, FinOnSynReplyFrame) { |
1507 const unsigned char kV2Input[] = { | 1509 const unsigned char kV2Input[] = { |
(...skipping 25 matching lines...) Expand all Loading... |
1533 | 1535 |
1534 0x80, spdy_version_ch_, 0x00, 0x02, // SYN REPLY Stream #1 | 1536 0x80, spdy_version_ch_, 0x00, 0x02, // SYN REPLY Stream #1 |
1535 0x01, 0x00, 0x00, 0x14, | 1537 0x01, 0x00, 0x00, 0x14, |
1536 0x00, 0x00, 0x00, 0x01, | 1538 0x00, 0x00, 0x00, 0x01, |
1537 0x00, 0x00, 0x00, 0x01, | 1539 0x00, 0x00, 0x00, 0x01, |
1538 0x00, 0x00, 0x00, 0x02, | 1540 0x00, 0x00, 0x00, 0x02, |
1539 'a', 'a', 0x00, 0x00, | 1541 'a', 'a', 0x00, 0x00, |
1540 0x00, 0x02, 'b', 'b', | 1542 0x00, 0x02, 'b', 'b', |
1541 }; | 1543 }; |
1542 const unsigned char kV4Input[] = { | 1544 const unsigned char kV4Input[] = { |
1543 0x00, 0x1e, 0x01, 0x00, // SYN_STREAM #1 | 1545 0x00, 0x1c, 0x08, 0x08, // SYN_STREAM #1 |
1544 0x00, 0x00, 0x00, 0x01, | 1546 0x00, 0x00, 0x00, 0x01, |
1545 0x00, 0x00, 0x00, 0x00, | 1547 0x00, 0x00, 0x00, 0x00, |
1546 0x00, 0x00, 0x00, 0x00, | 1548 0x00, 0x00, 0x00, 0x01, |
1547 0x00, 0x01, 0x00, 0x00, | |
1548 0x00, 0x02, 'h', 'h', | |
1549 0x00, 0x00, 0x00, 0x02, | 1549 0x00, 0x00, 0x00, 0x02, |
1550 'v', 'v', | 1550 'h', 'h', 0x00, 0x00, |
| 1551 0x00, 0x02, 'v', 'v', |
1551 | 1552 |
1552 0x00, 0x18, 0x02, 0x01, // SYN_REPLY #1, with FIN | 1553 0x00, 0x18, 0x08, 0x01, // SYN_REPLY #1, with FIN |
1553 0x00, 0x00, 0x00, 0x01, | 1554 0x00, 0x00, 0x00, 0x01, |
1554 0x00, 0x00, 0x00, 0x01, | 1555 0x00, 0x00, 0x00, 0x01, |
1555 0x00, 0x00, 0x00, 0x02, | 1556 0x00, 0x00, 0x00, 0x02, |
1556 'a', 'a', 0x00, 0x00, | 1557 'a', 'a', 0x00, 0x00, |
1557 0x00, 0x02, 'b', 'b', | 1558 0x00, 0x02, 'b', 'b', |
1558 }; | 1559 }; |
1559 | 1560 |
1560 TestSpdyVisitor visitor(spdy_version_); | 1561 TestSpdyVisitor visitor(spdy_version_); |
1561 if (IsSpdy2()) { | 1562 if (IsSpdy2()) { |
1562 visitor.SimulateInFramer(kV2Input, sizeof(kV2Input)); | 1563 visitor.SimulateInFramer(kV2Input, sizeof(kV2Input)); |
1563 } else if (IsSpdy3()) { | 1564 } else if (IsSpdy3()) { |
1564 visitor.SimulateInFramer(kV3Input, sizeof(kV3Input)); | 1565 visitor.SimulateInFramer(kV3Input, sizeof(kV3Input)); |
1565 } else { | 1566 } else { |
1566 visitor.SimulateInFramer(kV4Input, sizeof(kV4Input)); | 1567 visitor.SimulateInFramer(kV4Input, sizeof(kV4Input)); |
1567 } | 1568 } |
1568 | 1569 |
1569 EXPECT_EQ(0, visitor.error_count_); | 1570 EXPECT_EQ(0, visitor.error_count_); |
1570 EXPECT_EQ(1, visitor.syn_frame_count_); | 1571 EXPECT_EQ(1, visitor.syn_frame_count_); |
1571 EXPECT_EQ(1, visitor.syn_reply_frame_count_); | 1572 if (IsSpdy4()) { |
1572 EXPECT_EQ(0, visitor.headers_frame_count_); | 1573 EXPECT_EQ(0, visitor.syn_reply_frame_count_); |
| 1574 EXPECT_EQ(1, visitor.headers_frame_count_); |
| 1575 } else { |
| 1576 EXPECT_EQ(1, visitor.syn_reply_frame_count_); |
| 1577 EXPECT_EQ(0, visitor.headers_frame_count_); |
| 1578 } |
1573 EXPECT_EQ(0, visitor.data_bytes_); | 1579 EXPECT_EQ(0, visitor.data_bytes_); |
1574 EXPECT_EQ(0, visitor.fin_frame_count_); | 1580 EXPECT_EQ(0, visitor.fin_frame_count_); |
1575 EXPECT_EQ(1, visitor.fin_flag_count_); | 1581 EXPECT_EQ(1, visitor.fin_flag_count_); |
1576 EXPECT_EQ(1, visitor.zero_length_data_frame_count_); | 1582 EXPECT_EQ(1, visitor.zero_length_data_frame_count_); |
1577 EXPECT_EQ(0, visitor.data_frame_count_); | 1583 EXPECT_EQ(0, visitor.data_frame_count_); |
1578 } | 1584 } |
1579 | 1585 |
1580 TEST_P(SpdyFramerTest, HeaderCompression) { | 1586 TEST_P(SpdyFramerTest, HeaderCompression) { |
1581 SpdyFramer send_framer(spdy_version_); | 1587 SpdyFramer send_framer(spdy_version_); |
1582 SpdyFramer recv_framer(spdy_version_); | 1588 SpdyFramer recv_framer(spdy_version_); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 0x00, 0x02, 0x00, 0x00, | 1979 0x00, 0x02, 0x00, 0x00, |
1974 0x00, 0x03, 'b', 'a', | 1980 0x00, 0x03, 'b', 'a', |
1975 'r', 0x00, 0x00, 0x00, | 1981 'r', 0x00, 0x00, 0x00, |
1976 0x03, 'f', 'o', 'o', | 1982 0x03, 'f', 'o', 'o', |
1977 0x00, 0x00, 0x00, 0x03, | 1983 0x00, 0x00, 0x00, 0x03, |
1978 'f', 'o', 'o', 0x00, | 1984 'f', 'o', 'o', 0x00, |
1979 0x00, 0x00, 0x03, 'b', | 1985 0x00, 0x00, 0x03, 'b', |
1980 'a', 'r' | 1986 'a', 'r' |
1981 }; | 1987 }; |
1982 const unsigned char kV4FrameData[] = { | 1988 const unsigned char kV4FrameData[] = { |
1983 0x00, 0x2e, 0x01, 0x00, | 1989 0x00, 0x2c, 0x08, 0x08, |
1984 0x00, 0x00, 0x00, 0x01, | 1990 0x00, 0x00, 0x00, 0x01, |
1985 0x00, 0x00, 0x00, 0x00, | 1991 0x00, 0x00, 0x00, 0x07, |
1986 kPri, kCre, 0x00, 0x00, | 1992 0x00, 0x00, 0x00, 0x02, |
1987 0x00, 0x02, 0x00, 0x00, | |
1988 0x00, 0x03, 'b', 'a', | |
1989 'r', 0x00, 0x00, 0x00, | |
1990 0x03, 'f', 'o', 'o', | |
1991 0x00, 0x00, 0x00, 0x03, | 1993 0x00, 0x00, 0x00, 0x03, |
1992 'f', 'o', 'o', 0x00, | 1994 'b', 'a', 'r', 0x00, |
1993 0x00, 0x00, 0x03, 'b', | 1995 0x00, 0x00, 0x03, 'f', |
1994 'a', 'r' | 1996 'o', 'o', 0x00, 0x00, |
| 1997 0x00, 0x03, 'f', 'o', |
| 1998 'o', 0x00, 0x00, 0x00, |
| 1999 0x03, 'b', 'a', 'r' |
1995 }; | 2000 }; |
1996 scoped_ptr<SpdyFrame> frame( | 2001 scoped_ptr<SpdyFrame> frame( |
1997 framer.CreateSynStream(1, // stream id | 2002 framer.CreateSynStream(1, // stream id |
1998 0, // associated stream id | 2003 0, // associated stream id |
1999 framer.GetLowestPriority(), | 2004 framer.GetLowestPriority(), |
2000 kCre, // credential slot | 2005 kCre, // credential slot |
2001 CONTROL_FLAG_NONE, | 2006 CONTROL_FLAG_NONE, |
2002 false, // compress | 2007 false, // compress |
2003 &headers)); | 2008 &headers)); |
2004 if (IsSpdy2()) { | 2009 if (IsSpdy2()) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 0x00, 0x00, 0x00, 0x00, | 2044 0x00, 0x00, 0x00, 0x00, |
2040 0x00, 0x02, 0x00, 0x00, | 2045 0x00, 0x02, 0x00, 0x00, |
2041 0x00, 0x00, 0x00, 0x00, | 2046 0x00, 0x00, 0x00, 0x00, |
2042 0x00, 0x03, 'f', 'o', | 2047 0x00, 0x03, 'f', 'o', |
2043 'o', 0x00, 0x00, 0x00, | 2048 'o', 0x00, 0x00, 0x00, |
2044 0x03, 'f', 'o', 'o', | 2049 0x03, 'f', 'o', 'o', |
2045 0x00, 0x00, 0x00, 0x03, | 2050 0x00, 0x00, 0x00, 0x03, |
2046 'b', 'a', 'r' | 2051 'b', 'a', 'r' |
2047 }; | 2052 }; |
2048 const unsigned char kV4FrameData[] = { | 2053 const unsigned char kV4FrameData[] = { |
2049 0x00, 0x2b, 0x01, 0x01, | 2054 0x00, 0x29, 0x08, 0x09, |
2050 0x7f, 0xff, 0xff, 0xff, | |
2051 0x7f, 0xff, 0xff, 0xff, | 2055 0x7f, 0xff, 0xff, 0xff, |
2052 0x00, 0x00, 0x00, 0x00, | 2056 0x00, 0x00, 0x00, 0x00, |
2053 0x00, 0x02, 0x00, 0x00, | 2057 0x00, 0x00, 0x00, 0x02, |
2054 0x00, 0x00, 0x00, 0x00, | 2058 0x00, 0x00, 0x00, 0x00, |
2055 0x00, 0x03, 'f', 'o', | |
2056 'o', 0x00, 0x00, 0x00, | |
2057 0x03, 'f', 'o', 'o', | |
2058 0x00, 0x00, 0x00, 0x03, | 2059 0x00, 0x00, 0x00, 0x03, |
2059 'b', 'a', 'r' | 2060 'f', 'o', 'o', 0x00, |
| 2061 0x00, 0x00, 0x03, 'f', |
| 2062 'o', 'o', 0x00, 0x00, |
| 2063 0x00, 0x03, 'b', 'a', |
| 2064 'r' |
2060 }; | 2065 }; |
2061 scoped_ptr<SpdyFrame> frame( | 2066 scoped_ptr<SpdyFrame> frame( |
2062 framer.CreateSynStream(0x7fffffff, // stream id | 2067 framer.CreateSynStream(0x7fffffff, // stream id |
2063 0x7fffffff, // associated stream id | 2068 0x7fffffff, // associated stream id |
2064 framer.GetHighestPriority(), | 2069 framer.GetHighestPriority(), |
2065 0, // credential slot | 2070 0, // credential slot |
2066 CONTROL_FLAG_FIN, | 2071 CONTROL_FLAG_FIN, |
2067 false, // compress | 2072 false, // compress |
2068 &headers)); | 2073 &headers)); |
2069 if (IsSpdy2()) { | 2074 if (IsSpdy2()) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2105 kPri, 0x00, 0x00, 0x00, | 2110 kPri, 0x00, 0x00, 0x00, |
2106 0x00, 0x02, 0x00, 0x00, | 2111 0x00, 0x02, 0x00, 0x00, |
2107 0x00, 0x03, 'b', 'a', | 2112 0x00, 0x03, 'b', 'a', |
2108 'r', 0x00, 0x00, 0x00, | 2113 'r', 0x00, 0x00, 0x00, |
2109 0x03, 'f', 'o', 'o', | 2114 0x03, 'f', 'o', 'o', |
2110 0x00, 0x00, 0x00, 0x03, | 2115 0x00, 0x00, 0x00, 0x03, |
2111 'f', 'o', 'o', 0x00, | 2116 'f', 'o', 'o', 0x00, |
2112 0x00, 0x00, 0x00 | 2117 0x00, 0x00, 0x00 |
2113 }; | 2118 }; |
2114 const unsigned char kV4FrameData[] = { | 2119 const unsigned char kV4FrameData[] = { |
2115 0x00, 0x2b, 0x01, 0x01, | 2120 0x00, 0x29, 0x08, 0x09, |
2116 0x7f, 0xff, 0xff, 0xff, | 2121 0x7f, 0xff, 0xff, 0xff, |
2117 0x7f, 0xff, 0xff, 0xff, | 2122 0x00, 0x00, 0x00, 0x01, |
2118 kPri, 0x00, 0x00, 0x00, | 2123 0x00, 0x00, 0x00, 0x02, |
2119 0x00, 0x02, 0x00, 0x00, | |
2120 0x00, 0x03, 'b', 'a', | |
2121 'r', 0x00, 0x00, 0x00, | |
2122 0x03, 'f', 'o', 'o', | |
2123 0x00, 0x00, 0x00, 0x03, | 2124 0x00, 0x00, 0x00, 0x03, |
2124 'f', 'o', 'o', 0x00, | 2125 'b', 'a', 'r', 0x00, |
2125 0x00, 0x00, 0x00 | 2126 0x00, 0x00, 0x03, 'f', |
| 2127 'o', 'o', 0x00, 0x00, |
| 2128 0x00, 0x03, 'f', 'o', |
| 2129 'o', 0x00, 0x00, 0x00, |
| 2130 0x00 |
2126 }; | 2131 }; |
2127 scoped_ptr<SpdyFrame> frame( | 2132 scoped_ptr<SpdyFrame> frame( |
2128 framer.CreateSynStream(0x7fffffff, // stream id | 2133 framer.CreateSynStream(0x7fffffff, // stream id |
2129 0x7fffffff, // associated stream id | 2134 0x7fffffff, // associated stream id |
2130 1, // priority | 2135 1, // priority |
2131 0, // credential slot | 2136 0, // credential slot |
2132 CONTROL_FLAG_FIN, | 2137 CONTROL_FLAG_FIN, |
2133 false, // compress | 2138 false, // compress |
2134 &headers)); | 2139 &headers)); |
2135 if (IsSpdy2()) { | 2140 if (IsSpdy2()) { |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2963 0x66, 0x80, 0x00, 0x4a, | 2968 0x66, 0x80, 0x00, 0x4a, |
2964 0xcb, 0xcf, 0x07, 0x08, | 2969 0xcb, 0xcf, 0x07, 0x08, |
2965 0x20, 0x10, 0x95, 0x96, | 2970 0x20, 0x10, 0x95, 0x96, |
2966 0x9f, 0x0f, 0xa2, 0x00, | 2971 0x9f, 0x0f, 0xa2, 0x00, |
2967 0x02, 0x28, 0x29, 0xb1, | 2972 0x02, 0x28, 0x29, 0xb1, |
2968 0x08, 0x20, 0x80, 0x00, | 2973 0x08, 0x20, 0x80, 0x00, |
2969 0x00, 0x00, 0x00, 0xff, | 2974 0x00, 0x00, 0x00, 0xff, |
2970 0xff, | 2975 0xff, |
2971 }; | 2976 }; |
2972 const unsigned char kV4FrameData[] = { | 2977 const unsigned char kV4FrameData[] = { |
2973 0x00, 0x35, 0x08, 0x00, | 2978 0x00, 0x25, 0x08, 0x00, |
2974 0x00, 0x00, 0x00, 0x01, | 2979 0x00, 0x00, 0x00, 0x01, |
2975 0x38, 0xea, 0xe3, 0xc6, | 2980 0x38, 0xea, 0xe3, 0xc6, |
2976 0xa7, 0xc2, 0x02, 0xe5, | 2981 0xa7, 0xc2, 0x02, 0xe5, |
2977 0x0e, 0x50, 0xc2, 0x4b, | 2982 0x0e, 0x50, 0xc2, 0x4b, |
2978 0x4a, 0x04, 0xe5, 0x0b, | 2983 0x4a, 0x04, 0xe5, 0x0b, |
2979 0x66, 0x80, 0x00, 0x4a, | 2984 0x66, 0x80, 0x00, 0x4a, |
2980 0xcb, 0xcf, 0x07, 0x08, | 2985 0xcb, 0xcf, 0x07, 0x08, |
2981 0x20, 0x10, 0x95, 0x96, | 2986 0x20, 0x10, 0x95, 0x96, |
2982 0x9f, 0x0f, 0xa2, 0x00, | 2987 0x9f, 0x0f, 0xa2, 0x00, |
2983 0x02, 0x28, 0x29, 0xb1, | 2988 0x02, 0x28, 0x29, 0xb1, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3184 framer.CreateSynReply(1, // stream_id | 3189 framer.CreateSynReply(1, // stream_id |
3185 CONTROL_FLAG_NONE, | 3190 CONTROL_FLAG_NONE, |
3186 true, // compress | 3191 true, // compress |
3187 &headers)); | 3192 &headers)); |
3188 EXPECT_TRUE(control_frame.get() != NULL); | 3193 EXPECT_TRUE(control_frame.get() != NULL); |
3189 TestSpdyVisitor visitor(spdy_version_); | 3194 TestSpdyVisitor visitor(spdy_version_); |
3190 visitor.use_compression_ = true; | 3195 visitor.use_compression_ = true; |
3191 visitor.SimulateInFramer( | 3196 visitor.SimulateInFramer( |
3192 reinterpret_cast<unsigned char*>(control_frame->data()), | 3197 reinterpret_cast<unsigned char*>(control_frame->data()), |
3193 control_frame->size()); | 3198 control_frame->size()); |
3194 EXPECT_EQ(1, visitor.syn_reply_frame_count_); | 3199 if (IsSpdy4()) { |
| 3200 EXPECT_EQ(0, visitor.syn_reply_frame_count_); |
| 3201 EXPECT_EQ(1, visitor.headers_frame_count_); |
| 3202 } else { |
| 3203 EXPECT_EQ(1, visitor.syn_reply_frame_count_); |
| 3204 EXPECT_EQ(0, visitor.headers_frame_count_); |
| 3205 } |
3195 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_)); | 3206 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_)); |
3196 } | 3207 } |
3197 | 3208 |
3198 TEST_P(SpdyFramerTest, ReadCompressedHeadersHeaderBlock) { | 3209 TEST_P(SpdyFramerTest, ReadCompressedHeadersHeaderBlock) { |
3199 SpdyHeaderBlock headers; | 3210 SpdyHeaderBlock headers; |
3200 headers["alpha"] = "beta"; | 3211 headers["alpha"] = "beta"; |
3201 headers["gamma"] = "delta"; | 3212 headers["gamma"] = "delta"; |
3202 SpdyFramer framer(spdy_version_); | 3213 SpdyFramer framer(spdy_version_); |
3203 scoped_ptr<SpdyFrame> control_frame( | 3214 scoped_ptr<SpdyFrame> control_frame( |
3204 framer.CreateHeaders(1, // stream_id | 3215 framer.CreateHeaders(1, // stream_id |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3839 TestSpdyVisitor visitor(spdy_version_); | 3850 TestSpdyVisitor visitor(spdy_version_); |
3840 visitor.use_compression_ = false; | 3851 visitor.use_compression_ = false; |
3841 visitor.SimulateInFramer(kFrameData, arraysize(kFrameData)); | 3852 visitor.SimulateInFramer(kFrameData, arraysize(kFrameData)); |
3842 EXPECT_EQ(1, visitor.error_count_); | 3853 EXPECT_EQ(1, visitor.error_count_); |
3843 } | 3854 } |
3844 | 3855 |
3845 TEST_P(SpdyFramerTest, SizesTest) { | 3856 TEST_P(SpdyFramerTest, SizesTest) { |
3846 SpdyFramer framer(spdy_version_); | 3857 SpdyFramer framer(spdy_version_); |
3847 EXPECT_EQ(8u, framer.GetDataFrameMinimumSize()); | 3858 EXPECT_EQ(8u, framer.GetDataFrameMinimumSize()); |
3848 if (IsSpdy4()) { | 3859 if (IsSpdy4()) { |
| 3860 EXPECT_EQ(8u, framer.GetControlFrameHeaderSize()); |
| 3861 EXPECT_EQ(12u, framer.GetSynStreamMinimumSize()); |
3849 EXPECT_EQ(8u, framer.GetSynReplyMinimumSize()); | 3862 EXPECT_EQ(8u, framer.GetSynReplyMinimumSize()); |
3850 EXPECT_EQ(12u, framer.GetRstStreamSize()); | 3863 EXPECT_EQ(12u, framer.GetRstStreamSize()); |
3851 EXPECT_EQ(12u, framer.GetSettingsMinimumSize()); | 3864 EXPECT_EQ(12u, framer.GetSettingsMinimumSize()); |
| 3865 EXPECT_EQ(8u, framer.GetSynReplyMinimumSize()); |
| 3866 EXPECT_EQ(12u, framer.GetRstStreamSize()); |
| 3867 EXPECT_EQ(12u, framer.GetSettingsMinimumSize()); |
3852 EXPECT_EQ(12u, framer.GetPingSize()); | 3868 EXPECT_EQ(12u, framer.GetPingSize()); |
3853 EXPECT_EQ(16u, framer.GetGoAwaySize()); | 3869 EXPECT_EQ(16u, framer.GetGoAwaySize()); |
3854 EXPECT_EQ(8u, framer.GetHeadersMinimumSize()); | 3870 EXPECT_EQ(8u, framer.GetHeadersMinimumSize()); |
3855 EXPECT_EQ(12u, framer.GetWindowUpdateSize()); | 3871 EXPECT_EQ(12u, framer.GetWindowUpdateSize()); |
3856 EXPECT_EQ(10u, framer.GetCredentialMinimumSize()); | 3872 EXPECT_EQ(10u, framer.GetCredentialMinimumSize()); |
3857 EXPECT_EQ(8u, framer.GetBlockedSize()); | 3873 EXPECT_EQ(8u, framer.GetBlockedSize()); |
3858 EXPECT_EQ(12u, framer.GetPushPromiseMinimumSize()); | 3874 EXPECT_EQ(12u, framer.GetPushPromiseMinimumSize()); |
3859 EXPECT_EQ(8u, framer.GetFrameMinimumSize()); | 3875 EXPECT_EQ(8u, framer.GetFrameMinimumSize()); |
3860 EXPECT_EQ(65535u, framer.GetFrameMaximumSize()); | 3876 EXPECT_EQ(65535u, framer.GetFrameMaximumSize()); |
3861 EXPECT_EQ(65527u, framer.GetDataFrameMaximumPayload()); | 3877 EXPECT_EQ(65527u, framer.GetDataFrameMaximumPayload()); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4067 SpdyFramer framer(spdy_version_); | 4083 SpdyFramer framer(spdy_version_); |
4068 framer.set_visitor(&visitor); | 4084 framer.set_visitor(&visitor); |
4069 framer.set_debug_visitor(&debug_visitor); | 4085 framer.set_debug_visitor(&debug_visitor); |
4070 | 4086 |
4071 EXPECT_CALL(debug_visitor, OnSendCompressedFrame(8, SYN_STREAM, _, _)); | 4087 EXPECT_CALL(debug_visitor, OnSendCompressedFrame(8, SYN_STREAM, _, _)); |
4072 | 4088 |
4073 SpdyHeaderBlock headers; | 4089 SpdyHeaderBlock headers; |
4074 headers["foo"] = "bar"; | 4090 headers["foo"] = "bar"; |
4075 scoped_ptr<SpdyFrame> frame( | 4091 scoped_ptr<SpdyFrame> frame( |
4076 framer.CreateSynStream(8, 3, 1, 0, CONTROL_FLAG_NONE, true, &headers)); | 4092 framer.CreateSynStream(8, 3, 1, 0, CONTROL_FLAG_NONE, true, &headers)); |
4077 SetFrameFlags(frame.get(), flags, spdy_version_); | 4093 int set_flags = flags; |
| 4094 if(IsSpdy4()) { |
| 4095 set_flags |= HEADERS_FLAG_PRIORITY; // Required for SYN_STREAM simulation
. |
| 4096 } |
| 4097 SetFrameFlags(frame.get(), set_flags, spdy_version_); |
4078 | 4098 |
4079 if (flags & ~(CONTROL_FLAG_FIN | CONTROL_FLAG_UNIDIRECTIONAL)) { | 4099 if (!IsSpdy4() && |
| 4100 flags & ~(CONTROL_FLAG_FIN | CONTROL_FLAG_UNIDIRECTIONAL)) { |
| 4101 EXPECT_CALL(visitor, OnError(_)); |
| 4102 } else if (IsSpdy4() && |
| 4103 flags & ~(CONTROL_FLAG_FIN | HEADERS_FLAG_PRIORITY)) { |
4080 EXPECT_CALL(visitor, OnError(_)); | 4104 EXPECT_CALL(visitor, OnError(_)); |
4081 } else { | 4105 } else { |
4082 EXPECT_CALL(debug_visitor, OnReceiveCompressedFrame(8, SYN_STREAM, _)); | 4106 EXPECT_CALL(debug_visitor, OnReceiveCompressedFrame(8, SYN_STREAM, _)); |
4083 EXPECT_CALL(visitor, OnSynStream(8, 3, 1, 0, flags & CONTROL_FLAG_FIN, | 4107 if (IsSpdy4()) { |
4084 flags & CONTROL_FLAG_UNIDIRECTIONAL)); | 4108 EXPECT_CALL(visitor, OnSynStream(8, 0, 1, 0, flags & CONTROL_FLAG_FIN, |
| 4109 false)); |
| 4110 } else { |
| 4111 EXPECT_CALL(visitor, OnSynStream(8, 3, 1, 0, flags & CONTROL_FLAG_FIN, |
| 4112 flags & CONTROL_FLAG_UNIDIRECTIONAL)); |
| 4113 } |
4085 EXPECT_CALL(visitor, OnControlFrameHeaderData(8, _, _)) | 4114 EXPECT_CALL(visitor, OnControlFrameHeaderData(8, _, _)) |
4086 .WillRepeatedly(testing::Return(true)); | 4115 .WillRepeatedly(testing::Return(true)); |
4087 if (flags & DATA_FLAG_FIN) { | 4116 if (flags & DATA_FLAG_FIN) { |
4088 EXPECT_CALL(visitor, OnStreamFrameData(_, _, 0, true)); | 4117 EXPECT_CALL(visitor, OnStreamFrameData(_, _, 0, true)); |
4089 } | 4118 } |
4090 } | 4119 } |
4091 | 4120 |
4092 framer.ProcessInput(frame->data(), frame->size()); | 4121 framer.ProcessInput(frame->data(), frame->size()); |
4093 if (flags & ~(CONTROL_FLAG_FIN | CONTROL_FLAG_UNIDIRECTIONAL)) { | 4122 if (!IsSpdy4() && |
| 4123 flags & ~(CONTROL_FLAG_FIN | CONTROL_FLAG_UNIDIRECTIONAL)) { |
4094 EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state()); | 4124 EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state()); |
4095 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS, | 4125 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS, |
4096 framer.error_code()) | 4126 framer.error_code()) |
| 4127 << SpdyFramer::ErrorCodeToString(framer.error_code()); |
| 4128 } else if (IsSpdy4() && |
| 4129 flags & ~(CONTROL_FLAG_FIN | HEADERS_FLAG_PRIORITY)) { |
| 4130 EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state()); |
| 4131 EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS, |
| 4132 framer.error_code()) |
4097 << SpdyFramer::ErrorCodeToString(framer.error_code()); | 4133 << SpdyFramer::ErrorCodeToString(framer.error_code()); |
4098 } else { | 4134 } else { |
4099 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); | 4135 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); |
4100 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) | 4136 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) |
4101 << SpdyFramer::ErrorCodeToString(framer.error_code()); | 4137 << SpdyFramer::ErrorCodeToString(framer.error_code()); |
4102 } | 4138 } |
4103 } | 4139 } |
4104 } | 4140 } |
4105 | 4141 |
4106 TEST_P(SpdyFramerTest, SynReplyFrameFlags) { | 4142 TEST_P(SpdyFramerTest, SynReplyFrameFlags) { |
| 4143 if (IsSpdy4()) { |
| 4144 // Covered by HEADERS case. |
| 4145 return; |
| 4146 } |
4107 for (int flags = 0; flags < 256; ++flags) { | 4147 for (int flags = 0; flags < 256; ++flags) { |
4108 SCOPED_TRACE(testing::Message() << "Flags " << flags); | 4148 SCOPED_TRACE(testing::Message() << "Flags " << flags); |
4109 | 4149 |
4110 testing::StrictMock<test::MockVisitor> visitor; | 4150 testing::StrictMock<test::MockVisitor> visitor; |
4111 SpdyFramer framer(spdy_version_); | 4151 SpdyFramer framer(spdy_version_); |
4112 framer.set_visitor(&visitor); | 4152 framer.set_visitor(&visitor); |
4113 | 4153 |
4114 SpdyHeaderBlock headers; | 4154 SpdyHeaderBlock headers; |
4115 headers["foo"] = "bar"; | 4155 headers["foo"] = "bar"; |
4116 scoped_ptr<SpdyFrame> frame( | 4156 scoped_ptr<SpdyFrame> frame( |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4236 } else { | 4276 } else { |
4237 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); | 4277 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); |
4238 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) | 4278 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) |
4239 << SpdyFramer::ErrorCodeToString(framer.error_code()); | 4279 << SpdyFramer::ErrorCodeToString(framer.error_code()); |
4240 } | 4280 } |
4241 } | 4281 } |
4242 } | 4282 } |
4243 | 4283 |
4244 TEST_P(SpdyFramerTest, HeadersFrameFlags) { | 4284 TEST_P(SpdyFramerTest, HeadersFrameFlags) { |
4245 for (int flags = 0; flags < 256; ++flags) { | 4285 for (int flags = 0; flags < 256; ++flags) { |
| 4286 if (IsSpdy4() && flags & HEADERS_FLAG_PRIORITY) { |
| 4287 // Covered by SYN_STREAM case. |
| 4288 continue; |
| 4289 } |
4246 SCOPED_TRACE(testing::Message() << "Flags " << flags); | 4290 SCOPED_TRACE(testing::Message() << "Flags " << flags); |
4247 | 4291 |
4248 testing::StrictMock<test::MockVisitor> visitor; | 4292 testing::StrictMock<test::MockVisitor> visitor; |
4249 SpdyFramer framer(spdy_version_); | 4293 SpdyFramer framer(spdy_version_); |
4250 framer.set_visitor(&visitor); | 4294 framer.set_visitor(&visitor); |
4251 | 4295 |
4252 SpdyHeaderBlock headers; | 4296 SpdyHeaderBlock headers; |
4253 headers["foo"] = "bar"; | 4297 headers["foo"] = "bar"; |
4254 scoped_ptr<SpdyFrame> frame( | 4298 scoped_ptr<SpdyFrame> frame( |
4255 framer.CreateHeaders(57, CONTROL_FLAG_NONE, true, &headers)); | 4299 framer.CreateHeaders(57, CONTROL_FLAG_NONE, true, &headers)); |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4583 SpdyBlockedIR blocked_ir(0); | 4627 SpdyBlockedIR blocked_ir(0); |
4584 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir)); | 4628 scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir)); |
4585 framer.ProcessInput(frame->data(), framer.GetBlockedSize()); | 4629 framer.ProcessInput(frame->data(), framer.GetBlockedSize()); |
4586 | 4630 |
4587 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); | 4631 EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state()); |
4588 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) | 4632 EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code()) |
4589 << SpdyFramer::ErrorCodeToString(framer.error_code()); | 4633 << SpdyFramer::ErrorCodeToString(framer.error_code()); |
4590 } | 4634 } |
4591 | 4635 |
4592 } // namespace net | 4636 } // namespace net |
OLD | NEW |