diff options
Diffstat (limited to 'net/spdy/spdy_test_util_common.h')
-rw-r--r-- | net/spdy/spdy_test_util_common.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/net/spdy/spdy_test_util_common.h b/net/spdy/spdy_test_util_common.h index 4f45bc6..ff857ca 100644 --- a/net/spdy/spdy_test_util_common.h +++ b/net/spdy/spdy_test_util_common.h @@ -5,16 +5,55 @@ #ifndef NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ #define NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ +#include "base/memory/ref_counted.h" +#include "net/base/completion_callback.h" +#include "net/base/request_priority.h" +#include "net/base/test_completion_callback.h" #include "net/spdy/spdy_protocol.h" +class GURL; + namespace net { +class BoundNetLog; +class SpdySession; +class SpdyStream; +class SpdyStreamRequest; + // Returns the SpdyPriority embedded in the given frame. Returns true // and fills in |priority| on success. bool GetSpdyPriority(int version, const SpdyFrame& frame, SpdyPriority* priority); +// Tries to create a stream in |session| synchronously. Returns NULL +// on failure. +scoped_refptr<SpdyStream> CreateStreamSynchronously( + const scoped_refptr<SpdySession>& session, + const GURL& url, + RequestPriority priority, + const BoundNetLog& net_log); + +// Helper class used by some tests to release two streams as soon as +// one is created. +class StreamReleaserCallback : public TestCompletionCallbackBase { + public: + StreamReleaserCallback(SpdySession* session, + SpdyStream* first_stream); + + virtual ~StreamReleaserCallback(); + + // Returns a callback that releases |request|'s stream as well as + // |first_stream|. + CompletionCallback MakeCallback(SpdyStreamRequest* request); + + private: + void OnComplete(SpdyStreamRequest* request, int result); + + scoped_refptr<SpdySession> session_; + scoped_refptr<SpdyStream> first_stream_; +}; + } // namespace net #endif // NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ |