Fix tests that were broken by OnLoadEnd() no longer being called for failed provisional loading (issue #381).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@343 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-10-28 17:13:06 +00:00
parent 5155483796
commit acf7cf5738
2 changed files with 19 additions and 8 deletions

View File

@ -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<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int httpStatusCode) OVERRIDE
{
if(!browser->IsPopup() && frame->IsMain())
DestroyTest();
}
CefRefPtr<CefRequest> request_;
};

View File

@ -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<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
@ -198,6 +211,10 @@ public:
}
return true;
}
// Response was canceled.
if (g_current_handler)
g_current_handler->DestroyTest();
return false;
}