SpdySession depends on Http2PushPromiseIndex, and Http2PushPromiseIndex depends on SpdySession. This kind of circular dependency is considered bad and should be changed. One reason is testability: in order to solve issue 776415 , Http2PushPromiseIndex must be able to claim pushed streams (when HttpStreamFactoryImpl::Job requests so), and notify SpdySession. However, SpdySession might require that the stream actually exists, like it used to do in order to log histogram Net.PushedStreamAlreadyHasResponseHeaders which was recently removed in https://crrev.com/c/771544. In order to be able to test Http2PushPromiseIndex in isolation, it should interact with a Delegate, instead of SpdySession, and this Delegate can have a trivial implementation for tests, or a mock implementation for ensuring certain methods are called etc.
At least one appropriate DCHECK() cannot be a added to SpdySession [1] because real instances are used in Http2PushPromiseIndexTest. While this particular one will be solved once issue 791054 is solved, using a Delegate will allow for other meaningful checks (like stream must be active).
[1] https://chromium-review.googlesource.com/c/chromium/src/+/797438/2/net/spdy/chromium/spdy_session.cc#1365
Comment 1 by bugdroid1@chromium.org
, Dec 2 2017