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..b1fa3305a6df1cc376c59fce4ccff79cf4d78156 100644 |
--- a/net/spdy/spdy_stream_unittest.cc |
+++ b/net/spdy/spdy_stream_unittest.cc |
@@ -34,13 +34,28 @@ namespace test { |
namespace { |
+enum TestCase { |
+ // Test using the SPDY/3.1 protocol. |
+ kTestCaseSPDY31, |
+ |
+ // Test using the HTTP/2 protocol, without specifying a stream |
+ // dependency based on the RequestPriority. |
+ kTestCaseHTTP2NoPriorityDependencies, |
+ |
+ // Test using the HTTP/2 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); |
+} // namespace |
+ |
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 +63,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 +82,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 +138,11 @@ class SpdyStreamTest : public ::testing::Test, |
int offset_; |
}; |
-INSTANTIATE_TEST_CASE_P(NextProto, |
+INSTANTIATE_TEST_CASE_P(ProtoPlusDepend, |
SpdyStreamTest, |
- testing::Values(kProtoSPDY31, |
- kProtoHTTP2)); |
+ testing::Values(kTestCaseSPDY31, |
+ kTestCaseHTTP2NoPriorityDependencies, |
+ kTestCaseHTTP2PriorityDependencies)); |
TEST_P(SpdyStreamTest, SendDataAfterOpen) { |
GURL url(kStreamUrl); |
@@ -1127,8 +1158,6 @@ TEST_P(SpdyStreamTest, ReceivedBytes) { |
EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate.WaitForClose()); |
} |
-} // namespace |
- |
} // namespace test |
} // namespace net |