Test dead code.
Test a log method that could be helpful for debugging. Also inline SpdyPriorityIR constructors for code convergence.
This CL lands server change 87053738 by birenroy.
BUG=
Committed: https://crrev.com/e44eb0a35c11f8ff743873f5f382b5d5c5353325
Cr-Commit-Position: refs/heads/master@{#319724}
Review URL: https://codereview.chromium.org/988733003
Cr-Commit-Position: refs/heads/master@{#320215}
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
index ced4f92..d7582ff1 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -3290,18 +3290,19 @@
const char kDescription[] = "CONTINUATION frame";
const unsigned char kFrameData[] = {
- 0x00, 0x00, 0x12, 0x09, 0x00, // CONTINUATION
- 0x00, 0x00, 0x00, 0x2a, // Stream 42
- 0x00, 0x03, 0x62, 0x61, // @.ba
- 0x72, 0x03, 0x66, 0x6f, // r.fo
- 0x6f, 0x00, 0x03, 0x66, // [email protected]
- 0x6f, 0x6f, 0x03, 0x62, // oo.b
- 0x61, 0x72, // ar
+ 0x00, 0x00, 0x12, 0x09, // CONTINUATION
+ 0x04, 0x00, 0x00, 0x00, // end_headers = true
+ 0x2a, 0x00, 0x03, 0x62, // Stream 42, @.b
+ 0x61, 0x72, 0x03, 0x66, // ar.f
+ 0x6f, 0x6f, 0x00, 0x03, // oo@.
+ 0x66, 0x6f, 0x6f, 0x03, // foo.
+ 0x62, 0x61, 0x72, // bar
};
SpdyContinuationIR continuation(42);
continuation.SetHeader("bar", "foo");
continuation.SetHeader("foo", "bar");
+ continuation.set_end_headers(true);
scoped_ptr<SpdySerializedFrame> frame(
framer.SerializeContinuation(continuation));
CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData));
@@ -3458,6 +3459,12 @@
SpdyPriorityIR priority_ir(2, 1, 16, true);
scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(priority_ir));
CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData));
+ SpdyPriorityIR priority2(2);
+ priority2.set_parent_stream_id(1);
+ priority2.set_weight(16);
+ priority2.set_exclusive(true);
+ frame.reset(framer.SerializeFrame(priority2));
+ CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData));
}
TEST_P(SpdyFramerTest, ReadCompressedSynStreamHeaderBlock) {
diff --git a/net/spdy/spdy_headers_block_parser_test.cc b/net/spdy/spdy_headers_block_parser_test.cc
index 2bb888d..bd4a01bf 100644
--- a/net/spdy/spdy_headers_block_parser_test.cc
+++ b/net/spdy/spdy_headers_block_parser_test.cc
@@ -117,6 +117,8 @@
// Sanity test, verify that we parse out correctly a block with
// a single key-value pair and that we notify when we start and finish
// handling a headers block.
+ EXPECT_EQ(spdy_version_, parser_->spdy_version());
+
string headers(CreateHeaders(1, false));
EXPECT_CALL(handler_, OnHeaderBlock(1)).Times(1);
diff --git a/net/spdy/spdy_priority_tree_test.cc b/net/spdy/spdy_priority_tree_test.cc
index fcfec6b..e84d079a 100644
--- a/net/spdy/spdy_priority_tree_test.cc
+++ b/net/spdy/spdy_priority_tree_test.cc
@@ -5,6 +5,7 @@
#include "net/spdy/spdy_priority_tree.h"
#include "base/basictypes.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
@@ -35,6 +36,8 @@
ASSERT_TRUE(tree.NodeExists(1));
EXPECT_EQ(100, tree.GetWeight(1));
EXPECT_FALSE(tree.NodeExists(5));
+ EXPECT_THAT(tree.GetChildren(0),
+ ::testing::Pointee(::testing::ElementsAre(1)));
EXPECT_TRUE(tree.AddNode(5, 0, 50, false));
// Should not be able to add a node with an id that already exists.
@@ -71,6 +74,11 @@
// Try adding a second child to node 13:
EXPECT_TRUE(tree.AddNode(17, 13, 170, false));
+ // TODO(birenroy): Add a separate test that verifies weight invariants when
+ // SetWeight is called.
+ EXPECT_TRUE(tree.SetWeight(17, 150));
+ EXPECT_EQ(150, tree.GetWeight(17));
+
ASSERT_TRUE(tree.ValidateInvariantsForTests());
}
diff --git a/net/spdy/spdy_protocol.cc b/net/spdy/spdy_protocol.cc
index 3993c01..9f311d6 100644
--- a/net/spdy/spdy_protocol.cc
+++ b/net/spdy/spdy_protocol.cc
@@ -852,20 +852,6 @@
return visitor->VisitAltSvc(*this);
}
-SpdyPriorityIR::SpdyPriorityIR(SpdyStreamId stream_id)
- : SpdyFrameWithStreamIdIR(stream_id) {
-}
-
-SpdyPriorityIR::SpdyPriorityIR(SpdyStreamId stream_id,
- SpdyStreamId parent_stream_id,
- uint8 weight,
- bool exclusive)
- : SpdyFrameWithStreamIdIR(stream_id),
- parent_stream_id_(parent_stream_id),
- weight_(weight),
- exclusive_(exclusive) {
-}
-
void SpdyPriorityIR::Visit(SpdyFrameVisitor* visitor) const {
return visitor->VisitPriority(*this);
}
diff --git a/net/spdy/spdy_protocol.h b/net/spdy/spdy_protocol.h
index 0f37236..1837feb2 100644
--- a/net/spdy/spdy_protocol.h
+++ b/net/spdy/spdy_protocol.h
@@ -994,11 +994,19 @@
class NET_EXPORT_PRIVATE SpdyPriorityIR : public SpdyFrameWithStreamIdIR {
public:
- explicit SpdyPriorityIR(SpdyStreamId stream_id);
+ explicit SpdyPriorityIR(SpdyStreamId stream_id)
+ : SpdyFrameWithStreamIdIR(stream_id),
+ parent_stream_id_(0),
+ weight_(1),
+ exclusive_(false) {}
explicit SpdyPriorityIR(SpdyStreamId stream_id,
SpdyStreamId parent_stream_id,
uint8 weight,
- bool exclusive);
+ bool exclusive)
+ : SpdyFrameWithStreamIdIR(stream_id),
+ parent_stream_id_(parent_stream_id),
+ weight_(weight),
+ exclusive_(exclusive) {}
SpdyStreamId parent_stream_id() const { return parent_stream_id_; }
void set_parent_stream_id(SpdyStreamId id) { parent_stream_id_ = id; }
uint8 weight() const { return weight_; }