Index: net/spdy/spdy_stream_unittest.cc |
diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc |
index e4fd077d01545b9ec48f144860d1e77f2e4d4f90..dfad69010c2513ce53b6e5bc846146b93c9b5711 100644 |
--- a/net/spdy/spdy_stream_unittest.cc |
+++ b/net/spdy/spdy_stream_unittest.cc |
@@ -34,13 +34,26 @@ namespace test { |
namespace { |
+enum TestCase { |
+ // Test using the SPDY 3.1 protocol. |
+ kTestCaseSPDY31, |
+ |
+ // Test using the HTTP2 protocol, without specifying a stream |
+ // dependency based on the RequestPriority. |
+ kTestCaseHTTP2NoPriorityDependencies, |
+ |
+ // Test using the HTTP2 protocol, specifying a stream |
+ // dependency based on the RequestPriority. |
+ kTestCaseHTTP2PriorityDependencies |
+}; |
+ |
const char kStreamUrl[] = "http://www.example.org/"; |
const char kPostBody[] = "\0hello!\xff"; |
const size_t kPostBodyLength = arraysize(kPostBody); |
const base::StringPiece kPostBodyStringPiece(kPostBody, kPostBodyLength); |
class SpdyStreamTest : public ::testing::Test, |
- public ::testing::WithParamInterface<NextProto> { |
+ public ::testing::WithParamInterface<TestCase> { |
protected: |
// A function that takes a SpdyStream and the number of bytes which |
// will unstall the next frame completely. |
@@ -48,9 +61,16 @@ class SpdyStreamTest : public ::testing::Test, |
UnstallFunction; |
SpdyStreamTest() |
- : spdy_util_(GetParam()), |
- session_deps_(GetParam()), |
- offset_(0) {} |
+ : spdy_util_(GetProtocol(), GetDependenciesFromPriority()), |
+ session_deps_(GetProtocol()), |
+ offset_(0) { |
+ SpdySession::SetPriorityDependencyDefaultForTesting( |
+ GetDependenciesFromPriority()); |
+ } |
+ |
+ ~SpdyStreamTest() { |
+ SpdySession::SetPriorityDependencyDefaultForTesting(false); |
+ } |
base::WeakPtr<SpdySession> CreateDefaultSpdySession() { |
SpdySessionKey key(HostPortPair("www.example.org", 80), |
@@ -60,6 +80,14 @@ class SpdyStreamTest : public ::testing::Test, |
void TearDown() override { base::MessageLoop::current()->RunUntilIdle(); } |
+ NextProto GetProtocol() const { |
+ return GetParam() == kTestCaseSPDY31 ? kProtoSPDY31 : kProtoHTTP2; |
+ } |
+ |
+ bool GetDependenciesFromPriority() const { |
+ return GetParam() == kTestCaseHTTP2PriorityDependencies; |
+ } |
+ |
void RunResumeAfterUnstallRequestResponseTest( |
const UnstallFunction& unstall_function); |
@@ -108,10 +136,11 @@ class SpdyStreamTest : public ::testing::Test, |
int offset_; |
}; |
-INSTANTIATE_TEST_CASE_P(NextProto, |
+INSTANTIATE_TEST_CASE_P(TestCase, |
SpdyStreamTest, |
- testing::Values(kProtoSPDY31, |
- kProtoHTTP2)); |
+ testing::Values(kTestCaseSPDY31, |
+ kTestCaseHTTP2NoPriorityDependencies, |
+ kTestCaseHTTP2PriorityDependencies)); |
TEST_P(SpdyStreamTest, SendDataAfterOpen) { |
GURL url(kStreamUrl); |