mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-03-16 12:00:13 +01:00
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:
parent
64b570a994
commit
da41e8e585
@ -80,6 +80,18 @@
|
||||
'libcef_dll/wrapper/libcef_dll_wrapper2.cc',
|
||||
'<@(autogen_client_side)',
|
||||
],
|
||||
'cefclient_bundle_resources_common': [
|
||||
'tests/cefclient/res/binding.html',
|
||||
'tests/cefclient/res/dialogs.html',
|
||||
'tests/cefclient/res/domaccess.html',
|
||||
'tests/cefclient/res/localstorage.html',
|
||||
'tests/cefclient/res/logo.png',
|
||||
'tests/cefclient/res/other_tests.html',
|
||||
'tests/cefclient/res/performance.html',
|
||||
'tests/cefclient/res/transparency.html',
|
||||
'tests/cefclient/res/window.html',
|
||||
'tests/cefclient/res/xmlhttprequest.html',
|
||||
],
|
||||
'cefclient_sources_common': [
|
||||
'tests/cefclient/cefclient.cpp',
|
||||
'tests/cefclient/cefclient.h',
|
||||
@ -102,14 +114,6 @@
|
||||
'tests/cefclient/performance_test.h',
|
||||
'tests/cefclient/performance_test_setup.h',
|
||||
'tests/cefclient/performance_test_tests.cpp',
|
||||
'tests/cefclient/res/binding.html',
|
||||
'tests/cefclient/res/dialogs.html',
|
||||
'tests/cefclient/res/domaccess.html',
|
||||
'tests/cefclient/res/localstorage.html',
|
||||
'tests/cefclient/res/logo.png',
|
||||
'tests/cefclient/res/other_tests.html',
|
||||
'tests/cefclient/res/performance.html',
|
||||
'tests/cefclient/res/xmlhttprequest.html',
|
||||
'tests/cefclient/resource_util.h',
|
||||
'tests/cefclient/scheme_test.cpp',
|
||||
'tests/cefclient/scheme_test.h',
|
||||
@ -118,6 +122,7 @@
|
||||
'tests/cefclient/util.h',
|
||||
'tests/cefclient/window_test.cpp',
|
||||
'tests/cefclient/window_test.h',
|
||||
'<@(cefclient_bundle_resources_common)',
|
||||
],
|
||||
'cefclient_sources_win': [
|
||||
'tests/cefclient/cefclient.rc',
|
||||
@ -129,9 +134,7 @@
|
||||
'tests/cefclient/osrenderer.cpp',
|
||||
'tests/cefclient/resource.h',
|
||||
'tests/cefclient/res/cefclient.ico',
|
||||
'tests/cefclient/res/logoball.png',
|
||||
'tests/cefclient/res/small.ico',
|
||||
'tests/cefclient/res/transparency.html',
|
||||
'tests/cefclient/resource_util_win.cpp',
|
||||
'tests/cefclient/window_test_win.cpp',
|
||||
],
|
||||
@ -181,15 +184,7 @@
|
||||
'tests/cefclient/mac/English.lproj/InfoPlist.strings',
|
||||
'tests/cefclient/mac/English.lproj/MainMenu.xib',
|
||||
'tests/cefclient/mac/Info.plist',
|
||||
'tests/cefclient/res/binding.html',
|
||||
'tests/cefclient/res/dialogs.html',
|
||||
'tests/cefclient/res/domaccess.html',
|
||||
'tests/cefclient/res/localstorage.html',
|
||||
'tests/cefclient/res/logo.png',
|
||||
'tests/cefclient/res/other_tests.html',
|
||||
'tests/cefclient/res/performance.html',
|
||||
'tests/cefclient/res/window.html',
|
||||
'tests/cefclient/res/xmlhttprequest.html',
|
||||
'<@(cefclient_bundle_resources_common)',
|
||||
],
|
||||
'cefclient_sources_linux': [
|
||||
'tests/cefclient/cefclient_gtk.cpp',
|
||||
@ -199,15 +194,7 @@
|
||||
'tests/cefclient/window_test_gtk.cpp',
|
||||
],
|
||||
'cefclient_bundle_resources_linux': [
|
||||
'tests/cefclient/res/binding.html',
|
||||
'tests/cefclient/res/dialogs.html',
|
||||
'tests/cefclient/res/domaccess.html',
|
||||
'tests/cefclient/res/localstorage.html',
|
||||
'tests/cefclient/res/logo.png',
|
||||
'tests/cefclient/res/other_tests.html',
|
||||
'tests/cefclient/res/performance.html',
|
||||
'tests/cefclient/res/window.html',
|
||||
'tests/cefclient/res/xmlhttprequest.html',
|
||||
'<@(cefclient_bundle_resources_common)',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -6,18 +6,13 @@
|
||||
#define CEF_TESTS_CEFCLIENT_BINDING_TEST_H_
|
||||
#pragma once
|
||||
|
||||
#include "cefclient/client_app.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
|
||||
namespace binding_test {
|
||||
|
||||
// Delegate creation. Called from ClientApp and ClientHandler.
|
||||
// Delegate creation. Called from ClientHandler.
|
||||
void CreateProcessMessageDelegates(
|
||||
ClientHandler::ProcessMessageDelegateSet& delegates);
|
||||
void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates);
|
||||
|
||||
// Run the test.
|
||||
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
} // namespace binding_test
|
||||
|
||||
|
@ -33,7 +33,6 @@ IDS_DIALOGS BINARY "res\\dialogs.html"
|
||||
IDS_DOMACCESS BINARY "res\\domaccess.html"
|
||||
IDS_LOCALSTORAGE BINARY "res\\localstorage.html"
|
||||
IDS_LOGO BINARY "res\\logo.png"
|
||||
IDS_LOGOBALL BINARY "res\\logoball.png"
|
||||
IDS_OTHER_TESTS BINARY "res\\other_tests.html"
|
||||
IDS_PERFORMANCE BINARY "res\\performance.html"
|
||||
IDS_TRANSPARENCY BINARY "res\\transparency.html"
|
||||
@ -71,13 +70,7 @@ BEGIN
|
||||
MENUITEM "Get Text", ID_TESTS_GETTEXT
|
||||
MENUITEM "Popup Window", ID_TESTS_POPUP
|
||||
MENUITEM "Request", ID_TESTS_REQUEST
|
||||
MENUITEM "Scheme Handler", ID_TESTS_SCHEME_HANDLER
|
||||
MENUITEM "JavaScript Binding", ID_TESTS_BINDING
|
||||
MENUITEM "Performance Tests", ID_TESTS_PERFORMANCE
|
||||
MENUITEM "Dialogs", ID_TESTS_DIALOGS
|
||||
MENUITEM "Window", ID_TESTS_WINDOW
|
||||
MENUITEM "Plugin Info", ID_TESTS_PLUGIN_INFO
|
||||
MENUITEM "DOM Access", ID_TESTS_DOM_ACCESS
|
||||
MENUITEM "Zoom In", ID_TESTS_ZOOM_IN
|
||||
MENUITEM "Zoom Out", ID_TESTS_ZOOM_OUT
|
||||
MENUITEM "Zoom Reset", ID_TESTS_ZOOM_RESET
|
||||
|
@ -11,14 +11,9 @@
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "cefclient/binding_test.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "cefclient/dialog_test.h"
|
||||
#include "cefclient/dom_test.h"
|
||||
#include "cefclient/performance_test.h"
|
||||
#include "cefclient/scheme_test.h"
|
||||
#include "cefclient/string_util.h"
|
||||
#include "cefclient/window_test.h"
|
||||
|
||||
char szWorkingDir[512]; // The current working directory
|
||||
|
||||
@ -84,46 +79,6 @@ gboolean RequestActivated(GtkWidget* widget) {
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Tests > Scheme Handler... menu item.
|
||||
gboolean SchemeHandlerActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
scheme_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Tests > JavaScript Binding... menu item.
|
||||
gboolean BindingActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
binding_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Tests > Performance... menu item.
|
||||
gboolean PerformanceActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
performance_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Tests > Dialogs... menu item.
|
||||
gboolean DialogsActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
dialog_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Tests > Window... menu item.
|
||||
gboolean WindowActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
window_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Tests > Plugin Info... menu item.
|
||||
gboolean PluginInfoActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
@ -132,14 +87,6 @@ gboolean PluginInfoActivated(GtkWidget* widget) {
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Tests > DOM Access... menu item.
|
||||
gboolean DOMAccessActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
dom_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Tests > Zoom In... menu item.
|
||||
gboolean ZoomInActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
@ -257,20 +204,8 @@ GtkWidget* CreateMenuBar() {
|
||||
G_CALLBACK(PopupWindowActivated));
|
||||
AddMenuEntry(debug_menu, "Request",
|
||||
G_CALLBACK(RequestActivated));
|
||||
AddMenuEntry(debug_menu, "Scheme Handler",
|
||||
G_CALLBACK(SchemeHandlerActivated));
|
||||
AddMenuEntry(debug_menu, "JavaScript Binding",
|
||||
G_CALLBACK(BindingActivated));
|
||||
AddMenuEntry(debug_menu, "Performance Tests",
|
||||
G_CALLBACK(PerformanceActivated));
|
||||
AddMenuEntry(debug_menu, "Dialogs",
|
||||
G_CALLBACK(DialogsActivated));
|
||||
AddMenuEntry(debug_menu, "Window",
|
||||
G_CALLBACK(WindowActivated));
|
||||
AddMenuEntry(debug_menu, "Plugin Info",
|
||||
G_CALLBACK(PluginInfoActivated));
|
||||
AddMenuEntry(debug_menu, "DOM Access",
|
||||
G_CALLBACK(DOMAccessActivated));
|
||||
AddMenuEntry(debug_menu, "Zoom In",
|
||||
G_CALLBACK(ZoomInActivated));
|
||||
AddMenuEntry(debug_menu, "Zoom Out",
|
||||
|
@ -11,15 +11,10 @@
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "cefclient/binding_test.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "cefclient/dialog_test.h"
|
||||
#include "cefclient/dom_test.h"
|
||||
#include "cefclient/performance_test.h"
|
||||
#include "cefclient/resource_util.h"
|
||||
#include "cefclient/scheme_test.h"
|
||||
#include "cefclient/string_util.h"
|
||||
#include "cefclient/window_test.h"
|
||||
|
||||
// The global ClientHandler reference.
|
||||
extern CefRefPtr<ClientHandler> g_handler;
|
||||
@ -205,13 +200,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
||||
- (IBAction)testGetText:(id)sender;
|
||||
- (IBAction)testPopupWindow:(id)sender;
|
||||
- (IBAction)testRequest:(id)sender;
|
||||
- (IBAction)testSchemeHandler:(id)sender;
|
||||
- (IBAction)testBinding:(id)sender;
|
||||
- (IBAction)testPerformance:(id)sender;
|
||||
- (IBAction)testDialogs:(id)sender;
|
||||
- (IBAction)testWindow:(id)sender;
|
||||
- (IBAction)testPluginInfo:(id)sender;
|
||||
- (IBAction)testDOMAccess:(id)sender;
|
||||
- (IBAction)testZoomIn:(id)sender;
|
||||
- (IBAction)testZoomOut:(id)sender;
|
||||
- (IBAction)testZoomReset:(id)sender;
|
||||
@ -248,27 +237,9 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
||||
[testMenu addItemWithTitle:@"Request"
|
||||
action:@selector(testRequest:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Scheme Handler"
|
||||
action:@selector(testSchemeHandler:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"JavaScript Binding"
|
||||
action:@selector(testBinding:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Performance Tests"
|
||||
action:@selector(testPerformance:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Dialogs"
|
||||
action:@selector(testDialogs:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Window"
|
||||
action:@selector(testWindow:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Plugin Info"
|
||||
action:@selector(testPluginInfo:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"DOM Access"
|
||||
action:@selector(testDOMAccess:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Zoom In"
|
||||
action:@selector(testZoomIn:)
|
||||
keyEquivalent:@""];
|
||||
@ -395,41 +366,11 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
||||
RunRequestTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testSchemeHandler:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
scheme_test::RunTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testBinding:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
binding_test::RunTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testPerformance:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
performance_test::RunTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testDialogs:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
dialog_test::RunTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testWindow:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
window_test::RunTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testPluginInfo:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunPluginInfoTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testDOMAccess:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
dom_test::RunTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testZoomIn:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
|
@ -13,17 +13,12 @@
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "cefclient/binding_test.h"
|
||||
#include "cefclient/cefclient_osr_widget_win.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "cefclient/client_switches.h"
|
||||
#include "cefclient/dialog_test.h"
|
||||
#include "cefclient/dom_test.h"
|
||||
#include "cefclient/performance_test.h"
|
||||
#include "cefclient/resource.h"
|
||||
#include "cefclient/scheme_test.h"
|
||||
#include "cefclient/string_util.h"
|
||||
#include "cefclient/window_test.h"
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
#define MAX_URL_LENGTH 255
|
||||
@ -419,34 +414,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||
if (browser.get())
|
||||
RunRequestTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_SCHEME_HANDLER: // Test the scheme handler
|
||||
if (browser.get())
|
||||
scheme_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_BINDING: // Test JavaScript binding
|
||||
if (browser.get())
|
||||
binding_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_PERFORMANCE: // Run performance tests
|
||||
if (browser.get())
|
||||
performance_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_DIALOGS: // Test JavaScript dialogs
|
||||
if (browser.get())
|
||||
dialog_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_WINDOW: // Test window sizing/position/etc.
|
||||
if (browser.get())
|
||||
window_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_PLUGIN_INFO: // Test plugin info
|
||||
if (browser.get())
|
||||
RunPluginInfoTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_DOM_ACCESS: // Test DOM access
|
||||
if (browser.get())
|
||||
dom_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_ZOOM_IN:
|
||||
if (browser.get())
|
||||
ModifyZoom(browser, 0.5);
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "cefclient/client_switches.h"
|
||||
#include "cefclient/dialog_test.h"
|
||||
#include "cefclient/dom_test.h"
|
||||
#include "cefclient/performance_test.h"
|
||||
#include "cefclient/resource_util.h"
|
||||
#include "cefclient/string_util.h"
|
||||
#include "cefclient/window_test.h"
|
||||
@ -96,7 +95,6 @@ ClientHandler::ClientHandler()
|
||||
m_ReloadHwnd(NULL),
|
||||
m_bFocusOnEditableField(false) {
|
||||
CreateProcessMessageDelegates(process_message_delegates_);
|
||||
CreateRequestDelegates(request_delegates_);
|
||||
|
||||
// Read command line settings.
|
||||
CefRefPtr<CefCommandLine> command_line =
|
||||
@ -465,14 +463,7 @@ CefRefPtr<CefResourceHandler> ClientHandler::GetResourceHandler(
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefResourceHandler> handler;
|
||||
|
||||
// Execute delegate callbacks.
|
||||
RequestDelegateSet::iterator it = request_delegates_.begin();
|
||||
for (; it != request_delegates_.end() && !handler.get(); ++it)
|
||||
handler = (*it)->GetResourceHandler(this, browser, frame, request);
|
||||
|
||||
return handler;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool ClientHandler::OnQuotaRequest(CefRefPtr<CefBrowser> browser,
|
||||
@ -741,18 +732,6 @@ void ClientHandler::CreateProcessMessageDelegates(
|
||||
window_test::CreateProcessMessageDelegates(delegates);
|
||||
}
|
||||
|
||||
// static
|
||||
void ClientHandler::CreateRequestDelegates(RequestDelegateSet& delegates) {
|
||||
// Create the binding test delegates.
|
||||
binding_test::CreateRequestDelegates(delegates);
|
||||
|
||||
// Create the performance test delegates.
|
||||
performance_test::CreateRequestDelegates(delegates);
|
||||
|
||||
// Create the window test delegates.
|
||||
window_test::CreateRequestDelegates(delegates);
|
||||
}
|
||||
|
||||
void ClientHandler::BuildTestMenu(CefRefPtr<CefMenuModel> model) {
|
||||
if (model->GetCount() > 0)
|
||||
model->AddSeparator();
|
||||
|
@ -51,28 +51,12 @@ class ClientHandler : public CefClient,
|
||||
typedef std::set<CefRefPtr<ProcessMessageDelegate> >
|
||||
ProcessMessageDelegateSet;
|
||||
|
||||
// Interface for request handler delegates. Do not perform work in the
|
||||
// RequestDelegate constructor.
|
||||
class RequestDelegate : public virtual CefBase {
|
||||
public:
|
||||
// Called to retrieve a resource handler.
|
||||
virtual CefRefPtr<CefResourceHandler> GetResourceHandler(
|
||||
CefRefPtr<ClientHandler> handler,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
// Interface implemented to handle off-screen rendering.
|
||||
class RenderHandler : public CefRenderHandler {
|
||||
public:
|
||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) =0;
|
||||
};
|
||||
|
||||
typedef std::set<CefRefPtr<RequestDelegate> > RequestDelegateSet;
|
||||
|
||||
ClientHandler();
|
||||
virtual ~ClientHandler();
|
||||
|
||||
@ -280,9 +264,6 @@ class ClientHandler : public CefClient,
|
||||
static void CreateProcessMessageDelegates(
|
||||
ProcessMessageDelegateSet& delegates);
|
||||
|
||||
// Create all of RequestDelegateSet objects.
|
||||
static void CreateRequestDelegates(RequestDelegateSet& delegates);
|
||||
|
||||
// Test context menu creation.
|
||||
void BuildTestMenu(CefRefPtr<CefMenuModel> model);
|
||||
bool ExecuteTestMenu(int command_id);
|
||||
@ -334,7 +315,6 @@ class ClientHandler : public CefClient,
|
||||
|
||||
// Registered delegates.
|
||||
ProcessMessageDelegateSet process_message_delegates_;
|
||||
RequestDelegateSet request_delegates_;
|
||||
|
||||
// If true DevTools will be opened in an external browser window.
|
||||
bool m_bExternalDevTools;
|
||||
|
@ -99,8 +99,4 @@ void CreateProcessMessageDelegates(
|
||||
delegates.insert(new ProcessMessageDelegate);
|
||||
}
|
||||
|
||||
void RunTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL(kTestUrl);
|
||||
}
|
||||
|
||||
} // namespace dialog_test
|
||||
|
@ -14,9 +14,6 @@ namespace dialog_test {
|
||||
void CreateProcessMessageDelegates(
|
||||
ClientHandler::ProcessMessageDelegateSet& delegates);
|
||||
|
||||
// Run the test.
|
||||
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
} // namespace dialog_test
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_DIALOG_TEST_H_
|
||||
|
@ -125,11 +125,6 @@ void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates) {
|
||||
delegates.insert(new DOMRenderDelegate);
|
||||
}
|
||||
|
||||
void RunTest(CefRefPtr<CefBrowser> browser) {
|
||||
// Load the test URL.
|
||||
browser->GetMainFrame()->LoadURL(kTestUrl);
|
||||
}
|
||||
|
||||
void OnLoadEnd(CefRefPtr<CefBrowser> browser) {
|
||||
// Send a message to the render process to continue the test setup.
|
||||
browser->SendProcessMessage(PID_RENDERER,
|
||||
|
@ -17,9 +17,6 @@ extern const char kTestUrl[];
|
||||
// Create the render delegate.
|
||||
void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates);
|
||||
|
||||
// Run the test.
|
||||
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
// Continue the test after the page has loaded.
|
||||
void OnLoadEnd(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
|
@ -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
|
||||
|
@ -7,19 +7,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "cefclient/client_app.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
|
||||
namespace performance_test {
|
||||
|
||||
// Request delegate creation. Called from ClientHandler.
|
||||
void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates);
|
||||
|
||||
// Render delegate creation. Called from client_app_delegates.cpp.
|
||||
void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates);
|
||||
|
||||
// Run the test.
|
||||
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
} // namespace performance_test
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_PERFORMANCE_TEST_H_
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 7.0 KiB |
@ -8,11 +8,19 @@
|
||||
<li><a href="http://mudcu.be/labs/JS1k/BreathingGalaxies.html">Accelerated 2D Canvas</a></li>
|
||||
<li><a href="http://webkit.org/blog-files/3d-transforms/poster-circle.html">Accelerated Layers</a></li>
|
||||
<li><a href="http://html5advent2011.digitpaint.nl/3/index.html">Cursors</a></li>
|
||||
<li><a href="http://tests/dialogs">Dialogs</a></li>
|
||||
<li><a href="http://tests/domaccess">DOM Access</a></li>
|
||||
<li><a href="http://html5demos.com/drag">Drag & Drop</a></li>
|
||||
<li><a href="http://www.adobe.com/software/flash/about/">Flash Plugin</a></li>
|
||||
<li><a href="http://html5demos.com/geo">Geolocation</a></li>
|
||||
<li><a href="http://www.html5test.com">HTML5 Feature Test</a></li>
|
||||
<li><a href="http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True">HTML5 Video</a></li>
|
||||
<li><a href="http://tests/binding">JavaScript Binding</a></li>
|
||||
<li><a href="http://tests/performance">JavaScript Performance Tests</a></li>
|
||||
<li><a href="http://tests/window">JavaScript Window Manipulation</a></li>
|
||||
<li><a href="http://tests/localstorage">Local Storage</a></li>
|
||||
<li><a href="http://mrdoob.com/lab/javascript/requestanimationframe/">requestAnimationFrame</a></li>
|
||||
<li><a href="client://tests/handler.html">Scheme Handler</a></li>
|
||||
<li><a href="http://tests/transparency">Transparency</a></li>
|
||||
<li><a href="http://webglsamples.googlecode.com/hg/field/field.html">WebGL</a></li>
|
||||
<li><a href="http://tests/xmlhttprequest">XMLHttpRequest</a></li>
|
||||
|
@ -26,23 +26,17 @@
|
||||
#define ID_WARN_DOWNLOADCOMPLETE 32001
|
||||
#define ID_WARN_DOWNLOADERROR 32002
|
||||
#define ID_QUIT 32500
|
||||
#define ID_TESTS_BINDING 32700
|
||||
#define ID_TESTS_DIALOGS 32701
|
||||
#define ID_TESTS_DOM_ACCESS 32702
|
||||
#define ID_TESTS_GETSOURCE 32703
|
||||
#define ID_TESTS_GETTEXT 32704
|
||||
#define ID_TESTS_OTHER_TESTS 32705
|
||||
#define ID_TESTS_PERFORMANCE 32706
|
||||
#define ID_TESTS_PLUGIN_INFO 32707
|
||||
#define ID_TESTS_POPUP 32708
|
||||
#define ID_TESTS_REQUEST 32709
|
||||
#define ID_TESTS_SCHEME_HANDLER 32710
|
||||
#define ID_TESTS_TRACING_BEGIN 32711
|
||||
#define ID_TESTS_TRACING_END 32712
|
||||
#define ID_TESTS_WINDOW 32713
|
||||
#define ID_TESTS_ZOOM_IN 32714
|
||||
#define ID_TESTS_ZOOM_OUT 32715
|
||||
#define ID_TESTS_ZOOM_RESET 32716
|
||||
#define ID_TESTS_GETSOURCE 32700
|
||||
#define ID_TESTS_GETTEXT 32701
|
||||
#define ID_TESTS_OTHER_TESTS 32702
|
||||
#define ID_TESTS_PLUGIN_INFO 32703
|
||||
#define ID_TESTS_POPUP 32704
|
||||
#define ID_TESTS_REQUEST 32705
|
||||
#define ID_TESTS_TRACING_BEGIN 32706
|
||||
#define ID_TESTS_TRACING_END 32707
|
||||
#define ID_TESTS_ZOOM_IN 32708
|
||||
#define ID_TESTS_ZOOM_OUT 32709
|
||||
#define ID_TESTS_ZOOM_RESET 32710
|
||||
#define IDC_STATIC -1
|
||||
#define IDS_BINDING 1000
|
||||
#define IDS_DIALOGS 1001
|
||||
|
@ -38,7 +38,6 @@ int GetResourceId(const char* resource_name) {
|
||||
{"domaccess.html", IDS_DOMACCESS},
|
||||
{"localstorage.html", IDS_LOCALSTORAGE},
|
||||
{"logo.png", IDS_LOGO},
|
||||
{"logoball.png", IDS_LOGOBALL},
|
||||
{"other_tests.html", IDS_OTHER_TESTS},
|
||||
{"performance.html", IDS_PERFORMANCE},
|
||||
{"transparency.html", IDS_TRANSPARENCY},
|
||||
|
@ -162,8 +162,4 @@ void InitTest() {
|
||||
new ClientSchemeHandlerFactory());
|
||||
}
|
||||
|
||||
void RunTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL("client://tests/handler.html");
|
||||
}
|
||||
|
||||
} // namespace scheme_test
|
||||
|
@ -21,9 +21,6 @@ void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar,
|
||||
// Create the scheme handler.
|
||||
void InitTest();
|
||||
|
||||
// Run the test.
|
||||
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
} // namespace scheme_test
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_
|
||||
|
@ -8,13 +8,11 @@
|
||||
#include <string>
|
||||
|
||||
#include "include/wrapper/cef_stream_resource_handler.h"
|
||||
#include "cefclient/resource_util.h"
|
||||
|
||||
namespace window_test {
|
||||
|
||||
namespace {
|
||||
|
||||
const char* kTestUrl = "http://tests/window";
|
||||
const char* kMessagePositionName = "WindowTest.Position";
|
||||
const char* kMessageMinimizeName = "WindowTest.Minimize";
|
||||
const char* kMessageMaximizeName = "WindowTest.Maximize";
|
||||
@ -60,33 +58,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 contents
|
||||
CefRefPtr<CefStreamReader> stream =
|
||||
GetBinaryResourceReader("window.html");
|
||||
ASSERT(stream.get());
|
||||
return new CefStreamResourceHandler("text/html", stream);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IMPLEMENT_REFCOUNTING(RequestDelegate);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
void CreateProcessMessageDelegates(
|
||||
@ -94,15 +65,6 @@ 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);
|
||||
}
|
||||
|
||||
void ModifyBounds(const CefRect& display, CefRect& window) {
|
||||
window.x += display.x;
|
||||
window.y += display.y;
|
||||
|
@ -6,18 +6,13 @@
|
||||
#define CEF_TESTS_CEFCLIENT_WINDOW_TEST_H_
|
||||
#pragma once
|
||||
|
||||
#include "cefclient/client_app.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
|
||||
namespace window_test {
|
||||
|
||||
// Delegate creation. Called from ClientApp and ClientHandler.
|
||||
// Delegate creation. Called from ClientHandler.
|
||||
void CreateProcessMessageDelegates(
|
||||
ClientHandler::ProcessMessageDelegateSet& delegates);
|
||||
void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates);
|
||||
|
||||
// Run the test.
|
||||
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
// Fit |window| inside |display|. Coordinates are relative to the upper-left
|
||||
// corner of the display.
|
||||
|
Loading…
x
Reference in New Issue
Block a user