Migrates adapter unit tests away from deprecated SubmitRequest/SubmitResponse methods. The methods accepting an extraneous nullptr argument will be removed in the near future. PiperOrigin-RevId: 700097040
diff --git a/quiche/http2/adapter/nghttp2_adapter_test.cc b/quiche/http2/adapter/nghttp2_adapter_test.cc index f153eb8..0674441 100644 --- a/quiche/http2/adapter/nghttp2_adapter_test.cc +++ b/quiche/http2/adapter/nghttp2_adapter_test.cc
@@ -112,18 +112,17 @@ const char* kSentinel1 = "arbitrary pointer 1"; const char* kSentinel3 = "arbitrary pointer 3"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; - const int32_t stream_id2 = - adapter->SubmitRequest(headers2, nullptr, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers2, true, nullptr); ASSERT_GT(stream_id2, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id2; - const int32_t stream_id3 = adapter->SubmitRequest( - headers3, nullptr, true, const_cast<char*>(kSentinel3)); + const int32_t stream_id3 = + adapter->SubmitRequest(headers3, true, const_cast<char*>(kSentinel3)); ASSERT_GT(stream_id3, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id3; @@ -285,8 +284,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); EXPECT_CALL(visitor, OnBeforeFrameSent(WINDOW_UPDATE, 0, 4, 0x0)); EXPECT_CALL(visitor, OnFrameSent(WINDOW_UPDATE, 0, 4, 0x0, 0)); @@ -314,8 +312,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers, true, nullptr); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id1, _, 0x5)); EXPECT_CALL(visitor, OnFrameSent(HEADERS, stream_id1, _, 0x5, 0)); @@ -371,8 +368,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/two"}}); - const int32_t stream_id2 = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers, true, nullptr); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id2, _, 0x5)); EXPECT_CALL(visitor, OnFrameSent(HEADERS, stream_id2, _, 0x5, 0)); @@ -394,8 +390,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -458,8 +453,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -519,8 +513,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id1, _, 0x5)); @@ -580,8 +573,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id1, _, 0x5)); @@ -664,8 +656,7 @@ adapter->SubmitSettings({}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, false, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, false, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -772,8 +763,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); const std::vector<Header> headers2 = @@ -782,8 +772,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/two"}}); - const int32_t stream_id2 = - adapter->SubmitRequest(headers2, nullptr, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers2, true, nullptr); ASSERT_GT(stream_id2, stream_id1); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id1, _, 0x5)); @@ -863,8 +852,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id1, _, 0x5)); @@ -925,8 +913,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id, _, 0x5)); @@ -981,8 +968,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1063,8 +1050,7 @@ // nghttp2 does not require that the data source indicate the end of data // before trailers are enqueued. - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, false, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, false, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_EQ(stream_id1, kStreamId); EXPECT_EQ(adapter->sources_size(), 0); @@ -1108,8 +1094,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1187,8 +1173,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id, _, 0x5)); @@ -1249,8 +1234,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1328,8 +1313,7 @@ {"x-like-them-with-a-mouse", "no"}, }); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id1, _, 0x5)); @@ -1369,8 +1353,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1455,8 +1439,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1530,8 +1514,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1597,8 +1581,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1663,8 +1647,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1741,8 +1725,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id, _, @@ -1812,8 +1795,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); const std::vector<Header> headers2 = @@ -1822,8 +1804,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/two"}}); - const int32_t stream_id2 = - adapter->SubmitRequest(headers2, nullptr, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers2, true, nullptr); ASSERT_GT(stream_id2, stream_id1); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id1, _, 0x5)); @@ -1893,8 +1874,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id1, _, 0x5)); @@ -1970,8 +1950,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id1, _, 0x5)); @@ -2057,8 +2036,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); const std::vector<Header> headers2 = @@ -2067,8 +2045,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/two"}}); - const int32_t stream_id2 = - adapter->SubmitRequest(headers2, nullptr, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers2, true, nullptr); ASSERT_GT(stream_id2, stream_id1); // The second request should be pending because of @@ -2123,8 +2100,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/three"}}); - const int32_t stream_id3 = - adapter->SubmitRequest(headers3, nullptr, true, nullptr); + const int32_t stream_id3 = adapter->SubmitRequest(headers3, true, nullptr); ASSERT_GT(stream_id3, stream_id2); // Nghttp2 closes the pending stream on the next write attempt. @@ -2150,8 +2126,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -2221,8 +2197,7 @@ {":path", "/this/is/request/one"}, {"upgrade", "new-protocol"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id1, _, 0x5)); @@ -2323,7 +2298,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, false, const_cast<char*>(kSentinel)); + false, const_cast<char*>(kSentinel)); ASSERT_EQ(1, stream_id); EXPECT_TRUE(adapter->want_write()); @@ -2361,7 +2336,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, true, nullptr); + true, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); const char* kSentinel2 = "arbitrary pointer 2"; @@ -2396,7 +2371,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, false, nullptr); + false, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -2443,7 +2418,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, false, nullptr); + false, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -2498,7 +2473,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, false, nullptr); + false, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -2563,7 +2538,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, true, nullptr); + true, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -2646,14 +2621,14 @@ {":path", "/example/request"}}); std::vector<int32_t> stream_ids; // Start two, which hits the limit. - int32_t stream_id = adapter->SubmitRequest(headers, nullptr, true, nullptr); + int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); stream_ids.push_back(stream_id); - stream_id = adapter->SubmitRequest(headers, nullptr, true, nullptr); + stream_id = adapter->SubmitRequest(headers, true, nullptr); stream_ids.push_back(stream_id); // Start two more, which must be queued. - stream_id = adapter->SubmitRequest(headers, nullptr, true, nullptr); + stream_id = adapter->SubmitRequest(headers, true, nullptr); stream_ids.push_back(stream_id); - stream_id = adapter->SubmitRequest(headers, nullptr, true, nullptr); + stream_id = adapter->SubmitRequest(headers, true, nullptr); stream_ids.push_back(stream_id); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x1)); @@ -2676,7 +2651,7 @@ adapter->ProcessBytes(update_streams); - stream_id = adapter->SubmitRequest(headers, nullptr, true, nullptr); + stream_id = adapter->SubmitRequest(headers, true, nullptr); stream_ids.push_back(stream_id); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x1)); @@ -2701,8 +2676,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); testing::InSequence s; @@ -2859,8 +2833,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); const quiche::HttpHeaderBlock block = ToHeaderBlock(ToHeaders( {{"query-cost", "is too darn high"}, {"secret-sauce", "hollandaise"}})); @@ -2926,8 +2899,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); const quiche::HttpHeaderBlock block = ToHeaderBlock(ToHeaders( {{"query-cost", "is too darn high"}, {"secret-sauce", "hollandaise"}})); @@ -2984,8 +2956,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); const quiche::HttpHeaderBlock block = ToHeaderBlock( ToHeaders({{"more-than-one-frame", std::string(20000, 'a')}})); @@ -3045,8 +3016,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); if (GetParam()) { // The test visitor returns an error if no metadata payload is found for the @@ -3133,7 +3103,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, false, nullptr); + false, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -3155,7 +3125,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/two"}}), - nullptr, true, nullptr); + true, nullptr); // A new pending stream is created, but because of MAX_CONCURRENT_STREAMS, the // session should not want to write it at the moment. @@ -3248,7 +3218,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, false, nullptr); + false, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -3300,7 +3270,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, false, nullptr); + false, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -3394,8 +3364,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id, _, 0x5)); EXPECT_CALL(visitor, OnFrameSent(HEADERS, stream_id, _, 0x5, 0)); @@ -3484,8 +3453,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id, _, 0x5)); EXPECT_CALL(visitor, OnFrameSent(HEADERS, stream_id, _, 0x5, 0)); @@ -3557,8 +3525,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id, _, 0x5)); EXPECT_CALL(visitor, OnFrameSent(HEADERS, stream_id, _, 0x5, 0)); @@ -3623,12 +3590,12 @@ const uint32_t large_frame_size = kDefaultFramePayloadSizeLimit + 42; adapter->SubmitSettings({{MAX_FRAME_SIZE, large_frame_size}}); - const int32_t stream_id = adapter->SubmitRequest( - ToHeaders({{":method", "GET"}, - {":scheme", "https"}, - {":authority", "example.com"}, - {":path", "/this/is/request/one"}}), - /*data_source=*/nullptr, true, /*user_data=*/nullptr); + const int32_t stream_id = + adapter->SubmitRequest(ToHeaders({{":method", "GET"}, + {":scheme", "https"}, + {":authority", "example.com"}, + {":path", "/this/is/request/one"}}), + true, /*user_data=*/nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -3690,12 +3657,12 @@ const uint32_t large_frame_size = kDefaultFramePayloadSizeLimit + 42; adapter->SubmitSettings({{MAX_FRAME_SIZE, large_frame_size}}); - const int32_t stream_id = adapter->SubmitRequest( - ToHeaders({{":method", "GET"}, - {":scheme", "https"}, - {":authority", "example.com"}, - {":path", "/this/is/request/one"}}), - /*data_source=*/nullptr, true, /*user_data=*/nullptr); + const int32_t stream_id = + adapter->SubmitRequest(ToHeaders({{":method", "GET"}, + {":scheme", "https"}, + {":authority", "example.com"}, + {":path", "/this/is/request/one"}}), + true, /*user_data=*/nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -3901,8 +3868,8 @@ visitor.AppendPayloadForStream( 1, "Here is some data, which will lead to a fatal error"); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(0, submit_result); EXPECT_TRUE(adapter->want_write()); @@ -4325,7 +4292,7 @@ visitor.AppendPayloadForStream(1, kBody); int submit_result = adapter->SubmitResponse( 1, ToHeaders({{":status", "200"}, {"x-comment", "Sure, sounds good."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -4409,8 +4376,8 @@ visitor.AppendPayloadForStream(1, kBody); visitor.SetEndData(1, true); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(submit_result, 0); const std::vector<Header> trailers = @@ -4476,8 +4443,8 @@ const absl::string_view kBody = "This is an example response body."; visitor.AppendPayloadForStream(1, kBody); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(submit_result, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, 0, ACK_FLAG)); @@ -5387,8 +5354,7 @@ // The server should still be able to send a response after receiving a GOAWAY // with a lower last-stream-ID field, as the stream was client-initiated. const int submit_result = - adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), - /*data_source=*/nullptr, true); + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), true); ASSERT_EQ(0, submit_result); EXPECT_TRUE(adapter->want_write()); @@ -5468,7 +5434,7 @@ 1, ToHeaders({{":status", "404"}, {"x-comment", "I have no idea what you're talking about."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -5549,7 +5515,7 @@ 1, ToHeaders({{":status", "404"}, {"x-comment", "I have no idea what you're talking about."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); EXPECT_EQ(adapter->sources_size(), 0); @@ -5683,7 +5649,7 @@ visitor.SetEndData(1, false); int submit_result = adapter->SubmitResponse( 1, ToHeaders({{":status", "200"}, {"x-comment", "Sure, sounds good."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -5855,7 +5821,7 @@ visitor.AppendPayloadForStream(1, "perfection"); visitor.SetEndData(1, true); - int submit_result = adapter->SubmitResponse(1, headers1, nullptr, false); + int submit_result = adapter->SubmitResponse(1, headers1, false); ASSERT_EQ(0, submit_result); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x1)); @@ -5910,7 +5876,7 @@ const std::vector<Header> headers1 = ToHeaders({{":status", "200"}}); - int submit_result = adapter->SubmitResponse(1, headers1, nullptr, false); + int submit_result = adapter->SubmitResponse(1, headers1, false); ASSERT_EQ(0, submit_result); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x1)); @@ -5988,7 +5954,7 @@ int submit_result = adapter->SubmitResponse( 1, ToHeaders({{":status", "200"}, {"x-comment", "Sure, sounds good."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -6050,8 +6016,8 @@ const int64_t result = adapter->ProcessBytes(frames); EXPECT_EQ(frames.size(), static_cast<size_t>(result)); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, true); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), true); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -6097,8 +6063,8 @@ const int64_t result = adapter->ProcessBytes(frames); EXPECT_EQ(frames.size(), static_cast<size_t>(result)); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, true); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), true); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -6222,7 +6188,7 @@ visitor.SetEndData(1, false); int submit_result = adapter->SubmitResponse( 1, ToHeaders({{":status", "200"}, {"x-comment", "Sure, sounds good."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -6335,7 +6301,7 @@ {"accept", "text/html"}}); const int32_t stream_id1 = - client_adapter->SubmitRequest(headers1, nullptr, true, nullptr); + client_adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(client_visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -6388,7 +6354,7 @@ {"cookie", "d=e, f, g; h"}}); const int32_t stream_id1 = - client_adapter->SubmitRequest(headers1, nullptr, true, nullptr); + client_adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(client_visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -7068,8 +7034,8 @@ visitor.AppendPayloadForStream( 1, "Here is some data, which will be completely ignored!"); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(0, submit_result); auto source = std::make_unique<TestMetadataSource>(ToHeaderBlock(ToHeaders( @@ -7135,8 +7101,8 @@ visitor.AppendPayloadForStream( 1, "Here is some data, which will be completely ignored!"); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(0, submit_result); auto source = std::make_unique<TestMetadataSource>(ToHeaderBlock(ToHeaders( @@ -7283,8 +7249,8 @@ // Submit a response for the stream. visitor.AppendPayloadForStream(1, "This data is doomed to never be written."); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(0, submit_result); // Submit a WINDOW_UPDATE frame. @@ -7970,8 +7936,8 @@ // Submit a response for the stream. visitor.AppendPayloadForStream(1, std::string(70000, 'a')); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(0, submit_result); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x1));
diff --git a/quiche/http2/adapter/oghttp2_adapter_test.cc b/quiche/http2/adapter/oghttp2_adapter_test.cc index 932e083..82980cb 100644 --- a/quiche/http2/adapter/oghttp2_adapter_test.cc +++ b/quiche/http2/adapter/oghttp2_adapter_test.cc
@@ -607,14 +607,10 @@ {":authority", "example.com"}, {":path", "/"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers, nullptr, true, nullptr); - const int32_t stream_id2 = - adapter->SubmitRequest(headers, nullptr, true, nullptr); - const int32_t stream_id3 = - adapter->SubmitRequest(headers, nullptr, true, nullptr); - const int32_t stream_id4 = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers, true, nullptr); + const int32_t stream_id3 = adapter->SubmitRequest(headers, true, nullptr); + const int32_t stream_id4 = adapter->SubmitRequest(headers, true, nullptr); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); EXPECT_CALL(visitor, OnFrameSent(SETTINGS, 0, _, 0x0, 0)); @@ -693,8 +689,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -776,8 +771,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); EXPECT_CALL(visitor, OnFrameSent(SETTINGS, 0, _, 0x0, 0)); @@ -811,8 +805,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers, true, nullptr); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); EXPECT_CALL(visitor, OnFrameSent(SETTINGS, 0, _, 0x0, 0)); @@ -877,8 +870,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/two"}}); - const int32_t stream_id2 = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers, true, nullptr); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id2, _, END_STREAM_FLAG | END_HEADERS_FLAG)); @@ -904,8 +896,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -974,8 +965,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1040,8 +1030,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -1107,8 +1096,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -1178,8 +1166,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); const std::vector<Header> headers2 = @@ -1188,8 +1175,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/two"}}); - const int32_t stream_id2 = - adapter->SubmitRequest(headers2, nullptr, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers2, true, nullptr); ASSERT_GT(stream_id2, stream_id1); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -1309,8 +1295,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, false, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, false, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -1419,8 +1404,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); const std::vector<Header> headers2 = @@ -1429,8 +1413,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/two"}}); - const int32_t stream_id2 = - adapter->SubmitRequest(headers2, nullptr, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers2, true, nullptr); ASSERT_GT(stream_id2, stream_id1); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -1514,8 +1497,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -1582,8 +1564,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -1644,8 +1625,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1730,8 +1711,7 @@ visitor.AppendPayloadForStream(1, kBody); visitor.SetEndData(1, false); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, false, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, false, nullptr); ASSERT_EQ(stream_id1, 1); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -1780,8 +1760,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1862,8 +1842,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -1937,8 +1917,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -2011,8 +1991,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -2087,8 +2067,7 @@ {"x-like-them-with-a-mouse", "no"}, }); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -2176,8 +2155,7 @@ {":path", "/this/is/request/one"}, }); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -2252,8 +2230,7 @@ {":path", "/this/is/request/two"}, }); - const int32_t stream_id2 = - adapter->SubmitRequest(headers2, nullptr, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers2, true, nullptr); ASSERT_GT(stream_id2, stream_id1); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id2, _, @@ -2318,8 +2295,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -2427,8 +2404,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -2503,8 +2479,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -2576,8 +2551,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); const std::vector<Header> headers2 = @@ -2586,8 +2560,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/two"}}); - const int32_t stream_id2 = - adapter->SubmitRequest(headers2, nullptr, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers2, true, nullptr); ASSERT_GT(stream_id2, stream_id1); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -2664,8 +2637,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -2749,8 +2721,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -2846,8 +2817,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); const std::vector<Header> headers2 = @@ -2856,8 +2826,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/two"}}); - const int32_t stream_id2 = - adapter->SubmitRequest(headers2, nullptr, true, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers2, true, nullptr); ASSERT_GT(stream_id2, stream_id1); // The second request should be pending because of @@ -2914,8 +2883,7 @@ {":authority", "example.com"}, {":path", "/this/is/request/three"}}); - const int32_t stream_id3 = - adapter->SubmitRequest(headers3, nullptr, true, nullptr); + const int32_t stream_id3 = adapter->SubmitRequest(headers3, true, nullptr); ASSERT_GT(stream_id3, stream_id2); // We close the pending stream on the next write attempt. @@ -2943,8 +2911,8 @@ {":path", "/this/is/request/one"}}); const char* kSentinel1 = "arbitrary pointer 1"; - const int32_t stream_id1 = adapter->SubmitRequest( - headers1, nullptr, true, const_cast<char*>(kSentinel1)); + const int32_t stream_id1 = + adapter->SubmitRequest(headers1, true, const_cast<char*>(kSentinel1)); ASSERT_GT(stream_id1, 0); QUICHE_LOG(INFO) << "Created stream: " << stream_id1; @@ -3023,8 +2991,7 @@ {":path", "/this/is/request/one"}, {"upgrade", "new-protocol"}}); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, true, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -3140,7 +3107,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, false, nullptr); + false, nullptr); ASSERT_EQ(stream_id, 1); EXPECT_TRUE(adapter->want_write()); @@ -3162,7 +3129,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/two"}}), - nullptr, true, nullptr); + true, nullptr); // A new pending stream is created, but because of MAX_CONCURRENT_STREAMS, the // session should not want to write it at the moment. @@ -3262,7 +3229,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, false, nullptr); + false, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -3318,7 +3285,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, false, nullptr); + false, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -3421,8 +3388,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -3514,12 +3480,12 @@ const uint32_t large_frame_size = kDefaultFramePayloadSizeLimit + 42; adapter->SubmitSettings({{MAX_FRAME_SIZE, large_frame_size}}); - const int32_t stream_id = adapter->SubmitRequest( - ToHeaders({{":method", "GET"}, - {":scheme", "https"}, - {":authority", "example.com"}, - {":path", "/this/is/request/one"}}), - /*data_source=*/nullptr, true, /*user_data=*/nullptr); + const int32_t stream_id = + adapter->SubmitRequest(ToHeaders({{":method", "GET"}, + {":scheme", "https"}, + {":authority", "example.com"}, + {":path", "/this/is/request/one"}}), + true, /*user_data=*/nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -3587,12 +3553,12 @@ const uint32_t large_frame_size = kDefaultFramePayloadSizeLimit + 42; adapter->SubmitSettings({{MAX_FRAME_SIZE, large_frame_size}}); - const int32_t stream_id = adapter->SubmitRequest( - ToHeaders({{":method", "GET"}, - {":scheme", "https"}, - {":authority", "example.com"}, - {":path", "/this/is/request/one"}}), - /*data_source=*/nullptr, true, /*user_data=*/nullptr); + const int32_t stream_id = + adapter->SubmitRequest(ToHeaders({{":method", "GET"}, + {":scheme", "https"}, + {":authority", "example.com"}, + {":path", "/this/is/request/one"}}), + true, /*user_data=*/nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -3678,8 +3644,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id, _, END_STREAM_FLAG | END_HEADERS_FLAG)); @@ -3755,8 +3720,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); ASSERT_GT(stream_id, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(HEADERS, stream_id, _, END_STREAM_FLAG | END_HEADERS_FLAG)); @@ -3836,7 +3800,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, false, nullptr); + false, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -3907,7 +3871,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, true, nullptr); + true, nullptr); EXPECT_GT(stream_id, 0); EXPECT_TRUE(adapter->want_write()); @@ -3976,8 +3940,7 @@ visitor.AppendPayloadForStream(1, kBody); visitor.SetEndData(1, false); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, false, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, false, nullptr); ASSERT_GT(stream_id1, 0); const std::vector<Header> headers2 = @@ -3989,8 +3952,7 @@ visitor.AppendPayloadForStream(3, kBody); visitor.SetEndData(3, false); - const int32_t stream_id2 = - adapter->SubmitRequest(headers2, nullptr, false, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers2, false, nullptr); ASSERT_EQ(stream_id2, 3); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -4056,8 +4018,7 @@ visitor.AppendPayloadForStream(1, "Really small body."); visitor.SetEndData(1, false); - const int32_t stream_id1 = - adapter->SubmitRequest(headers1, nullptr, false, nullptr); + const int32_t stream_id1 = adapter->SubmitRequest(headers1, false, nullptr); ASSERT_GT(stream_id1, 0); const std::vector<Header> headers2 = @@ -4070,8 +4031,7 @@ visitor.AppendPayloadForStream(3, kBody); visitor.SetEndData(3, false); - const int32_t stream_id2 = - adapter->SubmitRequest(headers2, nullptr, false, nullptr); + const int32_t stream_id2 = adapter->SubmitRequest(headers2, false, nullptr); ASSERT_GT(stream_id2, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -4139,14 +4099,14 @@ {":path", "/example/request"}}); std::vector<int32_t> stream_ids; // Start two, which hits the limit. - int32_t stream_id = adapter->SubmitRequest(headers, nullptr, true, nullptr); + int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); stream_ids.push_back(stream_id); - stream_id = adapter->SubmitRequest(headers, nullptr, true, nullptr); + stream_id = adapter->SubmitRequest(headers, true, nullptr); stream_ids.push_back(stream_id); // Start two more, which must be queued. - stream_id = adapter->SubmitRequest(headers, nullptr, true, nullptr); + stream_id = adapter->SubmitRequest(headers, true, nullptr); stream_ids.push_back(stream_id); - stream_id = adapter->SubmitRequest(headers, nullptr, true, nullptr); + stream_id = adapter->SubmitRequest(headers, true, nullptr); stream_ids.push_back(stream_id); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, ACK_FLAG)); @@ -4172,7 +4132,7 @@ EXPECT_CALL(visitor, OnSettingsEnd()); adapter->ProcessBytes(update_streams); - stream_id = adapter->SubmitRequest(headers, nullptr, true, nullptr); + stream_id = adapter->SubmitRequest(headers, true, nullptr); stream_ids.push_back(stream_id); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, ACK_FLAG)); @@ -4205,8 +4165,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/"}}); - const int32_t stream_id = - adapter->SubmitRequest(headers, nullptr, true, nullptr); + const int32_t stream_id = adapter->SubmitRequest(headers, true, nullptr); testing::InSequence s; @@ -4732,8 +4691,8 @@ visitor.AppendPayloadForStream( 1, "Here is some data, which will lead to a fatal error"); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(0, submit_result); EXPECT_TRUE(adapter->want_write()); @@ -4846,7 +4805,7 @@ visitor.AppendPayloadForStream(1, "perfection"); visitor.SetEndData(1, true); - int submit_result = adapter->SubmitResponse(1, headers1, nullptr, false); + int submit_result = adapter->SubmitResponse(1, headers1, false); ASSERT_EQ(0, submit_result); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -4905,7 +4864,7 @@ const std::vector<Header> headers1 = ToHeaders({{":status", "200"}}); - int submit_result = adapter->SubmitResponse(1, headers1, nullptr, false); + int submit_result = adapter->SubmitResponse(1, headers1, false); ASSERT_EQ(0, submit_result); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -5104,7 +5063,7 @@ visitor.SimulateError(1); int submit_result = adapter->SubmitResponse( 1, ToHeaders({{":status", "200"}, {"x-comment", "Sure, sounds good."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -5170,8 +5129,8 @@ const int64_t result = adapter->ProcessBytes(frames); EXPECT_EQ(frames.size(), static_cast<size_t>(result)); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, true); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), true); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -5224,8 +5183,8 @@ const int64_t result = adapter->ProcessBytes(frames); EXPECT_EQ(frames.size(), static_cast<size_t>(result)); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, true); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), true); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -5279,8 +5238,8 @@ const int64_t result = adapter->ProcessBytes(frames); EXPECT_EQ(frames.size(), static_cast<size_t>(result)); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, true); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), true); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -5405,7 +5364,7 @@ visitor.SetEndData(1, false); int submit_result = adapter->SubmitResponse( 1, ToHeaders({{":status", "200"}, {"x-comment", "Sure, sounds good."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -5715,7 +5674,7 @@ visitor.AppendPayloadForStream(1, kBody); int submit_result = adapter->SubmitResponse( 1, ToHeaders({{":status", "200"}, {"x-comment", "Sure, sounds good."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -5806,7 +5765,7 @@ visitor.AppendPayloadForStream(1, kBody); int submit_result = adapter->SubmitResponse( 1, ToHeaders({{":status", "200"}, {"x-comment", "Sure, sounds good."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -5910,8 +5869,8 @@ visitor.AppendPayloadForStream(1, kBody); visitor.SetEndData(1, true); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(submit_result, 0); const std::vector<Header> trailers = @@ -5979,8 +5938,8 @@ const absl::string_view kBody = "This is an example response body."; visitor.AppendPayloadForStream(1, kBody); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(submit_result, 0); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -6875,8 +6834,7 @@ // The server should still be able to send a response after receiving a GOAWAY // with a lower last-stream-ID field, as the stream was client-initiated. const int submit_result = - adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), - /*data_source=*/nullptr, true); + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), true); ASSERT_EQ(0, submit_result); EXPECT_TRUE(adapter->want_write()); @@ -6966,7 +6924,7 @@ 1, ToHeaders({{":status", "404"}, {"x-comment", "I have no idea what you're talking about."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -7052,7 +7010,7 @@ 1, ToHeaders({{":status", "404"}, {"x-comment", "I have no idea what you're talking about."}}), - nullptr, false); + false); EXPECT_EQ(submit_result, 0); EXPECT_TRUE(adapter->want_write()); @@ -7164,8 +7122,8 @@ // Sets up the server to respond automatically to a request from a client. EXPECT_CALL(server_visitor, OnEndHeadersForStream(_)) .WillRepeatedly([&server_adapter](Http2StreamId stream_id) { - server_adapter->SubmitResponse( - stream_id, ToHeaders({{":status", "200"}}), nullptr, true); + server_adapter->SubmitResponse(stream_id, + ToHeaders({{":status", "200"}}), true); server_adapter->Send(); return true; }); @@ -7185,7 +7143,7 @@ {":authority", "example.com"}, {":path", absl::StrCat("/this/is/request/", new_stream_id)}}), - nullptr, false, nullptr); + false, nullptr); EXPECT_EQ(new_stream_id, created_stream_id); client_adapter->Send(); } @@ -7198,7 +7156,7 @@ {":scheme", "http"}, {":authority", "example.com"}, {":path", "/this/is/request/one"}}), - nullptr, true, nullptr); + true, nullptr); EXPECT_EQ(stream_id, 1); client_adapter->Send(); @@ -7220,7 +7178,7 @@ {"accept", "text/html"}}); const int32_t stream_id1 = - client_adapter->SubmitRequest(headers1, nullptr, true, nullptr); + client_adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(client_visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -7281,7 +7239,7 @@ {"cookie", "d=e, f, g; h"}}); const int32_t stream_id1 = - client_adapter->SubmitRequest(headers1, nullptr, true, nullptr); + client_adapter->SubmitRequest(headers1, true, nullptr); ASSERT_GT(stream_id1, 0); EXPECT_CALL(client_visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -7881,8 +7839,8 @@ visitor.AppendPayloadForStream( 1, "Here is some data, which will be completely ignored!"); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(0, submit_result); auto source = std::make_unique<TestMetadataSource>(ToHeaderBlock(ToHeaders( @@ -8064,8 +8022,8 @@ // Submit a response for the stream. visitor.AppendPayloadForStream(1, "This data is doomed to never be written."); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(0, submit_result); // Submit a WINDOW_UPDATE frame. @@ -8940,8 +8898,8 @@ // Submit a response for the stream. visitor.AppendPayloadForStream(1, std::string(70000, 'a')); - int submit_result = adapter->SubmitResponse( - 1, ToHeaders({{":status", "200"}}), nullptr, false); + int submit_result = + adapter->SubmitResponse(1, ToHeaders({{":status", "200"}}), false); ASSERT_EQ(0, submit_result); EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0)); @@ -9011,7 +8969,7 @@ {":path", "/this/is/request/one"}}); const int32_t stream_id1 = - client_adapter->SubmitRequest(request_headers, nullptr, true, nullptr); + client_adapter->SubmitRequest(request_headers, true, nullptr); ASSERT_GT(stream_id1, 0); // Client visitor expectations on send. @@ -9052,8 +9010,8 @@ {"set-cookie", "chocolate_chip=yummy"}, {"set-cookie", "macadamia_nut=okay"}}); - EXPECT_EQ(0, server_adapter->SubmitResponse(stream_id1, response_headers, - nullptr, true)); + EXPECT_EQ(0, + server_adapter->SubmitResponse(stream_id1, response_headers, true)); // Server visitor expectations on send. // Server preface with initial SETTINGS.