mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
cefclient: Simplify tests and related resource loading.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1173 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -78,6 +78,16 @@
|
|||||||
'libcef_dll/wrapper/libcef_dll_wrapper2.cc',
|
'libcef_dll/wrapper/libcef_dll_wrapper2.cc',
|
||||||
'<@(autogen_client_side)',
|
'<@(autogen_client_side)',
|
||||||
],
|
],
|
||||||
|
'cefclient_bundle_resources_common': [
|
||||||
|
'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/xmlhttprequest.html',
|
||||||
|
],
|
||||||
'cefclient_sources_common': [
|
'cefclient_sources_common': [
|
||||||
'tests/cefclient/binding_test.cpp',
|
'tests/cefclient/binding_test.cpp',
|
||||||
'tests/cefclient/binding_test.h',
|
'tests/cefclient/binding_test.h',
|
||||||
@@ -97,18 +107,13 @@
|
|||||||
'tests/cefclient/performance_test.h',
|
'tests/cefclient/performance_test.h',
|
||||||
'tests/cefclient/performance_test_setup.h',
|
'tests/cefclient/performance_test_setup.h',
|
||||||
'tests/cefclient/performance_test_tests.cpp',
|
'tests/cefclient/performance_test_tests.cpp',
|
||||||
'tests/cefclient/res/dialogs.html',
|
|
||||||
'tests/cefclient/res/domaccess.html',
|
|
||||||
'tests/cefclient/res/localstorage.html',
|
|
||||||
'tests/cefclient/res/logo.png',
|
|
||||||
'tests/cefclient/res/performance.html',
|
|
||||||
'tests/cefclient/res/xmlhttprequest.html',
|
|
||||||
'tests/cefclient/resource_util.h',
|
'tests/cefclient/resource_util.h',
|
||||||
'tests/cefclient/scheme_test.cpp',
|
'tests/cefclient/scheme_test.cpp',
|
||||||
'tests/cefclient/scheme_test.h',
|
'tests/cefclient/scheme_test.h',
|
||||||
'tests/cefclient/string_util.cpp',
|
'tests/cefclient/string_util.cpp',
|
||||||
'tests/cefclient/string_util.h',
|
'tests/cefclient/string_util.h',
|
||||||
'tests/cefclient/util.h',
|
'tests/cefclient/util.h',
|
||||||
|
'<@(cefclient_bundle_resources_common)',
|
||||||
],
|
],
|
||||||
'cefclient_sources_win': [
|
'cefclient_sources_win': [
|
||||||
'tests/cefclient/cefclient.rc',
|
'tests/cefclient/cefclient.rc',
|
||||||
@@ -131,7 +136,6 @@
|
|||||||
'tests/cefclient/res/modalmain.html',
|
'tests/cefclient/res/modalmain.html',
|
||||||
'tests/cefclient/res/osrplugin.html',
|
'tests/cefclient/res/osrplugin.html',
|
||||||
'tests/cefclient/res/small.ico',
|
'tests/cefclient/res/small.ico',
|
||||||
'tests/cefclient/res/transparency.html',
|
|
||||||
'tests/cefclient/res/uiplugin.html',
|
'tests/cefclient/res/uiplugin.html',
|
||||||
'tests/cefclient/resource_util_win.cpp',
|
'tests/cefclient/resource_util_win.cpp',
|
||||||
'tests/cefclient/uiplugin.cpp',
|
'tests/cefclient/uiplugin.cpp',
|
||||||
@@ -147,34 +151,24 @@
|
|||||||
'tests/cefclient/osrtest_mac.h',
|
'tests/cefclient/osrtest_mac.h',
|
||||||
'tests/cefclient/osrtest_mac.mm',
|
'tests/cefclient/osrtest_mac.mm',
|
||||||
'tests/cefclient/resource_util_mac.mm',
|
'tests/cefclient/resource_util_mac.mm',
|
||||||
|
'tests/cefclient/resource_util_posix.cpp',
|
||||||
],
|
],
|
||||||
'cefclient_bundle_resources_mac': [
|
'cefclient_bundle_resources_mac': [
|
||||||
'tests/cefclient/mac/cefclient.icns',
|
'tests/cefclient/mac/cefclient.icns',
|
||||||
'tests/cefclient/mac/English.lproj/InfoPlist.strings',
|
'tests/cefclient/mac/English.lproj/InfoPlist.strings',
|
||||||
'tests/cefclient/mac/English.lproj/MainMenu.xib',
|
'tests/cefclient/mac/English.lproj/MainMenu.xib',
|
||||||
'tests/cefclient/mac/Info.plist',
|
'tests/cefclient/mac/Info.plist',
|
||||||
'tests/cefclient/res/dialogs.html',
|
|
||||||
'tests/cefclient/res/domaccess.html',
|
|
||||||
'tests/cefclient/res/localstorage.html',
|
|
||||||
'tests/cefclient/res/logo.png',
|
|
||||||
'tests/cefclient/res/logoball.png',
|
|
||||||
'tests/cefclient/res/performance.html',
|
|
||||||
'tests/cefclient/res/osrtest.html',
|
'tests/cefclient/res/osrtest.html',
|
||||||
'tests/cefclient/res/transparency.html',
|
'<@(cefclient_bundle_resources_common)',
|
||||||
'tests/cefclient/res/xmlhttprequest.html',
|
|
||||||
],
|
],
|
||||||
'cefclient_sources_linux': [
|
'cefclient_sources_linux': [
|
||||||
'tests/cefclient/cefclient_gtk.cpp',
|
'tests/cefclient/cefclient_gtk.cpp',
|
||||||
'tests/cefclient/client_handler_gtk.cpp',
|
'tests/cefclient/client_handler_gtk.cpp',
|
||||||
'tests/cefclient/resource_util_linux.cpp',
|
'tests/cefclient/resource_util_linux.cpp',
|
||||||
|
'tests/cefclient/resource_util_posix.cpp',
|
||||||
],
|
],
|
||||||
'cefclient_bundle_resources_linux': [
|
'cefclient_bundle_resources_linux': [
|
||||||
'tests/cefclient/res/dialogs.html',
|
'<@(cefclient_bundle_resources_common)',
|
||||||
'tests/cefclient/res/domaccess.html',
|
|
||||||
'tests/cefclient/res/localstorage.html',
|
|
||||||
'tests/cefclient/res/logo.png',
|
|
||||||
'tests/cefclient/res/performance.html',
|
|
||||||
'tests/cefclient/res/xmlhttprequest.html',
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ class ClientApp : public CefApp,
|
|||||||
|
|
||||||
virtual void OnRegisterCustomSchemes(
|
virtual void OnRegisterCustomSchemes(
|
||||||
CefRefPtr<CefSchemeRegistrar> registrar) OVERRIDE {
|
CefRefPtr<CefSchemeRegistrar> registrar) OVERRIDE {
|
||||||
AddSchemeTestSchemes(registrar);
|
scheme_test::AddSchemes(registrar);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CefApp methods
|
// CefApp methods
|
||||||
@@ -472,29 +472,6 @@ void RunPopupTest(CefRefPtr<CefBrowser> browser) {
|
|||||||
"window.open('http://www.google.com');", "about:blank", 0);
|
"window.open('http://www.google.com');", "about:blank", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunLocalStorageTest(CefRefPtr<CefBrowser> browser) {
|
|
||||||
browser->GetMainFrame()->LoadURL("http://tests/localstorage");
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunAccelerated2DCanvasTest(CefRefPtr<CefBrowser> browser) {
|
|
||||||
browser->GetMainFrame()->LoadURL(
|
|
||||||
"http://mudcu.be/labs/JS1k/BreathingGalaxies.html");
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunAcceleratedLayersTest(CefRefPtr<CefBrowser> browser) {
|
|
||||||
browser->GetMainFrame()->LoadURL(
|
|
||||||
"http://webkit.org/blog-files/3d-transforms/poster-circle.html");
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunWebGLTest(CefRefPtr<CefBrowser> browser) {
|
|
||||||
browser->GetMainFrame()->LoadURL(
|
|
||||||
"http://webglsamples.googlecode.com/hg/field/field.html");
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunXMLHTTPRequestTest(CefRefPtr<CefBrowser> browser) {
|
|
||||||
browser->GetMainFrame()->LoadURL("http://tests/xmlhttprequest");
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunWebURLRequestTest(CefRefPtr<CefBrowser> browser) {
|
void RunWebURLRequestTest(CefRefPtr<CefBrowser> browser) {
|
||||||
class RequestClient : public CefWebURLRequestClient {
|
class RequestClient : public CefWebURLRequestClient {
|
||||||
public:
|
public:
|
||||||
@@ -643,14 +620,6 @@ void RunDOMAccessTest(CefRefPtr<CefBrowser> browser) {
|
|||||||
browser->GetMainFrame()->LoadURL("http://tests/domaccess");
|
browser->GetMainFrame()->LoadURL("http://tests/domaccess");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunDragDropTest(CefRefPtr<CefBrowser> browser) {
|
|
||||||
browser->GetMainFrame()->LoadURL("http://html5demos.com/drag");
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunModalDialogTest(CefRefPtr<CefBrowser> browser) {
|
|
||||||
browser->GetMainFrame()->LoadURL("http://tests/modalmain");
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunPluginInfoTest(CefRefPtr<CefBrowser> browser) {
|
void RunPluginInfoTest(CefRefPtr<CefBrowser> browser) {
|
||||||
if (CefCurrentlyOn(TID_UI)) {
|
if (CefCurrentlyOn(TID_UI)) {
|
||||||
UIT_RunPluginInfoTest(browser);
|
UIT_RunPluginInfoTest(browser);
|
||||||
@@ -661,10 +630,6 @@ void RunPluginInfoTest(CefRefPtr<CefBrowser> browser) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunGeolocationTest(CefRefPtr<CefBrowser> browser) {
|
void RunOtherTests(CefRefPtr<CefBrowser> browser) {
|
||||||
browser->GetMainFrame()->LoadURL("http://html5demos.com/geo");
|
browser->GetMainFrame()->LoadURL("http://tests/other_tests");
|
||||||
}
|
|
||||||
|
|
||||||
void RunDialogsTest(CefRefPtr<CefBrowser> browser) {
|
|
||||||
browser->GetMainFrame()->LoadURL("http://tests/dialogs");
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -41,18 +41,10 @@ void RunRequestTest(CefRefPtr<CefBrowser> browser);
|
|||||||
void RunJavaScriptExecuteTest(CefRefPtr<CefBrowser> browser);
|
void RunJavaScriptExecuteTest(CefRefPtr<CefBrowser> browser);
|
||||||
void RunJavaScriptInvokeTest(CefRefPtr<CefBrowser> browser);
|
void RunJavaScriptInvokeTest(CefRefPtr<CefBrowser> browser);
|
||||||
void RunPopupTest(CefRefPtr<CefBrowser> browser);
|
void RunPopupTest(CefRefPtr<CefBrowser> browser);
|
||||||
void RunLocalStorageTest(CefRefPtr<CefBrowser> browser);
|
|
||||||
void RunAccelerated2DCanvasTest(CefRefPtr<CefBrowser> browser);
|
|
||||||
void RunAcceleratedLayersTest(CefRefPtr<CefBrowser> browser);
|
|
||||||
void RunWebGLTest(CefRefPtr<CefBrowser> browser);
|
|
||||||
void RunXMLHTTPRequestTest(CefRefPtr<CefBrowser> browser);
|
|
||||||
void RunWebURLRequestTest(CefRefPtr<CefBrowser> browser);
|
void RunWebURLRequestTest(CefRefPtr<CefBrowser> browser);
|
||||||
void RunDOMAccessTest(CefRefPtr<CefBrowser> browser);
|
void RunDOMAccessTest(CefRefPtr<CefBrowser> browser);
|
||||||
void RunDragDropTest(CefRefPtr<CefBrowser> browser);
|
|
||||||
void RunModalDialogTest(CefRefPtr<CefBrowser> browser);
|
|
||||||
void RunPluginInfoTest(CefRefPtr<CefBrowser> browser);
|
void RunPluginInfoTest(CefRefPtr<CefBrowser> browser);
|
||||||
void RunGeolocationTest(CefRefPtr<CefBrowser> browser);
|
void RunOtherTests(CefRefPtr<CefBrowser> browser);
|
||||||
void RunDialogsTest(CefRefPtr<CefBrowser> browser);
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
void RunTransparentPopupTest(CefRefPtr<CefBrowser> browser);
|
void RunTransparentPopupTest(CefRefPtr<CefBrowser> browser);
|
||||||
|
@@ -36,6 +36,7 @@ IDS_LOGOBALL BINARY "res\\logoball.png"
|
|||||||
IDS_MODALDIALOG BINARY "res\\modaldialog.html"
|
IDS_MODALDIALOG BINARY "res\\modaldialog.html"
|
||||||
IDS_MODALMAIN BINARY "res\\modalmain.html"
|
IDS_MODALMAIN BINARY "res\\modalmain.html"
|
||||||
IDS_OSRPLUGIN BINARY "res\\osrplugin.html"
|
IDS_OSRPLUGIN BINARY "res\\osrplugin.html"
|
||||||
|
IDS_OTHER_TESTS BINARY "res\\other_tests.html"
|
||||||
IDS_PERFORMANCE BINARY "res\\performance.html"
|
IDS_PERFORMANCE BINARY "res\\performance.html"
|
||||||
IDS_TRANSPARENCY BINARY "res\\transparency.html"
|
IDS_TRANSPARENCY BINARY "res\\transparency.html"
|
||||||
IDS_UIPLUGIN BINARY "res\\uiplugin.html"
|
IDS_UIPLUGIN BINARY "res\\uiplugin.html"
|
||||||
@@ -74,37 +75,29 @@ BEGIN
|
|||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "Get Source", ID_TESTS_GETSOURCE
|
MENUITEM "Get Source", ID_TESTS_GETSOURCE
|
||||||
MENUITEM "Get Text", ID_TESTS_GETTEXT
|
MENUITEM "Get Text", ID_TESTS_GETTEXT
|
||||||
|
MENUITEM "Popup Window", ID_TESTS_POPUP
|
||||||
|
MENUITEM "Transparent Popup Window", ID_TESTS_TRANSPARENT_POPUP
|
||||||
|
MENUITEM "Request", ID_TESTS_REQUEST
|
||||||
|
MENUITEM "Scheme Handler", ID_TESTS_SCHEME_HANDLER
|
||||||
MENUITEM "JavaScript Binding Handler", ID_TESTS_JAVASCRIPT_BINDING
|
MENUITEM "JavaScript Binding Handler", ID_TESTS_JAVASCRIPT_BINDING
|
||||||
MENUITEM "JavaScript Extension Handler",ID_TESTS_JAVASCRIPT_EXTENSION
|
MENUITEM "JavaScript Extension Handler",ID_TESTS_JAVASCRIPT_EXTENSION
|
||||||
MENUITEM "JavaScript Execute", ID_TESTS_JAVASCRIPT_EXECUTE
|
MENUITEM "JavaScript Execute", ID_TESTS_JAVASCRIPT_EXECUTE
|
||||||
MENUITEM "JavaScript Invoke", ID_TESTS_JAVASCRIPT_INVOKE
|
MENUITEM "JavaScript Invoke", ID_TESTS_JAVASCRIPT_INVOKE
|
||||||
MENUITEM "Performance Tests", ID_TESTS_PERFORMANCE
|
MENUITEM "Performance Tests", ID_TESTS_PERFORMANCE
|
||||||
MENUITEM "Dialogs", ID_TESTS_DIALOGS
|
|
||||||
MENUITEM "Plugin", ID_TESTS_PLUGIN
|
|
||||||
MENUITEM "Plugin Info", ID_TESTS_PLUGIN_INFO
|
MENUITEM "Plugin Info", ID_TESTS_PLUGIN_INFO
|
||||||
MENUITEM "Popup Window", ID_TESTS_POPUP
|
MENUITEM "WebURLRequest", ID_TESTS_WEBURLREQUEST
|
||||||
MENUITEM "Transparent Popup Window", ID_TESTS_TRANSPARENT_POPUP
|
MENUITEM "DOM Access", ID_TESTS_DOMACCESS
|
||||||
MENUITEM "Request", ID_TESTS_REQUEST
|
MENUITEM "Zoom In", ID_TESTS_ZOOM_IN
|
||||||
MENUITEM "Scheme Handler", ID_TESTS_SCHEME_HANDLER
|
MENUITEM "Zoom Out", ID_TESTS_ZOOM_OUT
|
||||||
|
MENUITEM "Zoom Reset", ID_TESTS_ZOOM_RESET
|
||||||
|
MENUITEM "Show Developer Tools", ID_TESTS_DEVTOOLS_SHOW
|
||||||
|
MENUITEM "Close Developer Tools", ID_TESTS_DEVTOOLS_CLOSE
|
||||||
|
MENUITEM "Plugin", ID_TESTS_PLUGIN
|
||||||
MENUITEM "UI App Example", ID_TESTS_UIAPP
|
MENUITEM "UI App Example", ID_TESTS_UIAPP
|
||||||
MENUITEM "Off-Screen Rendering Example",ID_TESTS_OSRAPP
|
MENUITEM "Off-Screen Rendering Example",ID_TESTS_OSRAPP
|
||||||
MENUITEM "Transparent Off-Screen Rendering Example",ID_TESTS_TRANSPARENT_OSRAPP
|
MENUITEM "Transparent Off-Screen Rendering Example",ID_TESTS_TRANSPARENT_OSRAPP
|
||||||
MENUITEM "Local Storage", ID_TESTS_LOCALSTORAGE
|
|
||||||
MENUITEM "XMLHttpRequest", ID_TESTS_XMLHTTPREQUEST
|
|
||||||
MENUITEM "WebURLRequest", ID_TESTS_WEBURLREQUEST
|
|
||||||
MENUITEM "DOM Access", ID_TESTS_DOMACCESS
|
|
||||||
MENUITEM "Accelerated 2D Canvas", ID_TESTS_ACCELERATED2DCANVAS
|
|
||||||
MENUITEM "Accelerated Layers", ID_TESTS_ACCELERATEDLAYERS
|
|
||||||
MENUITEM "WebGL", ID_TESTS_WEBGL
|
|
||||||
MENUITEM "Drag && Drop", ID_TESTS_DRAGDROP
|
|
||||||
MENUITEM "Geolocation", ID_TESTS_GEOLOCATION
|
|
||||||
MENUITEM "Zoom In", ID_TESTS_ZOOM_IN
|
|
||||||
MENUITEM "Zoom Out", ID_TESTS_ZOOM_OUT
|
|
||||||
MENUITEM "Reset Zoom", ID_TESTS_ZOOM_RESET
|
|
||||||
MENUITEM "Show Developer Tools", ID_TESTS_DEVTOOLS_SHOW
|
|
||||||
MENUITEM "Close Developer Tools", ID_TESTS_DEVTOOLS_CLOSE
|
|
||||||
MENUITEM "Modal Dialog", ID_TESTS_MODALDIALOG
|
|
||||||
MENUITEM "Get Image", ID_TESTS_GETIMAGE
|
MENUITEM "Get Image", ID_TESTS_GETIMAGE
|
||||||
|
MENUITEM "Other Tests", ID_TESTS_OTHER_TESTS
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ void TerminationSignalHandler(int signatl) {
|
|||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for Debug > Get Source... menu item.
|
// Callback for Tests > Get Source... menu item.
|
||||||
gboolean GetSourceActivated(GtkWidget* widget) {
|
gboolean GetSourceActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
RunGetSourceTest(g_handler->GetBrowser());
|
RunGetSourceTest(g_handler->GetBrowser());
|
||||||
@@ -39,7 +39,7 @@ gboolean GetSourceActivated(GtkWidget* widget) {
|
|||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for Debug > Get Source... menu item.
|
// Callback for Tests > Get Source... menu item.
|
||||||
gboolean GetTextActivated(GtkWidget* widget) {
|
gboolean GetTextActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
RunGetTextTest(g_handler->GetBrowser());
|
RunGetTextTest(g_handler->GetBrowser());
|
||||||
@@ -47,95 +47,7 @@ gboolean GetTextActivated(GtkWidget* widget) {
|
|||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for Debug > JS Binding... menu item.
|
// Callback for Tests > Popup Window... menu item.
|
||||||
gboolean JSBindngActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunBindingTest(g_handler->GetBrowser());
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for Debug > JS Extension... menu item.
|
|
||||||
gboolean JSExtensionActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunExtensionTest(g_handler->GetBrowser());
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for Debug > JS Execute... menu item.
|
|
||||||
gboolean JSExecuteActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunJavaScriptExecuteTest(g_handler->GetBrowser());
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for Debug > Performance Tests... menu item.
|
|
||||||
gboolean PerformanceActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
performance_test::RunTest(g_handler->GetBrowser());
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for Debug > Dialogs... menu item.
|
|
||||||
gboolean DialogsActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunDialogsTest(g_handler->GetBrowser());
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for Debug > Request... menu item.
|
|
||||||
gboolean RequestActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunRequestTest(g_handler->GetBrowser());
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for Debug > Local Storage... menu item.
|
|
||||||
gboolean LocalStorageActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunLocalStorageTest(g_handler->GetBrowser());
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for Debug > XMLHttpRequest... menu item.
|
|
||||||
gboolean XMLHttpRequestActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunXMLHTTPRequestTest(g_handler->GetBrowser());
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for Debug > WebURLRequest... menu item.
|
|
||||||
gboolean WebURLRequestActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunWebURLRequestTest(g_handler->GetBrowser());
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for Debug > DOM Access... menu item.
|
|
||||||
gboolean DOMAccessActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunDOMAccessTest(g_handler->GetBrowser());
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for Debug > Scheme Handler... menu item.
|
|
||||||
gboolean SchemeHandlerActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunSchemeTest(g_handler->GetBrowser());
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for Debug > Popup Window... menu item.
|
|
||||||
gboolean PopupWindowActivated(GtkWidget* widget) {
|
gboolean PopupWindowActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
RunPopupTest(g_handler->GetBrowser());
|
RunPopupTest(g_handler->GetBrowser());
|
||||||
@@ -143,31 +55,87 @@ gboolean PopupWindowActivated(GtkWidget* widget) {
|
|||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for Debug > Accelerated 2D Canvas:... menu item.
|
// Callback for Tests > Request... menu item.
|
||||||
gboolean Accelerated2DCanvasActivated(GtkWidget* widget) {
|
gboolean RequestActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
RunAccelerated2DCanvasTest(g_handler->GetBrowser());
|
RunRequestTest(g_handler->GetBrowser());
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for Debug > Accelerated Layers:... menu item.
|
// Callback for Tests > Scheme Handler... menu item.
|
||||||
gboolean AcceleratedLayersActivated(GtkWidget* widget) {
|
gboolean SchemeHandlerActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
RunAcceleratedLayersTest(g_handler->GetBrowser());
|
scheme_test::RunTest(g_handler->GetBrowser());
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for Debug > WebGL:... menu item.
|
// Callback for Tests > JS Binding... menu item.
|
||||||
gboolean WebGLActivated(GtkWidget* widget) {
|
gboolean JSBindingActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
RunWebGLTest(g_handler->GetBrowser());
|
RunBindingTest(g_handler->GetBrowser());
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for Debug > Zoom In... menu item.
|
// Callback for Tests > JavaScript Extension... menu item.
|
||||||
|
gboolean JSExtensionActivated(GtkWidget* widget) {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
|
extension_test::RunTest(g_handler->GetBrowser());
|
||||||
|
|
||||||
|
return FALSE; // Don't stop this message.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback for Tests > JavaScript Execute... menu item.
|
||||||
|
gboolean JSExecuteActivated(GtkWidget* widget) {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
|
RunJavaScriptExecuteTest(g_handler->GetBrowser());
|
||||||
|
|
||||||
|
return FALSE; // Don't stop this message.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback for Tests > JavaScript Invoke... menu item.
|
||||||
|
gboolean JSInvokeActivated(GtkWidget* widget) {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
|
RunJavaScriptInvokeTest(g_handler->GetBrowser());
|
||||||
|
|
||||||
|
return FALSE; // Don't stop this message.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback for Tests > Performance Tests... menu item.
|
||||||
|
gboolean PerformanceActivated(GtkWidget* widget) {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
|
performance_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->GetBrowserHwnd())
|
||||||
|
RunPluginInfoTest(g_handler->GetBrowser());
|
||||||
|
|
||||||
|
return FALSE; // Don't stop this message.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback for Tests > WebURLRequest... menu item.
|
||||||
|
gboolean WebURLRequestActivated(GtkWidget* widget) {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
|
RunWebURLRequestTest(g_handler->GetBrowser());
|
||||||
|
|
||||||
|
return FALSE; // Don't stop this message.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback for Tests > DOM Access... menu item.
|
||||||
|
gboolean DOMAccessActivated(GtkWidget* widget) {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
|
RunDOMAccessTest(g_handler->GetBrowser());
|
||||||
|
|
||||||
|
return FALSE; // Don't stop this message.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback for Tests > Zoom In... menu item.
|
||||||
gboolean ZoomInActivated(GtkWidget* widget) {
|
gboolean ZoomInActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
||||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||||
@@ -177,7 +145,7 @@ gboolean ZoomInActivated(GtkWidget* widget) {
|
|||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for Debug > Zoom Out... menu item.
|
// Callback for Tests > Zoom Out... menu item.
|
||||||
gboolean ZoomOutActivated(GtkWidget* widget) {
|
gboolean ZoomOutActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
||||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||||
@@ -187,7 +155,7 @@ gboolean ZoomOutActivated(GtkWidget* widget) {
|
|||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for Debug > Zoom Reset... menu item.
|
// Callback for Tests > Zoom Reset... menu item.
|
||||||
gboolean ZoomResetActivated(GtkWidget* widget) {
|
gboolean ZoomResetActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
||||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||||
@@ -197,24 +165,6 @@ gboolean ZoomResetActivated(GtkWidget* widget) {
|
|||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean DragDropActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
|
||||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
|
||||||
RunDragDropTest(browser);
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean GeolocationActivated(GtkWidget* widget) {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
|
||||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
|
||||||
RunGeolocationTest(browser);
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean ShowDevtoolsActivated(GtkWidget* widget) {
|
gboolean ShowDevtoolsActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
||||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||||
@@ -224,10 +174,19 @@ gboolean ShowDevtoolsActivated(GtkWidget* widget) {
|
|||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for Debug > Plugin Info... menu item.
|
gboolean CloseDevtoolsActivated(GtkWidget* widget) {
|
||||||
gboolean PluginInfoActivated(GtkWidget* widget) {
|
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
||||||
|
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||||
|
browser->CloseDevTools();
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE; // Don't stop this message.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback for Tests > Other Tests... menu item.
|
||||||
|
gboolean OtherTestsActivated(GtkWidget* widget) {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
RunPluginInfoTest(g_handler->GetBrowser());
|
RunOtherTests(g_handler->GetBrowser());
|
||||||
|
|
||||||
return FALSE; // Don't stop this message.
|
return FALSE; // Don't stop this message.
|
||||||
}
|
}
|
||||||
@@ -291,48 +250,40 @@ GtkWidget* CreateMenuBar() {
|
|||||||
G_CALLBACK(GetSourceActivated));
|
G_CALLBACK(GetSourceActivated));
|
||||||
AddMenuEntry(debug_menu, "Get Text",
|
AddMenuEntry(debug_menu, "Get Text",
|
||||||
G_CALLBACK(GetTextActivated));
|
G_CALLBACK(GetTextActivated));
|
||||||
AddMenuEntry(debug_menu, "JS Binding",
|
|
||||||
G_CALLBACK(JSBindngActivated));
|
|
||||||
AddMenuEntry(debug_menu, "JS Extension",
|
|
||||||
G_CALLBACK(JSExtensionActivated));
|
|
||||||
AddMenuEntry(debug_menu, "JS Execute",
|
|
||||||
G_CALLBACK(JSExecuteActivated));
|
|
||||||
AddMenuEntry(debug_menu, "Performance Tests",
|
|
||||||
G_CALLBACK(PerformanceActivated));
|
|
||||||
AddMenuEntry(debug_menu, "Dialogs",
|
|
||||||
G_CALLBACK(DialogsActivated));
|
|
||||||
AddMenuEntry(debug_menu, "Request",
|
|
||||||
G_CALLBACK(RequestActivated));
|
|
||||||
AddMenuEntry(debug_menu, "Local Storage",
|
|
||||||
G_CALLBACK(LocalStorageActivated));
|
|
||||||
AddMenuEntry(debug_menu, "XMLHttpRequest",
|
|
||||||
G_CALLBACK(XMLHttpRequestActivated));
|
|
||||||
AddMenuEntry(debug_menu, "DOM Access",
|
|
||||||
G_CALLBACK(DOMAccessActivated));
|
|
||||||
AddMenuEntry(debug_menu, "Scheme Handler",
|
|
||||||
G_CALLBACK(SchemeHandlerActivated));
|
|
||||||
AddMenuEntry(debug_menu, "Popup Window",
|
AddMenuEntry(debug_menu, "Popup Window",
|
||||||
G_CALLBACK(PopupWindowActivated));
|
G_CALLBACK(PopupWindowActivated));
|
||||||
AddMenuEntry(debug_menu, "Accelerated 2D Canvas",
|
AddMenuEntry(debug_menu, "Request",
|
||||||
G_CALLBACK(Accelerated2DCanvasActivated));
|
G_CALLBACK(RequestActivated));
|
||||||
AddMenuEntry(debug_menu, "Accelerated Layers",
|
AddMenuEntry(debug_menu, "Scheme Handler",
|
||||||
G_CALLBACK(AcceleratedLayersActivated));
|
G_CALLBACK(SchemeHandlerActivated));
|
||||||
AddMenuEntry(debug_menu, "WebGL",
|
AddMenuEntry(debug_menu, "JavaScript Binding Handler",
|
||||||
G_CALLBACK(WebGLActivated));
|
G_CALLBACK(JSBindingActivated));
|
||||||
|
AddMenuEntry(debug_menu, "JavaScript Extension Handler",
|
||||||
|
G_CALLBACK(JSExtensionActivated));
|
||||||
|
AddMenuEntry(debug_menu, "JavaScript Execute",
|
||||||
|
G_CALLBACK(JSExecuteActivated));
|
||||||
|
AddMenuEntry(debug_menu, "JavaScript Invoke",
|
||||||
|
G_CALLBACK(JSInvokeActivated));
|
||||||
|
AddMenuEntry(debug_menu, "Performance Tests",
|
||||||
|
G_CALLBACK(PerformanceActivated));
|
||||||
|
AddMenuEntry(debug_menu, "Plugin Info",
|
||||||
|
G_CALLBACK(PluginInfoActivated));
|
||||||
|
AddMenuEntry(debug_menu, "WebURLRequest",
|
||||||
|
G_CALLBACK(WebURLRequestActivated));
|
||||||
|
AddMenuEntry(debug_menu, "DOM Access",
|
||||||
|
G_CALLBACK(DOMAccessActivated));
|
||||||
AddMenuEntry(debug_menu, "Zoom In",
|
AddMenuEntry(debug_menu, "Zoom In",
|
||||||
G_CALLBACK(ZoomInActivated));
|
G_CALLBACK(ZoomInActivated));
|
||||||
AddMenuEntry(debug_menu, "Zoom Out",
|
AddMenuEntry(debug_menu, "Zoom Out",
|
||||||
G_CALLBACK(ZoomOutActivated));
|
G_CALLBACK(ZoomOutActivated));
|
||||||
AddMenuEntry(debug_menu, "Zoom Reset",
|
AddMenuEntry(debug_menu, "Zoom Reset",
|
||||||
G_CALLBACK(ZoomResetActivated));
|
G_CALLBACK(ZoomResetActivated));
|
||||||
AddMenuEntry(debug_menu, "Drag & Drop",
|
AddMenuEntry(debug_menu, "Show Developer Tools",
|
||||||
G_CALLBACK(DragDropActivated));
|
|
||||||
AddMenuEntry(debug_menu, "Geolocation",
|
|
||||||
G_CALLBACK(GeolocationActivated));
|
|
||||||
AddMenuEntry(debug_menu, "Show DevTools",
|
|
||||||
G_CALLBACK(ShowDevtoolsActivated));
|
G_CALLBACK(ShowDevtoolsActivated));
|
||||||
AddMenuEntry(debug_menu, "Plugin Info",
|
AddMenuEntry(debug_menu, "Close Developer Tools",
|
||||||
G_CALLBACK(PluginInfoActivated));
|
G_CALLBACK(CloseDevtoolsActivated));
|
||||||
|
AddMenuEntry(debug_menu, "Other Tests",
|
||||||
|
G_CALLBACK(OtherTestsActivated));
|
||||||
|
|
||||||
return menu_bar;
|
return menu_bar;
|
||||||
}
|
}
|
||||||
@@ -369,10 +320,10 @@ int main(int argc, char *argv[]) {
|
|||||||
CefInitialize(settings, app);
|
CefInitialize(settings, app);
|
||||||
|
|
||||||
// Register the V8 extension handler.
|
// Register the V8 extension handler.
|
||||||
InitExtensionTest();
|
extension_test::InitTest();
|
||||||
|
|
||||||
// Register the scheme handler.
|
// Register the scheme handler.
|
||||||
InitSchemeTest();
|
scheme_test::InitTest();
|
||||||
|
|
||||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
|
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors.
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors.
|
||||||
// Portions copyright (c) 2010 The Chromium Authors. All rights reserved.
|
// Portions copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
@@ -195,32 +195,25 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
- (void)createApp:(id)object;
|
- (void)createApp:(id)object;
|
||||||
- (IBAction)testGetSource:(id)sender;
|
- (IBAction)testGetSource:(id)sender;
|
||||||
- (IBAction)testGetText:(id)sender;
|
- (IBAction)testGetText:(id)sender;
|
||||||
|
- (IBAction)testPopupWindow:(id)sender;
|
||||||
|
- (IBAction)testRequest:(id)sender;
|
||||||
|
- (IBAction)testSchemeHandler:(id)sender;
|
||||||
- (IBAction)testJSBinding:(id)sender;
|
- (IBAction)testJSBinding:(id)sender;
|
||||||
- (IBAction)testJSExtension:(id)sender;
|
- (IBAction)testJSExtension:(id)sender;
|
||||||
- (IBAction)testJSExecute:(id)sender;
|
- (IBAction)testJSExecute:(id)sender;
|
||||||
- (IBAction)testJSInvoke:(id)sender;
|
- (IBAction)testJSInvoke:(id)sender;
|
||||||
- (IBAction)testPerformance:(id)sender;
|
- (IBAction)testPerformance:(id)sender;
|
||||||
- (IBAction)testDialogs:(id)sender;
|
- (IBAction)testPluginInfo:(id)sender;
|
||||||
- (IBAction)testRequest:(id)sender;
|
|
||||||
- (IBAction)testLocalStorage:(id)sender;
|
|
||||||
- (IBAction)testXMLHttpRequest:(id)sender;
|
|
||||||
- (IBAction)testWebURLRequest:(id)sender;
|
- (IBAction)testWebURLRequest:(id)sender;
|
||||||
- (IBAction)testDOMAccess:(id)sender;
|
- (IBAction)testDOMAccess:(id)sender;
|
||||||
- (IBAction)testSchemeHandler:(id)sender;
|
|
||||||
- (IBAction)testPopupWindow:(id)sender;
|
|
||||||
- (IBAction)testAccelerated2DCanvas:(id)sender;
|
|
||||||
- (IBAction)testAcceleratedLayers:(id)sender;
|
|
||||||
- (IBAction)testWebGL:(id)sender;
|
|
||||||
- (IBAction)testDragDrop:(id)sender;
|
|
||||||
- (IBAction)testGeolocation:(id)sender;
|
|
||||||
- (IBAction)testZoomIn:(id)sender;
|
- (IBAction)testZoomIn:(id)sender;
|
||||||
- (IBAction)testZoomOut:(id)sender;
|
- (IBAction)testZoomOut:(id)sender;
|
||||||
- (IBAction)testZoomReset:(id)sender;
|
- (IBAction)testZoomReset:(id)sender;
|
||||||
- (IBAction)testDevToolsShow:(id)sender;
|
- (IBAction)testDevToolsShow:(id)sender;
|
||||||
- (IBAction)testDevToolsClose:(id)sender;
|
- (IBAction)testDevToolsClose:(id)sender;
|
||||||
- (IBAction)testPluginInfo:(id)sender;
|
|
||||||
- (IBAction)testOffscreenRendering:(id)sender;
|
- (IBAction)testOffscreenRendering:(id)sender;
|
||||||
- (IBAction)testTransparentOffscreenRendering:(id)sender;
|
- (IBAction)testTransparentOffscreenRendering:(id)sender;
|
||||||
|
- (IBAction)testOtherTests:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation ClientAppDelegate
|
@implementation ClientAppDelegate
|
||||||
@@ -245,6 +238,15 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
[testMenu addItemWithTitle:@"Get Text"
|
[testMenu addItemWithTitle:@"Get Text"
|
||||||
action:@selector(testGetText:)
|
action:@selector(testGetText:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
|
[testMenu addItemWithTitle:@"Popup Window"
|
||||||
|
action:@selector(testPopupWindow:)
|
||||||
|
keyEquivalent:@""];
|
||||||
|
[testMenu addItemWithTitle:@"Request"
|
||||||
|
action:@selector(testRequest:)
|
||||||
|
keyEquivalent:@""];
|
||||||
|
[testMenu addItemWithTitle:@"Scheme Handler"
|
||||||
|
action:@selector(testSchemeHandler:)
|
||||||
|
keyEquivalent:@""];
|
||||||
[testMenu addItemWithTitle:@"JavaScript Binding Handler"
|
[testMenu addItemWithTitle:@"JavaScript Binding Handler"
|
||||||
action:@selector(testJSBinding:)
|
action:@selector(testJSBinding:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
@@ -260,23 +262,8 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
[testMenu addItemWithTitle:@"Performance Tests"
|
[testMenu addItemWithTitle:@"Performance Tests"
|
||||||
action:@selector(testPerformance:)
|
action:@selector(testPerformance:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
[testMenu addItemWithTitle:@"Dialogs"
|
[testMenu addItemWithTitle:@"Plugin Info"
|
||||||
action:@selector(testDialogs:)
|
action:@selector(testPluginInfo:)
|
||||||
keyEquivalent:@""];
|
|
||||||
[testMenu addItemWithTitle:@"Popup Window"
|
|
||||||
action:@selector(testPopupWindow:)
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[testMenu addItemWithTitle:@"Request"
|
|
||||||
action:@selector(testRequest:)
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[testMenu addItemWithTitle:@"Scheme Handler"
|
|
||||||
action:@selector(testSchemeHandler:)
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[testMenu addItemWithTitle:@"Local Storage"
|
|
||||||
action:@selector(testLocalStorage:)
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[testMenu addItemWithTitle:@"XMLHttpRequest"
|
|
||||||
action:@selector(testXMLHttpRequest:)
|
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
[testMenu addItemWithTitle:@"WebURLRequest"
|
[testMenu addItemWithTitle:@"WebURLRequest"
|
||||||
action:@selector(testWebURLRequest:)
|
action:@selector(testWebURLRequest:)
|
||||||
@@ -284,21 +271,6 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
[testMenu addItemWithTitle:@"DOM Access"
|
[testMenu addItemWithTitle:@"DOM Access"
|
||||||
action:@selector(testDOMAccess:)
|
action:@selector(testDOMAccess:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
[testMenu addItemWithTitle:@"Accelerated 2D Canvas"
|
|
||||||
action:@selector(testAccelerated2DCanvas:)
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[testMenu addItemWithTitle:@"Accelerated Layers"
|
|
||||||
action:@selector(testAcceleratedLayers:)
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[testMenu addItemWithTitle:@"WebGL"
|
|
||||||
action:@selector(testWebGL:)
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[testMenu addItemWithTitle:@"Drag & Drop"
|
|
||||||
action:@selector(testDragDrop:)
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[testMenu addItemWithTitle:@"Geolocation"
|
|
||||||
action:@selector(testGeolocation:)
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[testMenu addItemWithTitle:@"Zoom In"
|
[testMenu addItemWithTitle:@"Zoom In"
|
||||||
action:@selector(testZoomIn:)
|
action:@selector(testZoomIn:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
@@ -308,21 +280,21 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
[testMenu addItemWithTitle:@"Zoom Reset"
|
[testMenu addItemWithTitle:@"Zoom Reset"
|
||||||
action:@selector(testZoomReset:)
|
action:@selector(testZoomReset:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
[testMenu addItemWithTitle:@"Show DevTools"
|
[testMenu addItemWithTitle:@"Show Developer Tools"
|
||||||
action:@selector(testDevToolsShow:)
|
action:@selector(testDevToolsShow:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
[testMenu addItemWithTitle:@"Close DevTools"
|
[testMenu addItemWithTitle:@"Close Developer Tools"
|
||||||
action:@selector(testDevToolsClose:)
|
action:@selector(testDevToolsClose:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
[testMenu addItemWithTitle:@"Plugin Info"
|
|
||||||
action:@selector(testPluginInfo:)
|
|
||||||
keyEquivalent:@""];
|
|
||||||
[testMenu addItemWithTitle:@"Offscreen Rendering"
|
[testMenu addItemWithTitle:@"Offscreen Rendering"
|
||||||
action:@selector(testOffscreenRendering:)
|
action:@selector(testOffscreenRendering:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
[testMenu addItemWithTitle:@"Transparent Offscreen Rendering"
|
[testMenu addItemWithTitle:@"Transparent Offscreen Rendering"
|
||||||
action:@selector(testTransparentOffscreenRendering:)
|
action:@selector(testTransparentOffscreenRendering:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
|
[testMenu addItemWithTitle:@"Other Tests"
|
||||||
|
action:@selector(testOtherTests:)
|
||||||
|
keyEquivalent:@""];
|
||||||
[testItem setSubmenu:testMenu];
|
[testItem setSubmenu:testMenu];
|
||||||
[menubar addItem:testItem];
|
[menubar addItem:testItem];
|
||||||
|
|
||||||
@@ -424,6 +396,21 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
RunGetTextTest(g_handler->GetBrowser());
|
RunGetTextTest(g_handler->GetBrowser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction)testPopupWindow:(id)sender {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
|
RunPopupTest(g_handler->GetBrowser());
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction)testRequest:(id)sender {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
|
RunRequestTest(g_handler->GetBrowser());
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction)testSchemeHandler:(id)sender {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
|
scheme_test::RunTest(g_handler->GetBrowser());
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction)testJSBinding:(id)sender {
|
- (IBAction)testJSBinding:(id)sender {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
RunBindingTest(g_handler->GetBrowser());
|
RunBindingTest(g_handler->GetBrowser());
|
||||||
@@ -431,7 +418,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
|
|
||||||
- (IBAction)testJSExtension:(id)sender {
|
- (IBAction)testJSExtension:(id)sender {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
RunExtensionTest(g_handler->GetBrowser());
|
extension_test::RunTest(g_handler->GetBrowser());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)testJSExecute:(id)sender {
|
- (IBAction)testJSExecute:(id)sender {
|
||||||
@@ -449,24 +436,9 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
performance_test::RunTest(g_handler->GetBrowser());
|
performance_test::RunTest(g_handler->GetBrowser());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)testDialogs:(id)sender {
|
- (IBAction)testPluginInfo:(id)sender {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
RunDialogsTest(g_handler->GetBrowser());
|
RunPluginInfoTest(g_handler->GetBrowser());
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)testRequest:(id)sender {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunRequestTest(g_handler->GetBrowser());
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)testLocalStorage:(id)sender {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunLocalStorageTest(g_handler->GetBrowser());
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)testXMLHttpRequest:(id)sender {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunXMLHTTPRequestTest(g_handler->GetBrowser());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)testWebURLRequest:(id)sender {
|
- (IBAction)testWebURLRequest:(id)sender {
|
||||||
@@ -479,41 +451,6 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
RunDOMAccessTest(g_handler->GetBrowser());
|
RunDOMAccessTest(g_handler->GetBrowser());
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)testSchemeHandler:(id)sender {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunSchemeTest(g_handler->GetBrowser());
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)testPopupWindow:(id)sender {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunPopupTest(g_handler->GetBrowser());
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)testAccelerated2DCanvas:(id)sender {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunAccelerated2DCanvasTest(g_handler->GetBrowser());
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)testAcceleratedLayers:(id)sender {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunAcceleratedLayersTest(g_handler->GetBrowser());
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)testWebGL:(id)sender {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunWebGLTest(g_handler->GetBrowser());
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)testDragDrop:(id)sender {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunDragDropTest(g_handler->GetBrowser());
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)testGeolocation:(id)sender {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunGeolocationTest(g_handler->GetBrowser());
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)testZoomIn:(id)sender {
|
- (IBAction)testZoomIn:(id)sender {
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
if (g_handler.get() && g_handler->GetBrowserHwnd()) {
|
||||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||||
@@ -549,11 +486,6 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)testPluginInfo:(id)sender {
|
|
||||||
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
|
||||||
RunPluginInfoTest(g_handler->GetBrowser());
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)testOffscreenRendering:(id)sender {
|
- (IBAction)testOffscreenRendering:(id)sender {
|
||||||
osrtest::RunTest(false);
|
osrtest::RunTest(false);
|
||||||
}
|
}
|
||||||
@@ -562,6 +494,11 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
|||||||
osrtest::RunTest(true);
|
osrtest::RunTest(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction)testOtherTests:(id)sender {
|
||||||
|
if (g_handler.get() && g_handler->GetBrowserHwnd())
|
||||||
|
RunOtherTests(g_handler->GetBrowser());
|
||||||
|
}
|
||||||
|
|
||||||
// Sent by the default notification center immediately before the application
|
// Sent by the default notification center immediately before the application
|
||||||
// terminates.
|
// terminates.
|
||||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
||||||
@@ -600,9 +537,11 @@ int main(int argc, char* argv[]) {
|
|||||||
// Initialize CEF.
|
// Initialize CEF.
|
||||||
CefInitialize(settings, app);
|
CefInitialize(settings, app);
|
||||||
|
|
||||||
// Initialize tests.
|
// Register the V8 extension handler.
|
||||||
InitExtensionTest();
|
extension_test::InitTest();
|
||||||
InitSchemeTest();
|
|
||||||
|
// Register the scheme handler.
|
||||||
|
scheme_test::InitTest();
|
||||||
|
|
||||||
// Create the application delegate and window.
|
// Create the application delegate and window.
|
||||||
NSObject* delegate = [[ClientAppDelegate alloc] init];
|
NSObject* delegate = [[ClientAppDelegate alloc] init];
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -77,19 +77,19 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||||||
CefInitialize(settings, app);
|
CefInitialize(settings, app);
|
||||||
|
|
||||||
// Register the internal client plugin.
|
// Register the internal client plugin.
|
||||||
InitPluginTest();
|
plugin_test::InitTest();
|
||||||
|
|
||||||
// Register the internal UI client plugin.
|
// Register the internal UI client plugin.
|
||||||
InitUIPluginTest();
|
uiplugin_test::InitTest();
|
||||||
|
|
||||||
// Register the internal OSR client plugin.
|
// Register the internal OSR client plugin.
|
||||||
InitOSRPluginTest();
|
osrplugin_test::InitTest();
|
||||||
|
|
||||||
// Register the V8 extension handler.
|
// Register the V8 extension handler.
|
||||||
InitExtensionTest();
|
extension_test::InitTest();
|
||||||
|
|
||||||
// Register the scheme handler.
|
// Register the scheme handler.
|
||||||
InitSchemeTest();
|
scheme_test::InitTest();
|
||||||
|
|
||||||
HACCEL hAccelTable;
|
HACCEL hAccelTable;
|
||||||
|
|
||||||
@@ -441,38 +441,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunGetTextTest(browser);
|
RunGetTextTest(browser);
|
||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_JAVASCRIPT_BINDING: // Test the V8 binding handler
|
|
||||||
if (browser.get())
|
|
||||||
RunBindingTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_JAVASCRIPT_EXTENSION: // Test the V8 extension handler
|
|
||||||
if (browser.get())
|
|
||||||
RunExtensionTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_JAVASCRIPT_EXECUTE: // Test execution of javascript
|
|
||||||
if (browser.get())
|
|
||||||
RunJavaScriptExecuteTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_JAVASCRIPT_INVOKE:
|
|
||||||
if (browser.get())
|
|
||||||
RunJavaScriptInvokeTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_PERFORMANCE: // Run performance tests
|
|
||||||
if (browser.get())
|
|
||||||
performance_test::RunTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_DIALOGS: // Run dialogs tests
|
|
||||||
if (browser.get())
|
|
||||||
RunDialogsTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_PLUGIN: // Test the custom plugin
|
|
||||||
if (browser.get())
|
|
||||||
RunPluginTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_PLUGIN_INFO: // Test plugin info
|
|
||||||
if (browser.get())
|
|
||||||
RunPluginInfoTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_POPUP: // Test a popup window
|
case ID_TESTS_POPUP: // Test a popup window
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunPopupTest(browser);
|
RunPopupTest(browser);
|
||||||
@@ -487,56 +455,40 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_SCHEME_HANDLER: // Test the scheme handler
|
case ID_TESTS_SCHEME_HANDLER: // Test the scheme handler
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunSchemeTest(browser);
|
scheme_test::RunTest(browser);
|
||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_UIAPP: // Test the UI app
|
case ID_TESTS_JAVASCRIPT_BINDING: // Test the V8 binding handler
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunUIPluginTest(browser);
|
RunBindingTest(browser);
|
||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_OSRAPP: // Test the OSR app
|
case ID_TESTS_JAVASCRIPT_EXTENSION: // Test the V8 extension handler
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunOSRPluginTest(browser, false);
|
extension_test::RunTest(browser);
|
||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_TRANSPARENT_OSRAPP: // Test the OSR app with transparency
|
case ID_TESTS_JAVASCRIPT_EXECUTE: // Test execution of javascript
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunOSRPluginTest(browser, true);
|
RunJavaScriptExecuteTest(browser);
|
||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_DOMACCESS: // Test DOM access
|
case ID_TESTS_JAVASCRIPT_INVOKE:
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunDOMAccessTest(browser);
|
RunJavaScriptInvokeTest(browser);
|
||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_LOCALSTORAGE: // Test localStorage
|
case ID_TESTS_PERFORMANCE: // Run performance tests
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunLocalStorageTest(browser);
|
performance_test::RunTest(browser);
|
||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_ACCELERATED2DCANVAS: // Test accelerated 2d canvas
|
case ID_TESTS_PLUGIN_INFO: // Test plugin info
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunAccelerated2DCanvasTest(browser);
|
RunPluginInfoTest(browser);
|
||||||
return 0;
|
|
||||||
case ID_TESTS_ACCELERATEDLAYERS: // Test accelerated layers
|
|
||||||
if (browser.get())
|
|
||||||
RunAcceleratedLayersTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_WEBGL: // Test WebGL
|
|
||||||
if (browser.get())
|
|
||||||
RunWebGLTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_DRAGDROP: // Test drag & drop
|
|
||||||
if (browser.get())
|
|
||||||
RunDragDropTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_GEOLOCATION: // Test geolocation
|
|
||||||
if (browser.get())
|
|
||||||
RunGeolocationTest(browser);
|
|
||||||
return 0;
|
|
||||||
case ID_TESTS_XMLHTTPREQUEST: // Test XMLHttpRequest
|
|
||||||
if (browser.get())
|
|
||||||
RunXMLHTTPRequestTest(browser);
|
|
||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_WEBURLREQUEST:
|
case ID_TESTS_WEBURLREQUEST:
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunWebURLRequestTest(browser);
|
RunWebURLRequestTest(browser);
|
||||||
return 0;
|
return 0;
|
||||||
|
case ID_TESTS_DOMACCESS: // Test DOM access
|
||||||
|
if (browser.get())
|
||||||
|
RunDOMAccessTest(browser);
|
||||||
|
return 0;
|
||||||
case ID_TESTS_ZOOM_IN:
|
case ID_TESTS_ZOOM_IN:
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
browser->SetZoomLevel(browser->GetZoomLevel() + 0.5);
|
browser->SetZoomLevel(browser->GetZoomLevel() + 0.5);
|
||||||
@@ -557,14 +509,30 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||||||
if (browser.get())
|
if (browser.get())
|
||||||
browser->CloseDevTools();
|
browser->CloseDevTools();
|
||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_MODALDIALOG:
|
case ID_TESTS_PLUGIN: // Test the custom plugin
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunModalDialogTest(browser);
|
plugin_test::RunTest(browser);
|
||||||
|
return 0;
|
||||||
|
case ID_TESTS_UIAPP: // Test the UI app
|
||||||
|
if (browser.get())
|
||||||
|
uiplugin_test::RunTest(browser);
|
||||||
|
return 0;
|
||||||
|
case ID_TESTS_OSRAPP: // Test the OSR app
|
||||||
|
if (browser.get())
|
||||||
|
osrplugin_test::RunTest(browser, false);
|
||||||
|
return 0;
|
||||||
|
case ID_TESTS_TRANSPARENT_OSRAPP: // Test the OSR app with transparency
|
||||||
|
if (browser.get())
|
||||||
|
osrplugin_test::RunTest(browser, true);
|
||||||
return 0;
|
return 0;
|
||||||
case ID_TESTS_GETIMAGE:
|
case ID_TESTS_GETIMAGE:
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
RunGetImageTest(browser);
|
RunGetImageTest(browser);
|
||||||
return 0;
|
return 0;
|
||||||
|
case ID_TESTS_OTHER_TESTS:
|
||||||
|
if (browser.get())
|
||||||
|
RunOtherTests(browser);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -9,13 +9,66 @@
|
|||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_command_line.h"
|
#include "include/cef_command_line.h"
|
||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
|
#include "include/cef_url.h"
|
||||||
#include "cefclient/binding_test.h"
|
#include "cefclient/binding_test.h"
|
||||||
#include "cefclient/cefclient.h"
|
#include "cefclient/cefclient.h"
|
||||||
#include "cefclient/cefclient_switches.h"
|
#include "cefclient/cefclient_switches.h"
|
||||||
#include "cefclient/download_handler.h"
|
#include "cefclient/download_handler.h"
|
||||||
#include "cefclient/performance_test.h"
|
#include "cefclient/performance_test.h"
|
||||||
|
#include "cefclient/resource_util.h"
|
||||||
#include "cefclient/string_util.h"
|
#include "cefclient/string_util.h"
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
#include "cefclient/plugin_test.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
const char kTestOrigin[] = "http://tests/";
|
||||||
|
|
||||||
|
// Retrieve the file name and mime type based on the specified url.
|
||||||
|
bool ParseTestUrl(const std::string& url,
|
||||||
|
std::string* file_name,
|
||||||
|
std::string* mime_type) {
|
||||||
|
// Retrieve the path component.
|
||||||
|
CefURLParts parts;
|
||||||
|
CefParseURL(url, parts);
|
||||||
|
std::string file = CefString(&parts.path);
|
||||||
|
if (file.size() < 2)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Remove the leading slash.
|
||||||
|
file = file.substr(1);
|
||||||
|
|
||||||
|
// Verify that the file name is valid.
|
||||||
|
for(size_t i = 0; i < file.size(); ++i) {
|
||||||
|
const char c = file[i];
|
||||||
|
if (!isalpha(c) && !isdigit(c) && c != '_' && c != '.')
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine the mime type based on the file extension, if any.
|
||||||
|
size_t pos = file.rfind(".");
|
||||||
|
if (pos != std::string::npos) {
|
||||||
|
std::string ext = file.substr(pos + 1);
|
||||||
|
if (ext == "html")
|
||||||
|
*mime_type = "text/html";
|
||||||
|
else if (ext == "png")
|
||||||
|
*mime_type = "image/png";
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// Default to an html extension if none is specified.
|
||||||
|
*mime_type = "text/html";
|
||||||
|
file += ".html";
|
||||||
|
}
|
||||||
|
|
||||||
|
*file_name = file;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
ClientHandler::ClientHandler()
|
ClientHandler::ClientHandler()
|
||||||
: m_MainHwnd(NULL),
|
: m_MainHwnd(NULL),
|
||||||
m_BrowserHwnd(NULL),
|
m_BrowserHwnd(NULL),
|
||||||
@@ -25,6 +78,8 @@ ClientHandler::ClientHandler()
|
|||||||
m_StopHwnd(NULL),
|
m_StopHwnd(NULL),
|
||||||
m_ReloadHwnd(NULL),
|
m_ReloadHwnd(NULL),
|
||||||
m_bFormElementHasFocus(false) {
|
m_bFormElementHasFocus(false) {
|
||||||
|
CreateRequestDelegates(request_delegates_);
|
||||||
|
|
||||||
CefRefPtr<CefCommandLine> commandLine = AppGetCommandLine();
|
CefRefPtr<CefCommandLine> commandLine = AppGetCommandLine();
|
||||||
if (commandLine.get()) {
|
if (commandLine.get()) {
|
||||||
if (commandLine->HasSwitch(cefclient::kUrl))
|
if (commandLine->HasSwitch(cefclient::kUrl))
|
||||||
@@ -132,6 +187,53 @@ bool ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ClientHandler::OnBeforeResourceLoad(
|
||||||
|
CefRefPtr<CefBrowser> browser,
|
||||||
|
CefRefPtr<CefRequest> request,
|
||||||
|
CefString& redirectUrl,
|
||||||
|
CefRefPtr<CefStreamReader>& resourceStream,
|
||||||
|
CefRefPtr<CefResponse> response,
|
||||||
|
int loadFlags) {
|
||||||
|
std::string url = request->GetURL();
|
||||||
|
if (url.find(kTestOrigin) == 0) {
|
||||||
|
// Handle URLs in the test origin.
|
||||||
|
std::string file_name, mime_type;
|
||||||
|
if (ParseTestUrl(url, &file_name, &mime_type)) {
|
||||||
|
if (file_name == "request.html") {
|
||||||
|
// Show the request contents.
|
||||||
|
std::string dump;
|
||||||
|
DumpRequestContents(request, dump);
|
||||||
|
resourceStream = CefStreamReader::CreateForData(
|
||||||
|
static_cast<void*>(const_cast<char*>(dump.c_str())),
|
||||||
|
dump.size());
|
||||||
|
response->SetMimeType("text/plain");
|
||||||
|
response->SetStatus(200);
|
||||||
|
} else {
|
||||||
|
// Load the resource from file.
|
||||||
|
resourceStream =
|
||||||
|
GetBinaryResourceReader(file_name.c_str());
|
||||||
|
if (resourceStream.get()) {
|
||||||
|
response->SetMimeType(mime_type);
|
||||||
|
response->SetStatus(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool handled = false;
|
||||||
|
|
||||||
|
// Execute delegate callbacks.
|
||||||
|
RequestDelegateSet::iterator it = request_delegates_.begin();
|
||||||
|
for (; it != request_delegates_.end(); ++it) {
|
||||||
|
handled = (*it)->OnBeforeResourceLoad(this, browser, request, redirectUrl,
|
||||||
|
resourceStream, response, loadFlags);
|
||||||
|
if (handled || !redirectUrl.empty() || resourceStream.get())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
bool ClientHandler::GetDownloadHandler(CefRefPtr<CefBrowser> browser,
|
bool ClientHandler::GetDownloadHandler(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& mimeType,
|
const CefString& mimeType,
|
||||||
const CefString& fileName,
|
const CefString& fileName,
|
||||||
@@ -381,3 +483,12 @@ CefRefPtr<CefDOMVisitor> ClientHandler::GetDOMVisitor(const std::string& path) {
|
|||||||
return it->second;
|
return it->second;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// static
|
||||||
|
void ClientHandler::CreateRequestDelegates(RequestDelegateSet& delegates) {
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
// Create the plugin test delegates.
|
||||||
|
plugin_test::CreateRequestDelegates(delegates);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "include/cef_client.h"
|
#include "include/cef_client.h"
|
||||||
#include "cefclient/download_handler.h"
|
#include "cefclient/download_handler.h"
|
||||||
@@ -33,6 +34,25 @@ class ClientHandler : public CefClient,
|
|||||||
public CefGeolocationHandler,
|
public CefGeolocationHandler,
|
||||||
public DownloadListener {
|
public DownloadListener {
|
||||||
public:
|
public:
|
||||||
|
// Interface for request handler delegates. Do not perform work in the
|
||||||
|
// RequestDelegate constructor.
|
||||||
|
class RequestDelegate : public virtual CefBase {
|
||||||
|
public:
|
||||||
|
// Called to handle a resource load.
|
||||||
|
virtual bool OnBeforeResourceLoad(
|
||||||
|
CefRefPtr<ClientHandler> handler,
|
||||||
|
CefRefPtr<CefBrowser> browser,
|
||||||
|
CefRefPtr<CefRequest> request,
|
||||||
|
CefString& redirectUrl,
|
||||||
|
CefRefPtr<CefStreamReader>& resourceStream,
|
||||||
|
CefRefPtr<CefResponse> response,
|
||||||
|
int loadFlags) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::set<CefRefPtr<RequestDelegate> > RequestDelegateSet;
|
||||||
|
|
||||||
ClientHandler();
|
ClientHandler();
|
||||||
virtual ~ClientHandler();
|
virtual ~ClientHandler();
|
||||||
|
|
||||||
@@ -215,6 +235,9 @@ class ClientHandler : public CefClient,
|
|||||||
void SetLoading(bool isLoading);
|
void SetLoading(bool isLoading);
|
||||||
void SetNavState(bool canGoBack, bool canGoForward);
|
void SetNavState(bool canGoBack, bool canGoForward);
|
||||||
|
|
||||||
|
// Create all of RequestDelegateSet objects.
|
||||||
|
static void CreateRequestDelegates(RequestDelegateSet& delegates);
|
||||||
|
|
||||||
// The child browser window
|
// The child browser window
|
||||||
CefRefPtr<CefBrowser> m_Browser;
|
CefRefPtr<CefBrowser> m_Browser;
|
||||||
|
|
||||||
@@ -249,6 +272,9 @@ class ClientHandler : public CefClient,
|
|||||||
// The URL to be loaded at application startup.
|
// The URL to be loaded at application startup.
|
||||||
std::string m_StartupURL;
|
std::string m_StartupURL;
|
||||||
|
|
||||||
|
// Registered delegates.
|
||||||
|
RequestDelegateSet request_delegates_;
|
||||||
|
|
||||||
// Include the default reference counting implementation.
|
// Include the default reference counting implementation.
|
||||||
IMPLEMENT_REFCOUNTING(ClientHandler);
|
IMPLEMENT_REFCOUNTING(ClientHandler);
|
||||||
// Include the default locking implementation.
|
// Include the default locking implementation.
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -7,9 +7,6 @@
|
|||||||
#include "cefclient/client_handler.h"
|
#include "cefclient/client_handler.h"
|
||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
#include "cefclient/performance_test.h"
|
|
||||||
#include "cefclient/resource_util.h"
|
|
||||||
#include "cefclient/string_util.h"
|
|
||||||
|
|
||||||
// ClientHandler::ClientLifeSpanHandler implementation
|
// ClientHandler::ClientLifeSpanHandler implementation
|
||||||
bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
|
bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
|
||||||
@@ -23,59 +20,6 @@ bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientHandler::OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
|
|
||||||
CefRefPtr<CefRequest> request,
|
|
||||||
CefString& redirectUrl,
|
|
||||||
CefRefPtr<CefStreamReader>& resourceStream,
|
|
||||||
CefRefPtr<CefResponse> response,
|
|
||||||
int loadFlags) {
|
|
||||||
REQUIRE_IO_THREAD();
|
|
||||||
|
|
||||||
std::string url = request->GetURL();
|
|
||||||
|
|
||||||
if (url == "http://tests/request") {
|
|
||||||
// Show the request contents
|
|
||||||
std::string dump;
|
|
||||||
DumpRequestContents(request, dump);
|
|
||||||
resourceStream = CefStreamReader::CreateForData(
|
|
||||||
static_cast<void*>(const_cast<char*>(dump.c_str())),
|
|
||||||
dump.size());
|
|
||||||
response->SetMimeType("text/plain");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (strstr(url.c_str(), "/ps_logo2.png") != NULL) {
|
|
||||||
// Any time we find "ps_logo2.png" in the URL substitute in our own image
|
|
||||||
resourceStream = GetBinaryResourceReader("logo.png");
|
|
||||||
response->SetMimeType("image/png");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/localstorage") {
|
|
||||||
// Show the localstorage contents
|
|
||||||
resourceStream = GetBinaryResourceReader("localstorage.html");
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/xmlhttprequest") {
|
|
||||||
// Show the xmlhttprequest HTML contents
|
|
||||||
resourceStream = GetBinaryResourceReader("xmlhttprequest.html");
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/domaccess") {
|
|
||||||
// Show the domaccess HTML contents
|
|
||||||
resourceStream = GetBinaryResourceReader("domaccess.html");
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == performance_test::kTestUrl) {
|
|
||||||
resourceStream = GetBinaryResourceReader("performance.html");
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/dialogs") {
|
|
||||||
// Show the dialogs HTML contents
|
|
||||||
resourceStream = GetBinaryResourceReader("dialogs.html");
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
const CefString& url) {
|
const CefString& url) {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -8,9 +8,6 @@
|
|||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
#include "cefclient/cefclient.h"
|
#include "cefclient/cefclient.h"
|
||||||
#include "cefclient/performance_test.h"
|
|
||||||
#include "cefclient/resource_util.h"
|
|
||||||
#include "cefclient/string_util.h"
|
|
||||||
|
|
||||||
#ifdef TEST_REDIRECT_POPUP_URLS
|
#ifdef TEST_REDIRECT_POPUP_URLS
|
||||||
#include "cefclient/client_popup_handler.h"
|
#include "cefclient/client_popup_handler.h"
|
||||||
@@ -38,58 +35,6 @@ bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientHandler::OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
|
|
||||||
CefRefPtr<CefRequest> request,
|
|
||||||
CefString& redirectUrl,
|
|
||||||
CefRefPtr<CefStreamReader>& resourceStream,
|
|
||||||
CefRefPtr<CefResponse> response,
|
|
||||||
int loadFlags) {
|
|
||||||
REQUIRE_IO_THREAD();
|
|
||||||
|
|
||||||
std::string url = request->GetURL();
|
|
||||||
if (url == "http://tests/request") {
|
|
||||||
// Show the request contents
|
|
||||||
std::string dump;
|
|
||||||
DumpRequestContents(request, dump);
|
|
||||||
resourceStream = CefStreamReader::CreateForData(
|
|
||||||
static_cast<void*>(const_cast<char*>(dump.c_str())),
|
|
||||||
dump.size());
|
|
||||||
response->SetMimeType("text/plain");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (strstr(url.c_str(), "/ps_logo2.png") != NULL) {
|
|
||||||
// Any time we find "ps_logo2.png" in the URL substitute in our own image
|
|
||||||
resourceStream = GetBinaryResourceReader("logo.png");
|
|
||||||
response->SetMimeType("image/png");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/localstorage") {
|
|
||||||
// Show the localstorage contents
|
|
||||||
resourceStream = GetBinaryResourceReader("localstorage.html");
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/xmlhttprequest") {
|
|
||||||
// Show the xmlhttprequest HTML contents
|
|
||||||
resourceStream = GetBinaryResourceReader("xmlhttprequest.html");
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/domaccess") {
|
|
||||||
// Show the domaccess HTML contents
|
|
||||||
resourceStream = GetBinaryResourceReader("domaccess.html");
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == performance_test::kTestUrl) {
|
|
||||||
resourceStream = GetBinaryResourceReader("performance.html");
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/dialogs") {
|
|
||||||
// Show the dialogs HTML contents
|
|
||||||
resourceStream = GetBinaryResourceReader("dialogs.html");
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
const CefString& url) {
|
const CefString& url) {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -35,101 +35,6 @@ bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> parentBrowser,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientHandler::OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
|
|
||||||
CefRefPtr<CefRequest> request,
|
|
||||||
CefString& redirectUrl,
|
|
||||||
CefRefPtr<CefStreamReader>& resourceStream,
|
|
||||||
CefRefPtr<CefResponse> response,
|
|
||||||
int loadFlags) {
|
|
||||||
REQUIRE_IO_THREAD();
|
|
||||||
|
|
||||||
std::string url = request->GetURL();
|
|
||||||
if (url == "http://tests/request") {
|
|
||||||
// Show the request contents
|
|
||||||
std::string dump;
|
|
||||||
DumpRequestContents(request, dump);
|
|
||||||
resourceStream = CefStreamReader::CreateForData(
|
|
||||||
static_cast<void*>(const_cast<char*>(dump.c_str())),
|
|
||||||
dump.size());
|
|
||||||
response->SetMimeType("text/plain");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (strstr(url.c_str(), "/ps_logo2.png") != NULL) {
|
|
||||||
// Any time we find "ps_logo2.png" in the URL substitute in our own image
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_LOGO);
|
|
||||||
response->SetMimeType("image/png");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/uiapp") {
|
|
||||||
// Show the uiapp contents
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_UIPLUGIN);
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/osrapp") {
|
|
||||||
// Show the osrapp contents
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_OSRPLUGIN);
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/localstorage") {
|
|
||||||
// Show the localstorage contents
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_LOCALSTORAGE);
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/xmlhttprequest") {
|
|
||||||
// Show the xmlhttprequest HTML contents
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_XMLHTTPREQUEST);
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/domaccess") {
|
|
||||||
// Show the domaccess HTML contents
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_DOMACCESS);
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (strstr(url.c_str(), "/logoball.png") != NULL) {
|
|
||||||
// Load the "logoball.png" image resource.
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_LOGOBALL);
|
|
||||||
response->SetMimeType("image/png");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/modalmain") {
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_MODALMAIN);
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/modaldialog") {
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_MODALDIALOG);
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/transparency") {
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_TRANSPARENCY);
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/plugin") {
|
|
||||||
std::string html =
|
|
||||||
"<html><body>\n"
|
|
||||||
"Client Plugin loaded by Mime Type:<br>\n"
|
|
||||||
"<embed type=\"application/x-client-plugin\" width=600 height=40>\n"
|
|
||||||
"<br><br>Client Plugin loaded by File Extension:<br>\n"
|
|
||||||
"<embed src=\"test.xcp\" width=600 height=40>\n"
|
|
||||||
// Add some extra space below the plugin to allow scrolling.
|
|
||||||
"<div style=\"height:1000px;\"> </div>\n"
|
|
||||||
"</body></html>";
|
|
||||||
|
|
||||||
resourceStream = CefStreamReader::CreateForData(
|
|
||||||
static_cast<void*>(const_cast<char*>(html.c_str())),
|
|
||||||
html.size());
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == performance_test::kTestUrl) {
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_PERFORMANCE);
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
} else if (url == "http://tests/dialogs") {
|
|
||||||
// Show the dialogs HTML contents
|
|
||||||
resourceStream = GetBinaryResourceReader(IDS_DIALOGS);
|
|
||||||
response->SetMimeType("text/html");
|
|
||||||
response->SetStatus(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
const CefString& url) {
|
const CefString& url) {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -10,6 +10,10 @@
|
|||||||
#include "include/cef_v8.h"
|
#include "include/cef_v8.h"
|
||||||
#include "cefclient/resource_util.h"
|
#include "cefclient/resource_util.h"
|
||||||
|
|
||||||
|
namespace extension_test {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
// Implementation of the V8 handler class for the "cef.test" extension.
|
// Implementation of the V8 handler class for the "cef.test" extension.
|
||||||
class ClientV8ExtensionHandler : public CefV8Handler {
|
class ClientV8ExtensionHandler : public CefV8Handler {
|
||||||
public:
|
public:
|
||||||
@@ -64,8 +68,9 @@ class ClientV8ExtensionHandler : public CefV8Handler {
|
|||||||
IMPLEMENT_REFCOUNTING(ClientV8ExtensionHandler);
|
IMPLEMENT_REFCOUNTING(ClientV8ExtensionHandler);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
void InitExtensionTest() {
|
void InitTest() {
|
||||||
// Register a V8 extension with the below JavaScript code that calls native
|
// Register a V8 extension with the below JavaScript code that calls native
|
||||||
// methods implemented in ClientV8ExtensionHandler.
|
// methods implemented in ClientV8ExtensionHandler.
|
||||||
std::string code = "var cef;"
|
std::string code = "var cef;"
|
||||||
@@ -90,7 +95,7 @@ void InitExtensionTest() {
|
|||||||
CefRegisterExtension("v8/test", code, new ClientV8ExtensionHandler());
|
CefRegisterExtension("v8/test", code, new ClientV8ExtensionHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunExtensionTest(CefRefPtr<CefBrowser> browser) {
|
void RunTest(CefRefPtr<CefBrowser> browser) {
|
||||||
std::string html =
|
std::string html =
|
||||||
"<html><body>ClientV8ExtensionHandler says:<br><pre>"
|
"<html><body>ClientV8ExtensionHandler says:<br><pre>"
|
||||||
"<script language=\"JavaScript\">"
|
"<script language=\"JavaScript\">"
|
||||||
@@ -107,3 +112,5 @@ void RunExtensionTest(CefRefPtr<CefBrowser> browser) {
|
|||||||
"</pre></body></html>";
|
"</pre></body></html>";
|
||||||
browser->GetMainFrame()->LoadString(html, "about:blank");
|
browser->GetMainFrame()->LoadString(html, "about:blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace extension_test
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -6,14 +6,16 @@
|
|||||||
#define CEF_TESTS_CEFCLIENT_EXTENSION_TEST_H_
|
#define CEF_TESTS_CEFCLIENT_EXTENSION_TEST_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_browser.h"
|
||||||
|
|
||||||
class CefBrowser;
|
namespace extension_test {
|
||||||
|
|
||||||
// Register the V8 extension handler.
|
// Register the V8 extension handler.
|
||||||
void InitExtensionTest();
|
void InitTest();
|
||||||
|
|
||||||
// Run the test.
|
// Run the test.
|
||||||
void RunExtensionTest(CefRefPtr<CefBrowser> browser);
|
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||||
|
|
||||||
|
} // namespace extension_test
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_EXTENSION_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_EXTENSION_TEST_H_
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -11,7 +11,11 @@
|
|||||||
#include "cefclient/client_handler.h"
|
#include "cefclient/client_handler.h"
|
||||||
#include "cefclient/plugin_test.h"
|
#include "cefclient/plugin_test.h"
|
||||||
|
|
||||||
void InitOSRPluginTest() {
|
namespace osrplugin_test {
|
||||||
|
|
||||||
|
const char kTestUrl[] = "http://tests/osrplugin";
|
||||||
|
|
||||||
|
void InitTest() {
|
||||||
// Structure providing information about the client plugin.
|
// Structure providing information about the client plugin.
|
||||||
CefPluginInfo plugin_info;
|
CefPluginInfo plugin_info;
|
||||||
CefString(&plugin_info.display_name).FromASCII("Client OSR Plugin");
|
CefString(&plugin_info.display_name).FromASCII("Client OSR Plugin");
|
||||||
@@ -28,7 +32,7 @@ void InitOSRPluginTest() {
|
|||||||
CefRegisterPlugin(plugin_info);
|
CefRegisterPlugin(plugin_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunOSRPluginTest(CefRefPtr<CefBrowser> browser, bool transparent) {
|
void RunTest(CefRefPtr<CefBrowser> browser, bool transparent) {
|
||||||
class Listener : public CefDOMEventListener {
|
class Listener : public CefDOMEventListener {
|
||||||
public:
|
public:
|
||||||
Listener() {}
|
Listener() {}
|
||||||
@@ -124,8 +128,10 @@ void RunOSRPluginTest(CefRefPtr<CefBrowser> browser, bool transparent) {
|
|||||||
// The DOM visitor will be called after the path is loaded.
|
// The DOM visitor will be called after the path is loaded.
|
||||||
CefRefPtr<CefClient> client = browser->GetClient();
|
CefRefPtr<CefClient> client = browser->GetClient();
|
||||||
static_cast<ClientHandler*>(client.get())->AddDOMVisitor(
|
static_cast<ClientHandler*>(client.get())->AddDOMVisitor(
|
||||||
"http://tests/osrapp", new Visitor());
|
kTestUrl, new Visitor());
|
||||||
|
|
||||||
SetOffScreenTransparent(transparent);
|
SetOffScreenTransparent(transparent);
|
||||||
browser->GetMainFrame()->LoadURL("http://tests/osrapp");
|
browser->GetMainFrame()->LoadURL(kTestUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace osrplugin_test
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -6,14 +6,16 @@
|
|||||||
#define CEF_TESTS_CEFCLIENT_OSRPLUGIN_TEST_H_
|
#define CEF_TESTS_CEFCLIENT_OSRPLUGIN_TEST_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_browser.h"
|
||||||
|
|
||||||
class CefBrowser;
|
namespace osrplugin_test {
|
||||||
|
|
||||||
// Register the internal client plugin and V8 extension.
|
// Register the internal client plugin and V8 extension.
|
||||||
void InitOSRPluginTest();
|
void InitTest();
|
||||||
|
|
||||||
// Run the test.
|
// Run the test.
|
||||||
void RunOSRPluginTest(CefRefPtr<CefBrowser> browser, bool transparent);
|
void RunTest(CefRefPtr<CefBrowser> browser, bool transparent);
|
||||||
|
|
||||||
|
} // namespace osrplugin_test
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_OSRPLUGIN_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_OSRPLUGIN_TEST_H_
|
||||||
|
@@ -7,8 +7,57 @@
|
|||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
#include "include/cef_nplugin.h"
|
#include "include/cef_nplugin.h"
|
||||||
#include "cefclient/clientplugin.h"
|
#include "cefclient/clientplugin.h"
|
||||||
|
#include "cefclient/client_handler.h"
|
||||||
|
|
||||||
void InitPluginTest() {
|
namespace plugin_test {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
const char* kTestUrl = "http://tests/plugins";
|
||||||
|
|
||||||
|
// Handle resource loading in the browser process.
|
||||||
|
class RequestDelegate: public ClientHandler::RequestDelegate {
|
||||||
|
public:
|
||||||
|
RequestDelegate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// From ClientHandler::RequestDelegate.
|
||||||
|
virtual bool OnBeforeResourceLoad(
|
||||||
|
CefRefPtr<ClientHandler> handler,
|
||||||
|
CefRefPtr<CefBrowser> browser,
|
||||||
|
CefRefPtr<CefRequest> request,
|
||||||
|
CefString& redirectUrl,
|
||||||
|
CefRefPtr<CefStreamReader>& resourceStream,
|
||||||
|
CefRefPtr<CefResponse> response,
|
||||||
|
int loadFlags) OVERRIDE {
|
||||||
|
std::string url = request->GetURL();
|
||||||
|
if (url == kTestUrl) {
|
||||||
|
std::string html =
|
||||||
|
"<html><body>\n"
|
||||||
|
"Client Plugin loaded by Mime Type:<br>\n"
|
||||||
|
"<embed type=\"application/x-client-plugin\" width=600 height=40>\n"
|
||||||
|
"<br><br>Client Plugin loaded by File Extension:<br>\n"
|
||||||
|
"<embed src=\"test.xcp\" width=600 height=40>\n"
|
||||||
|
// Add some extra space below the plugin to allow scrolling.
|
||||||
|
"<div style=\"height:1000px;\"> </div>\n"
|
||||||
|
"</body></html>";
|
||||||
|
|
||||||
|
resourceStream = CefStreamReader::CreateForData(
|
||||||
|
static_cast<void*>(const_cast<char*>(html.c_str())),
|
||||||
|
html.size());
|
||||||
|
response->SetMimeType("text/html");
|
||||||
|
response->SetStatus(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(RequestDelegate);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
void InitTest() {
|
||||||
// Structure providing information about the client plugin.
|
// Structure providing information about the client plugin.
|
||||||
CefPluginInfo plugin_info;
|
CefPluginInfo plugin_info;
|
||||||
CefString(&plugin_info.display_name).FromASCII("Client Plugin");
|
CefString(&plugin_info.display_name).FromASCII("Client Plugin");
|
||||||
@@ -25,7 +74,13 @@ void InitPluginTest() {
|
|||||||
CefRegisterPlugin(plugin_info);
|
CefRegisterPlugin(plugin_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunPluginTest(CefRefPtr<CefBrowser> browser) {
|
void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates) {
|
||||||
// Page content is provided in ClientHandler::OnBeforeResourceLoad().
|
delegates.insert(new RequestDelegate);
|
||||||
browser->GetMainFrame()->LoadURL("http://tests/plugin");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunTest(CefRefPtr<CefBrowser> browser) {
|
||||||
|
// Page content is provided in ClientHandler::OnBeforeResourceLoad().
|
||||||
|
browser->GetMainFrame()->LoadURL(kTestUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace plugin_test
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -6,14 +6,20 @@
|
|||||||
#define CEF_TESTS_CEFCLIENT_PLUGIN_TEST_H_
|
#define CEF_TESTS_CEFCLIENT_PLUGIN_TEST_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_browser.h"
|
||||||
|
#include "cefclient/client_handler.h"
|
||||||
|
|
||||||
class CefBrowser;
|
namespace plugin_test {
|
||||||
|
|
||||||
// Register the internal client plugin.
|
// Register the internal client plugin.
|
||||||
void InitPluginTest();
|
void InitTest();
|
||||||
|
|
||||||
|
// Delegate creation. Called from ClientHandler.
|
||||||
|
void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates);
|
||||||
|
|
||||||
// Run the test.
|
// Run the test.
|
||||||
void RunPluginTest(CefRefPtr<CefBrowser> browser);
|
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||||
|
|
||||||
|
} // namespace plugin_test
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_PLUGIN_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_PLUGIN_TEST_H_
|
||||||
|
25
cef1/tests/cefclient/res/other_tests.html
Normal file
25
cef1/tests/cefclient/res/other_tests.html
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Other Tests</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h3>Various other internal and external tests.</h3>
|
||||||
|
<ul>
|
||||||
|
<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/modalmain">Dialogs (Modal)</a> - Windows only</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/localstorage">Local Storage</a></li>
|
||||||
|
<li><a href="http://mrdoob.com/lab/javascript/requestanimationframe/">requestAnimationFrame</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>
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -26,39 +26,31 @@
|
|||||||
#define ID_WARN_DOWNLOADERROR 32002
|
#define ID_WARN_DOWNLOADERROR 32002
|
||||||
#define ID_FIND 32101
|
#define ID_FIND 32101
|
||||||
#define ID_PRINT 32102
|
#define ID_PRINT 32102
|
||||||
#define ID_TESTS_GETSOURCE 32769
|
#define ID_TESTS_DEVTOOLS_SHOW 32700
|
||||||
#define ID_TESTS_GETTEXT 32770
|
#define ID_TESTS_DEVTOOLS_CLOSE 32701
|
||||||
#define ID_TESTS_JAVASCRIPT_BINDING 32771
|
#define ID_TESTS_DOMACCESS 32702
|
||||||
#define ID_TESTS_JAVASCRIPT_EXTENSION 32772
|
#define ID_TESTS_GETIMAGE 32703
|
||||||
#define ID_TESTS_JAVASCRIPT_EXECUTE 32773
|
#define ID_TESTS_GETSOURCE 32704
|
||||||
#define ID_TESTS_PLUGIN 32774
|
#define ID_TESTS_GETTEXT 32705
|
||||||
#define ID_TESTS_POPUP 32775
|
#define ID_TESTS_JAVASCRIPT_BINDING 32706
|
||||||
#define ID_TESTS_REQUEST 32776
|
#define ID_TESTS_JAVASCRIPT_EXTENSION 32707
|
||||||
#define ID_TESTS_SCHEME_HANDLER 32777
|
#define ID_TESTS_JAVASCRIPT_EXECUTE 32708
|
||||||
#define ID_TESTS_UIAPP 32778
|
#define ID_TESTS_JAVASCRIPT_INVOKE 32709
|
||||||
#define ID_TESTS_LOCALSTORAGE 32779
|
#define ID_TESTS_OSRAPP 32710
|
||||||
#define ID_TESTS_ACCELERATED2DCANVAS 32780
|
#define ID_TESTS_OTHER_TESTS 32811
|
||||||
#define ID_TESTS_ACCELERATEDLAYERS 32781
|
#define ID_TESTS_PERFORMANCE 32712
|
||||||
#define ID_TESTS_WEBGL 32782
|
#define ID_TESTS_PLUGIN 32713
|
||||||
#define ID_TESTS_XMLHTTPREQUEST 32784
|
#define ID_TESTS_PLUGIN_INFO 32814
|
||||||
#define ID_TESTS_ZOOM_IN 32785
|
#define ID_TESTS_POPUP 32715
|
||||||
#define ID_TESTS_ZOOM_OUT 32786
|
#define ID_TESTS_REQUEST 32716
|
||||||
#define ID_TESTS_ZOOM_RESET 32787
|
#define ID_TESTS_SCHEME_HANDLER 32717
|
||||||
#define ID_TESTS_DEVTOOLS_SHOW 32788
|
#define ID_TESTS_UIAPP 32718
|
||||||
#define ID_TESTS_DEVTOOLS_CLOSE 32789
|
#define ID_TESTS_TRANSPARENT_POPUP 32719
|
||||||
#define ID_TESTS_WEBURLREQUEST 32790
|
#define ID_TESTS_TRANSPARENT_OSRAPP 32720
|
||||||
#define ID_TESTS_DOMACCESS 32791
|
#define ID_TESTS_WEBURLREQUEST 32721
|
||||||
#define ID_TESTS_DRAGDROP 32792
|
#define ID_TESTS_ZOOM_IN 32722
|
||||||
#define ID_TESTS_OSRAPP 32793
|
#define ID_TESTS_ZOOM_OUT 32723
|
||||||
#define ID_TESTS_MODALDIALOG 32794
|
#define ID_TESTS_ZOOM_RESET 32724
|
||||||
#define ID_TESTS_PERFORMANCE 32795
|
|
||||||
#define ID_TESTS_TRANSPARENT_POPUP 32796
|
|
||||||
#define ID_TESTS_TRANSPARENT_OSRAPP 32797
|
|
||||||
#define ID_TESTS_JAVASCRIPT_INVOKE 32798
|
|
||||||
#define ID_TESTS_GETIMAGE 32799
|
|
||||||
#define ID_TESTS_PLUGIN_INFO 32800
|
|
||||||
#define ID_TESTS_GEOLOCATION 32801
|
|
||||||
#define ID_TESTS_DIALOGS 32803
|
|
||||||
#define IDC_STATIC -1
|
#define IDC_STATIC -1
|
||||||
#define IDS_DIALOGS 1000
|
#define IDS_DIALOGS 1000
|
||||||
#define IDS_DOMACCESS 1001
|
#define IDS_DOMACCESS 1001
|
||||||
@@ -68,10 +60,11 @@
|
|||||||
#define IDS_MODALDIALOG 1005
|
#define IDS_MODALDIALOG 1005
|
||||||
#define IDS_MODALMAIN 1006
|
#define IDS_MODALMAIN 1006
|
||||||
#define IDS_OSRPLUGIN 1007
|
#define IDS_OSRPLUGIN 1007
|
||||||
#define IDS_PERFORMANCE 1008
|
#define IDS_OTHER_TESTS 1008
|
||||||
#define IDS_TRANSPARENCY 1009
|
#define IDS_PERFORMANCE 1009
|
||||||
#define IDS_UIPLUGIN 1010
|
#define IDS_TRANSPARENCY 1010
|
||||||
#define IDS_XMLHTTPREQUEST 1011
|
#define IDS_UIPLUGIN 1011
|
||||||
|
#define IDS_XMLHTTPREQUEST 1012
|
||||||
|
|
||||||
// Avoid files associated with MacOS
|
// Avoid files associated with MacOS
|
||||||
#define _X86_
|
#define _X86_
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -6,26 +6,18 @@
|
|||||||
#define CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_
|
#define CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/cef_base.h"
|
#include <string>
|
||||||
|
#include "include/cef_stream.h"
|
||||||
class CefStreamReader;
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
|
|
||||||
#include "cefclient/resource.h"
|
|
||||||
|
|
||||||
// Load a resource of type BINARY
|
|
||||||
bool LoadBinaryResource(int binaryId, DWORD &dwSize, LPBYTE &pBytes);
|
|
||||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(int binaryId);
|
|
||||||
|
|
||||||
#elif defined(OS_MACOSX) || defined(OS_POSIX)
|
|
||||||
|
|
||||||
#include <string> // NOLINT(build/include_order)
|
|
||||||
|
|
||||||
// Load the resource with the specified name.
|
|
||||||
bool LoadBinaryResource(const char* resource_name, std::string& resource_data);
|
|
||||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name);
|
|
||||||
|
|
||||||
|
#if defined(OS_POSIX)
|
||||||
|
// Returns the directory containing resource files.
|
||||||
|
bool GetResourceDir(std::string& dir);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Retrieve a resource as a string.
|
||||||
|
bool LoadBinaryResource(const char* resource_name, std::string& resource_data);
|
||||||
|
|
||||||
|
// Retrieve a resource as a steam reader.
|
||||||
|
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name);
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_
|
#endif // CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_
|
||||||
|
@@ -1,13 +1,11 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors.
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors.
|
||||||
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "cefclient/resource_util.h"
|
#include "cefclient/resource_util.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string.h>
|
||||||
#include "include/cef_stream.h"
|
|
||||||
#include "cefclient/util.h"
|
|
||||||
|
|
||||||
bool GetResourceDir(std::string& dir) {
|
bool GetResourceDir(std::string& dir) {
|
||||||
char buff[1024];
|
char buff[1024];
|
||||||
@@ -29,39 +27,3 @@ bool GetResourceDir(std::string& dir) {
|
|||||||
dir = std::string(buff);
|
dir = std::string(buff);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LoadBinaryResource(const char* resource_name, std::string& resource_data) {
|
|
||||||
std::string path;
|
|
||||||
if (!GetResourceDir(path))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
path.append("/");
|
|
||||||
path.append(resource_name);
|
|
||||||
|
|
||||||
FILE* f = fopen(path.c_str(), "rb");
|
|
||||||
if (!f)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
size_t bytes_read;
|
|
||||||
char buff[1024*8];
|
|
||||||
|
|
||||||
do {
|
|
||||||
bytes_read = fread(buff, 1, sizeof(buff)-1, f);
|
|
||||||
if (bytes_read > 0)
|
|
||||||
resource_data.append(buff, bytes_read);
|
|
||||||
} while (bytes_read > 0);
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name) {
|
|
||||||
std::string path;
|
|
||||||
if (!GetResourceDir(path))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
path.append("/");
|
|
||||||
path.append(resource_name);
|
|
||||||
|
|
||||||
return CefStreamReader::CreateForFile(path);
|
|
||||||
}
|
|
||||||
|
@@ -1,13 +1,12 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors.
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors.
|
||||||
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "cefclient/resource_util.h"
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "cefclient/resource_util.h"
|
|
||||||
#include "include/cef_stream.h"
|
|
||||||
#include "cefclient/util.h"
|
#include "cefclient/util.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -34,6 +33,8 @@ bool AmIBundled() {
|
|||||||
return (info.nodeFlags & kFSNodeIsDirectoryMask);
|
return (info.nodeFlags & kFSNodeIsDirectoryMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
bool GetResourceDir(std::string& dir) {
|
bool GetResourceDir(std::string& dir) {
|
||||||
// Implementation adapted from Chromium's base/base_path_mac.mm
|
// Implementation adapted from Chromium's base/base_path_mac.mm
|
||||||
if (AmIBundled()) {
|
if (AmIBundled()) {
|
||||||
@@ -56,42 +57,3 @@ bool GetResourceDir(std::string& dir) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadFileToString(const char* path, std::string& data) {
|
|
||||||
// Implementation adapted from base/file_util.cc
|
|
||||||
FILE* file = fopen(path, "rb");
|
|
||||||
if (!file)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
char buf[1 << 16];
|
|
||||||
size_t len;
|
|
||||||
while ((len = fread(buf, 1, sizeof(buf), file)) > 0)
|
|
||||||
data.append(buf, len);
|
|
||||||
fclose(file);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
bool LoadBinaryResource(const char* resource_name, std::string& resource_data) {
|
|
||||||
std::string path;
|
|
||||||
if (!GetResourceDir(path))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
path.append("/");
|
|
||||||
path.append(resource_name);
|
|
||||||
|
|
||||||
return ReadFileToString(path.c_str(), resource_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name) {
|
|
||||||
std::string path;
|
|
||||||
if (!GetResourceDir(path))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
path.append("/");
|
|
||||||
path.append(resource_name);
|
|
||||||
|
|
||||||
return CefStreamReader::CreateForFile(path);
|
|
||||||
}
|
|
||||||
|
59
cef1/tests/cefclient/resource_util_posix.cpp
Normal file
59
cef1/tests/cefclient/resource_util_posix.cpp
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "cefclient/resource_util.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
bool FileExists(const char* path) {
|
||||||
|
FILE* f = fopen(path, "rb");
|
||||||
|
if (f) {
|
||||||
|
fclose(f);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ReadFileToString(const char* path, std::string& data) {
|
||||||
|
// Implementation adapted from base/file_util.cc
|
||||||
|
FILE* file = fopen(path, "rb");
|
||||||
|
if (!file)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char buf[1 << 16];
|
||||||
|
size_t len;
|
||||||
|
while ((len = fread(buf, 1, sizeof(buf), file)) > 0)
|
||||||
|
data.append(buf, len);
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
bool LoadBinaryResource(const char* resource_name, std::string& resource_data) {
|
||||||
|
std::string path;
|
||||||
|
if (!GetResourceDir(path))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
path.append("/");
|
||||||
|
path.append(resource_name);
|
||||||
|
|
||||||
|
return ReadFileToString(path.c_str(), resource_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name) {
|
||||||
|
std::string path;
|
||||||
|
if (!GetResourceDir(path))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
path.append("/");
|
||||||
|
path.append(resource_name);
|
||||||
|
|
||||||
|
if (!FileExists(path.c_str()))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return CefStreamReader::CreateForFile(path);
|
||||||
|
}
|
@@ -1,15 +1,17 @@
|
|||||||
// Copyright (c) 2008-2009 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "cefclient/resource_util.h"
|
#include "cefclient/resource_util.h"
|
||||||
#include "include/cef_stream.h"
|
#include "include/cef_stream.h"
|
||||||
#include "include/wrapper/cef_byte_read_handler.h"
|
#include "include/wrapper/cef_byte_read_handler.h"
|
||||||
|
#include "cefclient/resource.h"
|
||||||
|
#include "cefclient/util.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
namespace {
|
||||||
|
|
||||||
bool LoadBinaryResource(int binaryId, DWORD &dwSize, LPBYTE &pBytes) {
|
bool LoadBinaryResource(int binaryId, DWORD &dwSize, LPBYTE &pBytes) {
|
||||||
extern HINSTANCE hInst;
|
HINSTANCE hInst = GetModuleHandle(NULL);
|
||||||
HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(binaryId),
|
HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(binaryId),
|
||||||
MAKEINTRESOURCE(256));
|
MAKEINTRESOURCE(256));
|
||||||
if (hRes) {
|
if (hRes) {
|
||||||
@@ -25,16 +27,67 @@ bool LoadBinaryResource(int binaryId, DWORD &dwSize, LPBYTE &pBytes) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(int binaryId) {
|
int GetResourceId(const char* resource_name) {
|
||||||
|
// Map of resource labels to BINARY id values.
|
||||||
|
static struct _resource_map {
|
||||||
|
char* name;
|
||||||
|
int id;
|
||||||
|
} resource_map[] = {
|
||||||
|
{"dialogs.html", IDS_DIALOGS},
|
||||||
|
{"domaccess.html", IDS_DOMACCESS},
|
||||||
|
{"localstorage.html", IDS_LOCALSTORAGE},
|
||||||
|
{"logo.png", IDS_LOGO},
|
||||||
|
{"logoball.png", IDS_LOGOBALL},
|
||||||
|
{"modaldialog.html", IDS_MODALDIALOG},
|
||||||
|
{"modalmain.html", IDS_MODALMAIN},
|
||||||
|
{"osrplugin.html", IDS_OSRPLUGIN},
|
||||||
|
{"other_tests.html", IDS_OTHER_TESTS},
|
||||||
|
{"performance.html", IDS_PERFORMANCE},
|
||||||
|
{"transparency.html", IDS_TRANSPARENCY},
|
||||||
|
{"uiplugin.html", IDS_UIPLUGIN},
|
||||||
|
{"xmlhttprequest.html", IDS_XMLHTTPREQUEST},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < sizeof(resource_map)/sizeof(_resource_map); ++i) {
|
||||||
|
if (!strcmp(resource_map[i].name, resource_name))
|
||||||
|
return resource_map[i].id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
bool LoadBinaryResource(const char* resource_name, std::string& resource_data) {
|
||||||
|
int resource_id = GetResourceId(resource_name);
|
||||||
|
if (resource_id == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
LPBYTE pBytes;
|
LPBYTE pBytes;
|
||||||
|
|
||||||
if (LoadBinaryResource(binaryId, dwSize, pBytes)) {
|
if (LoadBinaryResource(resource_id, dwSize, pBytes)) {
|
||||||
|
resource_data = std::string(reinterpret_cast<char*>(pBytes), dwSize);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT(FALSE); // The resource should be found.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name) {
|
||||||
|
int resource_id = GetResourceId(resource_name);
|
||||||
|
if (resource_id == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
DWORD dwSize;
|
||||||
|
LPBYTE pBytes;
|
||||||
|
|
||||||
|
if (LoadBinaryResource(resource_id, dwSize, pBytes)) {
|
||||||
return CefStreamReader::CreateForHandler(
|
return CefStreamReader::CreateForHandler(
|
||||||
new CefByteReadHandler(pBytes, dwSize, NULL));
|
new CefByteReadHandler(pBytes, dwSize, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASSERT(FALSE); // The resource should be found.
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // OS_WIN
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -14,10 +14,9 @@
|
|||||||
#include "cefclient/string_util.h"
|
#include "cefclient/string_util.h"
|
||||||
#include "cefclient/util.h"
|
#include "cefclient/util.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
namespace scheme_test {
|
||||||
#include "cefclient/resource.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
// Implementation of the schema handler for client:// requests.
|
// Implementation of the schema handler for client:// requests.
|
||||||
class ClientSchemeHandler : public CefSchemeHandler {
|
class ClientSchemeHandler : public CefSchemeHandler {
|
||||||
@@ -60,24 +59,11 @@ class ClientSchemeHandler : public CefSchemeHandler {
|
|||||||
mime_type_ = "text/html";
|
mime_type_ = "text/html";
|
||||||
} else if (strstr(url.c_str(), "client.png") != NULL) {
|
} else if (strstr(url.c_str(), "client.png") != NULL) {
|
||||||
// Load the response image
|
// Load the response image
|
||||||
#if defined(OS_WIN)
|
|
||||||
DWORD dwSize;
|
|
||||||
LPBYTE pBytes;
|
|
||||||
if (LoadBinaryResource(IDS_LOGO, dwSize, pBytes)) {
|
|
||||||
data_ = std::string(reinterpret_cast<const char*>(pBytes), dwSize);
|
|
||||||
handled = true;
|
|
||||||
// Set the resulting mime type
|
|
||||||
mime_type_ = "image/jpg";
|
|
||||||
}
|
|
||||||
#elif defined(OS_MACOSX) || defined(OS_LINUX)
|
|
||||||
if (LoadBinaryResource("logo.png", data_)) {
|
if (LoadBinaryResource("logo.png", data_)) {
|
||||||
handled = true;
|
handled = true;
|
||||||
// Set the resulting mime type
|
// Set the resulting mime type
|
||||||
mime_type_ = "image/png";
|
mime_type_ = "image/png";
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#error "Unsupported platform"
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handled) {
|
if (handled) {
|
||||||
@@ -157,15 +143,19 @@ class ClientSchemeHandlerFactory : public CefSchemeHandlerFactory {
|
|||||||
IMPLEMENT_REFCOUNTING(ClientSchemeHandlerFactory);
|
IMPLEMENT_REFCOUNTING(ClientSchemeHandlerFactory);
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSchemeTestSchemes(CefRefPtr<CefSchemeRegistrar> registrar) {
|
} // namespace
|
||||||
|
|
||||||
|
void AddSchemes(CefRefPtr<CefSchemeRegistrar> registrar) {
|
||||||
registrar->AddCustomScheme("client", true, false, false);
|
registrar->AddCustomScheme("client", true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitSchemeTest() {
|
void InitTest() {
|
||||||
CefRegisterSchemeHandlerFactory("client", "tests",
|
CefRegisterSchemeHandlerFactory("client", "tests",
|
||||||
new ClientSchemeHandlerFactory());
|
new ClientSchemeHandlerFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunSchemeTest(CefRefPtr<CefBrowser> browser) {
|
void RunTest(CefRefPtr<CefBrowser> browser) {
|
||||||
browser->GetMainFrame()->LoadURL("client://tests/handler.html");
|
browser->GetMainFrame()->LoadURL("client://tests/handler.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace scheme_test
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -9,12 +9,16 @@
|
|||||||
#include "include/cef_browser.h"
|
#include "include/cef_browser.h"
|
||||||
#include "include/cef_scheme.h"
|
#include "include/cef_scheme.h"
|
||||||
|
|
||||||
void AddSchemeTestSchemes(CefRefPtr<CefSchemeRegistrar> registrar);
|
namespace scheme_test {
|
||||||
|
|
||||||
|
void AddSchemes(CefRefPtr<CefSchemeRegistrar> registrar);
|
||||||
|
|
||||||
// Register the scheme handler.
|
// Register the scheme handler.
|
||||||
void InitSchemeTest();
|
void InitTest();
|
||||||
|
|
||||||
// Run the test.
|
// Run the test.
|
||||||
void RunSchemeTest(CefRefPtr<CefBrowser> browser);
|
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||||
|
|
||||||
|
} // namespace scheme_test
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2008-2009 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -10,6 +10,9 @@
|
|||||||
#include "cefclient/uiplugin.h"
|
#include "cefclient/uiplugin.h"
|
||||||
#include "cefclient/cefclient.h"
|
#include "cefclient/cefclient.h"
|
||||||
|
|
||||||
|
namespace uiplugin_test {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
// Implementation of the V8 handler class for the "window.uiapp" functions.
|
// Implementation of the V8 handler class for the "window.uiapp" functions.
|
||||||
class ClientV8UIHandler : public CefV8Handler {
|
class ClientV8UIHandler : public CefV8Handler {
|
||||||
@@ -58,7 +61,9 @@ class ClientV8UIHandler : public CefV8Handler {
|
|||||||
IMPLEMENT_REFCOUNTING(ClientV8UIHandler);
|
IMPLEMENT_REFCOUNTING(ClientV8UIHandler);
|
||||||
};
|
};
|
||||||
|
|
||||||
void InitUIPluginTest() {
|
} // namespace
|
||||||
|
|
||||||
|
void InitTest() {
|
||||||
// Structure providing information about the client plugin.
|
// Structure providing information about the client plugin.
|
||||||
CefPluginInfo plugin_info;
|
CefPluginInfo plugin_info;
|
||||||
CefString(&plugin_info.display_name).FromASCII("Client UI Plugin");
|
CefString(&plugin_info.display_name).FromASCII("Client UI Plugin");
|
||||||
@@ -98,6 +103,8 @@ void InitUIPluginTest() {
|
|||||||
CefRegisterExtension("uiplugin/test", code, new ClientV8UIHandler());
|
CefRegisterExtension("uiplugin/test", code, new ClientV8UIHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunUIPluginTest(CefRefPtr<CefBrowser> browser) {
|
void RunTest(CefRefPtr<CefBrowser> browser) {
|
||||||
browser->GetMainFrame()->LoadURL("http://tests/uiapp");
|
browser->GetMainFrame()->LoadURL("http://tests/uiplugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace uiplugin_test
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
@@ -6,14 +6,16 @@
|
|||||||
#define CEF_TESTS_CEFCLIENT_UIPLUGIN_TEST_H_
|
#define CEF_TESTS_CEFCLIENT_UIPLUGIN_TEST_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_browser.h"
|
||||||
|
|
||||||
class CefBrowser;
|
namespace uiplugin_test {
|
||||||
|
|
||||||
// Register the internal client plugin and V8 extension.
|
// Register the internal client plugin and V8 extension.
|
||||||
void InitUIPluginTest();
|
void InitTest();
|
||||||
|
|
||||||
// Run the test.
|
// Run the test.
|
||||||
void RunUIPluginTest(CefRefPtr<CefBrowser> browser);
|
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||||
|
|
||||||
|
} // namespace uiplugin_test
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_UIPLUGIN_TEST_H_
|
#endif // CEF_TESTS_CEFCLIENT_UIPLUGIN_TEST_H_
|
||||||
|
Reference in New Issue
Block a user