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

Unified Diff: net/spdy/spdy_http_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: Tweaked comments and destruction notification vs. extra test util class. 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
Index: net/spdy/spdy_http_stream_unittest.cc
diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc
index fc2989aaad866d715955f6486ee543ee67de6a2c..fc3be52a9d41430f15c484a630751fd7f822fa71 100644
--- a/net/spdy/spdy_http_stream_unittest.cc
+++ b/net/spdy/spdy_http_stream_unittest.cc
@@ -34,6 +34,19 @@ namespace net {
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
+};
+
// Tests the load timing of a stream that's connected and is not the first
// request sent on a connection.
void TestLoadTimingReused(const HttpStream& stream) {
@@ -64,15 +77,29 @@ void TestLoadTimingNotReused(const HttpStream& stream) {
} // namespace
class SpdyHttpStreamTest : public testing::Test,
- public testing::WithParamInterface<NextProto> {
+ public testing::WithParamInterface<TestCase> {
public:
SpdyHttpStreamTest()
- : spdy_util_(GetParam()),
- session_deps_(GetParam()) {
+ : spdy_util_(GetProtocol(), GetDependenciesFromPriority()),
+ session_deps_(GetProtocol()) {
+ SpdySession::SetPriorityDependencyDefaultForTesting(
+ GetDependenciesFromPriority());
session_deps_.net_log = &net_log_;
}
+ ~SpdyHttpStreamTest() {
+ SpdySession::SetPriorityDependencyDefaultForTesting(false);
+ }
+
protected:
+ NextProto GetProtocol() const {
+ return GetParam() == kTestCaseSPDY31 ? kProtoSPDY31 : kProtoHTTP2;
+ }
+
+ bool GetDependenciesFromPriority() const {
+ return GetParam() == kTestCaseHTTP2PriorityDependencies;
+ }
+
void TearDown() override {
crypto::ECSignatureCreator::SetFactoryForTesting(NULL);
base::MessageLoop::current()->RunUntilIdle();
@@ -110,10 +137,11 @@ class SpdyHttpStreamTest : public testing::Test,
MockECSignatureCreatorFactory ec_signature_creator_factory_;
};
-INSTANTIATE_TEST_CASE_P(NextProto,
+INSTANTIATE_TEST_CASE_P(ProtoPlusDepend,
SpdyHttpStreamTest,
- testing::Values(kProtoSPDY31,
- kProtoHTTP2));
+ testing::Values(kTestCaseSPDY31,
+ kTestCaseHTTP2NoPriorityDependencies,
+ kTestCaseHTTP2PriorityDependencies));
// SpdyHttpStream::GetUploadProgress() should still work even before the
// stream is initialized.

Powered by Google App Engine
This is Rietveld 408576698