diff --git a/tests/unittests/request_unittest.cc b/tests/unittests/request_unittest.cc index 2aa71f7cc..4b48208e6 100644 --- a/tests/unittests/request_unittest.cc +++ b/tests/unittests/request_unittest.cc @@ -267,18 +267,12 @@ public: // Verify that the request is the same VerifyRequestEqual(request_, request, true); + DestroyTest(); + // No results return true; } - virtual void OnLoadEnd(CefRefPtr browser, - CefRefPtr frame, - int httpStatusCode) OVERRIDE - { - if(!browser->IsPopup() && frame->IsMain()) - DestroyTest(); - } - CefRefPtr request_; }; diff --git a/tests/unittests/scheme_handler_unittest.cc b/tests/unittests/scheme_handler_unittest.cc index e32eab40b..d7fb728db 100644 --- a/tests/unittests/scheme_handler_unittest.cc +++ b/tests/unittests/scheme_handler_unittest.cc @@ -67,12 +67,18 @@ public: got_sub_success; }; +// Current scheme handler object. Used when destroying the test from +// ClientSchemeHandler::ProcessRequest(). +class TestSchemeHandler; +TestSchemeHandler* g_current_handler = NULL; + class TestSchemeHandler : public TestHandler { public: TestSchemeHandler(TestResults* tr) : test_results_(tr) { + g_current_handler = this; } virtual void RunTest() OVERRIDE @@ -80,6 +86,13 @@ public: CreateBrowser(test_results_->url); } + // Necessary to make the method public in order to destroy the test from + // ClientSchemeHandler::ProcessRequest(). + void DestroyTest() + { + TestHandler::DestroyTest(); + } + virtual bool OnBeforeBrowse(CefRefPtr browser, CefRefPtr frame, CefRefPtr request, @@ -198,6 +211,10 @@ public: } return true; } + + // Response was canceled. + if (g_current_handler) + g_current_handler->DestroyTest(); return false; }