Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1913)

Unified Diff: net/spdy/spdy_stream_unittest.cc

Issue 1411383005: Initial implementation of RequestPriority-based HTTP/2 dependencies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final round of comments. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_session_unittest.cc ('k') | net/spdy/spdy_test_util_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/spdy/spdy_session_unittest.cc ('k') | net/spdy/spdy_test_util_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698