cefclient: Simplify tests and related resource loading.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1174 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-04-04 00:10:53 +00:00
parent 64b570a994
commit da41e8e585
23 changed files with 37 additions and 403 deletions

View File

@ -9,7 +9,6 @@
#include "include/wrapper/cef_stream_resource_handler.h"
#include "cefclient/performance_test_setup.h"
#include "cefclient/resource_util.h"
namespace performance_test {
@ -22,37 +21,9 @@ const size_t kDefaultIterations = 10000;
namespace {
const char kTestUrl[] = "http://tests/performance";
const char kGetPerfTests[] = "GetPerfTests";
const char kRunPerfTest[] = "RunPerfTest";
// Handle resource loading in the browser process.
class RequestDelegate: public ClientHandler::RequestDelegate {
public:
RequestDelegate() {
}
// From ClientHandler::RequestDelegate.
virtual CefRefPtr<CefResourceHandler> GetResourceHandler(
CefRefPtr<ClientHandler> handler,
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request) OVERRIDE {
std::string url = request->GetURL();
if (url == kTestUrl) {
// Show the test contents
CefRefPtr<CefStreamReader> stream =
GetBinaryResourceReader("performance.html");
ASSERT(stream.get());
return new CefStreamResourceHandler("text/html", stream);
}
return NULL;
}
IMPLEMENT_REFCOUNTING(RequestDelegate);
};
class V8Handler : public CefV8Handler {
public:
V8Handler() {
@ -135,17 +106,8 @@ class RenderDelegate : public ClientApp::RenderDelegate {
} // namespace
void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates) {
delegates.insert(new RequestDelegate);
}
void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates) {
delegates.insert(new RenderDelegate);
}
void RunTest(CefRefPtr<CefBrowser> browser) {
// Load the test URL.
browser->GetMainFrame()->LoadURL(kTestUrl);
}
} // namespace performance_test