#include "quiche/http2/adapter/window_manager.h" #include <algorithm> #include <list> #include "absl/functional/bind_front.h" #include "quiche/http2/test_tools/http2_random.h" #include "quiche/common/platform/api/quiche_expect_bug.h" #include "quiche/common/platform/api/quiche_test.h" namespace http2 { namespace adapter { namespace test { // Use the peer to access private vars of WindowManager. class WindowManagerPeer { … }; namespace { class WindowManagerTest : public quiche::test::QuicheTest { … }; // A few no-op calls. TEST_F(WindowManagerTest, NoOps) { … } // This test verifies that WindowManager does not notify its listener when data // is only buffered, and never flushed. TEST_F(WindowManagerTest, DataOnlyBuffered) { … } // This test verifies that WindowManager does notify its listener when data is // buffered and subsequently flushed. TEST_F(WindowManagerTest, DataBufferedAndFlushed) { … } // Window manager should avoid window underflow. TEST_F(WindowManagerTest, AvoidWindowUnderflow) { … } // Window manager should GFE_BUG and avoid buffered underflow. TEST_F(WindowManagerTest, AvoidBufferedUnderflow) { … } // This test verifies that WindowManager notifies its listener when window is // consumed (data is ignored or immediately dropped). TEST_F(WindowManagerTest, WindowConsumed) { … } // This test verifies that WindowManager notifies its listener when the window // size limit is increased. TEST_F(WindowManagerTest, ListenerCalledOnSizeUpdate) { … } // This test verifies that when data is buffered and then the limit is // decreased, WindowManager only notifies the listener once any outstanding // window has been consumed. TEST_F(WindowManagerTest, WindowUpdateAfterLimitDecreased) { … } // For normal behavior, we only call MaybeNotifyListener() when data is // flushed. But if window runs out entirely, we still need to call // MaybeNotifyListener() to avoid becoming artificially blocked when data isn't // being flushed. TEST_F(WindowManagerTest, ZeroWindowNotification) { … } TEST_F(WindowManagerTest, OnWindowSizeLimitChange) { … } TEST_F(WindowManagerTest, NegativeWindowSize) { … } TEST_F(WindowManagerTest, IncreaseWindow) { … } // This test verifies that when the constructor option is specified, // WindowManager does not update its internal accounting of the flow control // window when notifying the listener. TEST(WindowManagerNoUpdateTest, NoWindowUpdateOnListener) { … } // This test verifies that when the constructor option is specified, // WindowManager uses the provided ShouldWindowUpdateFn to determine when to // notify the listener. TEST(WindowManagerShouldUpdateTest, CustomShouldWindowUpdateFn) { … } } // namespace } // namespace test } // namespace adapter } // namespace http2