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

@ -8,13 +8,11 @@
#include <string>
#include "include/wrapper/cef_stream_resource_handler.h"
#include "cefclient/resource_util.h"
namespace binding_test {
namespace {
const char* kTestUrl = "http://tests/binding";
const char* kMessageName = "binding_test";
// Handle messages in the browser process.
@ -58,33 +56,6 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
IMPLEMENT_REFCOUNTING(ProcessMessageDelegate);
};
// 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 binding contents
CefRefPtr<CefStreamReader> stream =
GetBinaryResourceReader("binding.html");
ASSERT(stream.get());
return new CefStreamResourceHandler("text/html", stream);
}
return NULL;
}
IMPLEMENT_REFCOUNTING(RequestDelegate);
};
} // namespace
void CreateProcessMessageDelegates(
@ -92,13 +63,4 @@ void CreateProcessMessageDelegates(
delegates.insert(new ProcessMessageDelegate);
}
void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates) {
delegates.insert(new RequestDelegate);
}
void RunTest(CefRefPtr<CefBrowser> browser) {
// Load the test URL.
browser->GetMainFrame()->LoadURL(kTestUrl);
}
} // namespace binding_test