add method to FlowControlManager to tell if Stream contribues to connection-level flow control

This commit is contained in:
Marten Seemann
2016-06-16 15:56:34 +07:00
committed by Lucas Clemente
parent ef9baf67fc
commit 1b732a4afa
4 changed files with 36 additions and 0 deletions

View File

@@ -171,5 +171,26 @@ var _ = Describe("Flow Control Manager", func() {
Expect(size).To(Equal(protocol.ByteCount(0x1000)))
})
})
Context("streams contributing to connection-level flow control", func() {
It("says that a stream contributes", func() {
fcm.NewStream(5, true)
contributes, err := fcm.StreamContributesToConnectionFlowControl(5)
Expect(err).ToNot(HaveOccurred())
Expect(contributes).To(BeTrue())
})
It("says that a stream doesn't contribute", func() {
fcm.NewStream(3, false)
contributes, err := fcm.StreamContributesToConnectionFlowControl(3)
Expect(err).ToNot(HaveOccurred())
Expect(contributes).To(BeFalse())
})
It("returns an error for an unknown stream", func() {
_, err := fcm.StreamContributesToConnectionFlowControl(1337)
Expect(err).To(HaveOccurred())
})
})
})
})