From 168408620d6d63faf084d2717ba22a3a39f9e6f8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 15 Jan 2021 00:53:45 +0100 Subject: [PATCH] Add wxWebRequest::Cancel() unit test Check that the request does get cancelled and has the correct state. --- tests/net/webrequest.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/net/webrequest.cpp b/tests/net/webrequest.cpp index 8e54152600..7f77ee9b25 100644 --- a/tests/net/webrequest.cpp +++ b/tests/net/webrequest.cpp @@ -282,6 +282,19 @@ TEST_CASE_METHOD(RequestFixture, } } +TEST_CASE_METHOD(RequestFixture, + "WebRequest::Cancel", "[net][webrequest]") +{ + if ( !InitBaseURL() ) + return; + + Create("/delay/10"); + request.Start(); + request.Cancel(); + RunLoopWithTimeout(); + REQUIRE( request.GetState() == wxWebRequest::State_Cancelled ); +} + // This test is not run by default and has to be explicitly selected to run. TEST_CASE_METHOD(RequestFixture, "WebRequest::Manual", "[net][webrequest][auth][.]")