Add on_write_buffer_drained
This commit is contained in:
@@ -88,3 +88,35 @@ TEST_CASE("HttpHandler route parsing edge cases") {
|
||||
HttpRoute::GET_retention);
|
||||
}
|
||||
}
|
||||
|
||||
// Test helper to verify the new hook functionality
|
||||
struct MockConnectionHandler : public ConnectionHandler {
|
||||
bool write_progress_called = false;
|
||||
bool write_buffer_drained_called = false;
|
||||
|
||||
void on_write_progress(std::unique_ptr<Connection> &) override {
|
||||
write_progress_called = true;
|
||||
}
|
||||
|
||||
void on_write_buffer_drained(std::unique_ptr<Connection> &) override {
|
||||
write_buffer_drained_called = true;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_CASE("ConnectionHandler hooks") {
|
||||
SUBCASE("on_write_buffer_drained hook exists") {
|
||||
MockConnectionHandler handler;
|
||||
|
||||
// Verify hooks are available and can be overridden
|
||||
CHECK_FALSE(handler.write_progress_called);
|
||||
CHECK_FALSE(handler.write_buffer_drained_called);
|
||||
|
||||
// Would normally be called by Server during write operations
|
||||
std::unique_ptr<Connection> null_conn;
|
||||
handler.on_write_progress(null_conn);
|
||||
handler.on_write_buffer_drained(null_conn);
|
||||
|
||||
CHECK(handler.write_progress_called);
|
||||
CHECK(handler.write_buffer_drained_called);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user