mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Significant API changes for issue #218:
- Replace CefHandler with a new CefClient interface and separate handler interfaces. - Add support for virtual inheritance to allow multiple CefBase parented interfaces to be implemented in the same class. - Replace CefThreadSafeBase with IMPLEMENT_* macros to support virtual inheritance and to only provide locking implementations when needed. - Move the CefBrowserSettings parameter from CefInitialize to CreateBrowser. - Add a new cef_build.h header that provides platform-specific and OS_* defines. - Introduce the use of OVERRIDE to generate compiler errors on Windows if a child virtual method declaration doesn't match the parent declaration. - Use NDEBUG instead of _DEBUG because _DEBUG is not defined on Mac. (issue #240). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@235 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -44,15 +44,16 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void RunTest()
|
||||
virtual void RunTest() OVERRIDE
|
||||
{
|
||||
CreateBrowser(test_results_->url);
|
||||
}
|
||||
|
||||
virtual RetVal HandleBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
NavType navType, bool isRedirect)
|
||||
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
NavType navType,
|
||||
bool isRedirect) OVERRIDE
|
||||
{
|
||||
if (isRedirect) {
|
||||
test_results_->got_redirect.yes();
|
||||
@@ -68,12 +69,12 @@ public:
|
||||
test_results_->redirect_url.clear();
|
||||
}
|
||||
|
||||
return RV_CONTINUE;
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode)
|
||||
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode) OVERRIDE
|
||||
{
|
||||
// Test that the output is correct.
|
||||
std::string output = frame->GetSource();
|
||||
@@ -84,15 +85,13 @@ public:
|
||||
EXPECT_EQ(httpStatusCode, test_results_->status_code);
|
||||
|
||||
DestroyTest();
|
||||
|
||||
return RV_CONTINUE;
|
||||
}
|
||||
|
||||
protected:
|
||||
TestResults* test_results_;
|
||||
};
|
||||
|
||||
class ClientSchemeHandler : public CefThreadSafeBase<CefSchemeHandler>
|
||||
class ClientSchemeHandler : public CefSchemeHandler
|
||||
{
|
||||
public:
|
||||
ClientSchemeHandler(TestResults* tr)
|
||||
@@ -138,7 +137,7 @@ public:
|
||||
bool has_data = false;
|
||||
*bytes_read = 0;
|
||||
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
|
||||
size_t size = test_results_->html.size();
|
||||
if(offset_ < size) {
|
||||
@@ -151,18 +150,18 @@ public:
|
||||
has_data = true;
|
||||
}
|
||||
|
||||
Unlock();
|
||||
|
||||
return has_data;
|
||||
}
|
||||
|
||||
private:
|
||||
TestResults* test_results_;
|
||||
size_t offset_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientSchemeHandler);
|
||||
IMPLEMENT_LOCKING(ClientSchemeHandler);
|
||||
};
|
||||
|
||||
class ClientSchemeHandlerFactory :
|
||||
public CefThreadSafeBase<CefSchemeHandlerFactory>
|
||||
class ClientSchemeHandlerFactory : public CefSchemeHandlerFactory
|
||||
{
|
||||
public:
|
||||
ClientSchemeHandlerFactory(TestResults* tr)
|
||||
@@ -175,6 +174,8 @@ public:
|
||||
}
|
||||
|
||||
TestResults* test_results_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientSchemeHandlerFactory);
|
||||
};
|
||||
|
||||
// Global test results object.
|
||||
|
Reference in New Issue
Block a user