cefclient: Simplify tests and related resource loading.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1175 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-04-04 00:53:32 +00:00
parent da41e8e585
commit bba0221e23
25 changed files with 114 additions and 354 deletions

View File

@ -79,8 +79,10 @@
'<@(autogen_client_side)',
],
'cefclient_bundle_resources_common': [
'tests/cefclient/res/binding.html',
'tests/cefclient/res/dialogs.html',
'tests/cefclient/res/domaccess.html',
'tests/cefclient/res/extension.html',
'tests/cefclient/res/localstorage.html',
'tests/cefclient/res/logo.png',
'tests/cefclient/res/other_tests.html',
@ -135,6 +137,7 @@
'tests/cefclient/res/modaldialog.html',
'tests/cefclient/res/modalmain.html',
'tests/cefclient/res/osrplugin.html',
'tests/cefclient/res/plugin.html',
'tests/cefclient/res/small.ico',
'tests/cefclient/res/uiplugin.html',
'tests/cefclient/resource_util_win.cpp',

View File

@ -10,6 +10,9 @@
#include "include/cef_frame.h"
#include "include/cef_v8.h"
namespace binding_test {
namespace {
// Implementation of the V8 handler class for the "window.cef_test.Dump"
// function.
@ -129,10 +132,11 @@ class ClientV8FunctionHandler : public CefV8Handler {
IMPLEMENT_REFCOUNTING(ClientV8FunctionHandler);
};
} // namespace
void InitBindingTest(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Value> object) {
void InitTest(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Value> object) {
// Create the new V8 object.
CefRefPtr<CefV8Value> testObjPtr = CefV8Value::CreateObject(NULL);
// Add the new V8 object to the global window object with the name
@ -152,28 +156,4 @@ void InitBindingTest(CefRefPtr<CefBrowser> browser,
V8_PROPERTY_ATTRIBUTE_NONE);
}
void RunBindingTest(CefRefPtr<CefBrowser> browser) {
std::string html =
"<html><body>ClientV8FunctionHandler says:<br><pre>"
"<script language=\"JavaScript\">"
"document.writeln(window.cef_test.Dump(false, 1, 7.6654,'bar',"
" [false,true],[5, 7.654, 1, 'foo', [true, 'bar'], 8]));"
"document.writeln(window.cef_test.Dump(cef));"
"document.writeln("
" window.cef_test.Call(cef.test.test_object, 'GetMessage'));"
"function my_object() {"
" var obj = {};"
" (function() {"
" obj.GetMessage = function(a) {"
" return 'Calling a function with value '+a+' on a user object "
"succeeded.';"
" };"
" })();"
" return obj;"
"};"
"document.writeln("
" window.cef_test.Call(my_object, 'GetMessage', 'foobar'));"
"</script>"
"</pre></body></html>";
browser->GetMainFrame()->LoadString(html, "about:blank");
}
} // namespace binding_test

View File

@ -6,18 +6,17 @@
#define CEF_TESTS_CEFCLIENT_BINDING_TEST_H_
#pragma once
#include "include/cef_base.h"
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "include/cef_v8.h"
class CefBrowser;
class CefFrame;
class CefV8Value;
namespace binding_test {
// Add the V8 bindings.
void InitBindingTest(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Value> object);
void InitTest(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Value> object);
// Run the test.
void RunBindingTest(CefRefPtr<CefBrowser> browser);
} // namespace binding_test
#endif // CEF_TESTS_CEFCLIENT_BINDING_TEST_H_

View File

@ -28,8 +28,10 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Binary
//
IDS_BINDING BINARY "res\\binding.html"
IDS_DIALOGS BINARY "res\\dialogs.html"
IDS_DOMACCESS BINARY "res\\domaccess.html"
IDS_EXTENSION BINARY "res\\extension.html"
IDS_LOCALSTORAGE BINARY "res\\localstorage.html"
IDS_LOGO BINARY "res\\logo.png"
IDS_LOGOBALL BINARY "res\\logoball.png"
@ -38,6 +40,7 @@ IDS_MODALMAIN BINARY "res\\modalmain.html"
IDS_OSRPLUGIN BINARY "res\\osrplugin.html"
IDS_OTHER_TESTS BINARY "res\\other_tests.html"
IDS_PERFORMANCE BINARY "res\\performance.html"
IDS_PLUGIN BINARY "res\\plugin.html"
IDS_TRANSPARENCY BINARY "res\\transparency.html"
IDS_UIPLUGIN BINARY "res\\uiplugin.html"
IDS_XMLHTTPREQUEST BINARY "res\\xmlhttprequest.html"
@ -78,12 +81,8 @@ BEGIN
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 Extension Handler",ID_TESTS_JAVASCRIPT_EXTENSION
MENUITEM "JavaScript Execute", ID_TESTS_JAVASCRIPT_EXECUTE
MENUITEM "JavaScript Invoke", ID_TESTS_JAVASCRIPT_INVOKE
MENUITEM "Performance Tests", ID_TESTS_PERFORMANCE
MENUITEM "Plugin Info", ID_TESTS_PLUGIN_INFO
MENUITEM "WebURLRequest", ID_TESTS_WEBURLREQUEST
MENUITEM "DOM Access", ID_TESTS_DOMACCESS
@ -92,8 +91,6 @@ BEGIN
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 "Off-Screen Rendering Example",ID_TESTS_OSRAPP
MENUITEM "Transparent Off-Screen Rendering Example",ID_TESTS_TRANSPARENT_OSRAPP
MENUITEM "Get Image", ID_TESTS_GETIMAGE

View File

@ -11,10 +11,8 @@
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "include/cef_runnable.h"
#include "cefclient/binding_test.h"
#include "cefclient/client_handler.h"
#include "cefclient/extension_test.h"
#include "cefclient/performance_test.h"
#include "cefclient/scheme_test.h"
#include "cefclient/string_util.h"
@ -63,30 +61,6 @@ gboolean RequestActivated(GtkWidget* widget) {
return FALSE; // Don't stop this message.
}
// Callback for Tests > Scheme Handler... menu item.
gboolean SchemeHandlerActivated(GtkWidget* widget) {
if (g_handler.get() && g_handler->GetBrowserHwnd())
scheme_test::RunTest(g_handler->GetBrowser());
return FALSE; // Don't stop this message.
}
// Callback for Tests > JS Binding... menu item.
gboolean JSBindingActivated(GtkWidget* widget) {
if (g_handler.get() && g_handler->GetBrowserHwnd())
RunBindingTest(g_handler->GetBrowser());
return FALSE; // Don't stop this message.
}
// 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())
@ -103,14 +77,6 @@ gboolean JSInvokeActivated(GtkWidget* widget) {
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())
@ -254,18 +220,10 @@ GtkWidget* CreateMenuBar() {
G_CALLBACK(PopupWindowActivated));
AddMenuEntry(debug_menu, "Request",
G_CALLBACK(RequestActivated));
AddMenuEntry(debug_menu, "Scheme Handler",
G_CALLBACK(SchemeHandlerActivated));
AddMenuEntry(debug_menu, "JavaScript Binding Handler",
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",

View File

@ -11,11 +11,9 @@
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "include/cef_runnable.h"
#include "cefclient/binding_test.h"
#include "cefclient/client_handler.h"
#include "cefclient/extension_test.h"
#include "cefclient/osrtest_mac.h"
#include "cefclient/performance_test.h"
#include "cefclient/resource_util.h"
#include "cefclient/scheme_test.h"
#include "cefclient/string_util.h"
@ -197,12 +195,8 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
- (IBAction)testGetText:(id)sender;
- (IBAction)testPopupWindow:(id)sender;
- (IBAction)testRequest:(id)sender;
- (IBAction)testSchemeHandler:(id)sender;
- (IBAction)testJSBinding:(id)sender;
- (IBAction)testJSExtension:(id)sender;
- (IBAction)testJSExecute:(id)sender;
- (IBAction)testJSInvoke:(id)sender;
- (IBAction)testPerformance:(id)sender;
- (IBAction)testPluginInfo:(id)sender;
- (IBAction)testWebURLRequest:(id)sender;
- (IBAction)testDOMAccess:(id)sender;
@ -244,24 +238,12 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
[testMenu addItemWithTitle:@"Request"
action:@selector(testRequest:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"Scheme Handler"
action:@selector(testSchemeHandler:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"JavaScript Binding Handler"
action:@selector(testJSBinding:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"JavaScript Extension Handler"
action:@selector(testJSExtension:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"JavaScript Execute"
action:@selector(testJSExecute:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"JavaScript Invoke"
action:@selector(testJSInvoke:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"Performance Tests"
action:@selector(testPerformance:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"Plugin Info"
action:@selector(testPluginInfo:)
keyEquivalent:@""];
@ -406,21 +388,6 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
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 {
if (g_handler.get() && g_handler->GetBrowserHwnd())
RunBindingTest(g_handler->GetBrowser());
}
- (IBAction)testJSExtension:(id)sender {
if (g_handler.get() && g_handler->GetBrowserHwnd())
extension_test::RunTest(g_handler->GetBrowser());
}
- (IBAction)testJSExecute:(id)sender {
if (g_handler.get() && g_handler->GetBrowserHwnd())
RunJavaScriptExecuteTest(g_handler->GetBrowser());
@ -431,11 +398,6 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
RunJavaScriptInvokeTest(g_handler->GetBrowser());
}
- (IBAction)testPerformance:(id)sender {
if (g_handler.get() && g_handler->GetBrowserHwnd())
performance_test::RunTest(g_handler->GetBrowser());
}
- (IBAction)testPluginInfo:(id)sender {
if (g_handler.get() && g_handler->GetBrowserHwnd())
RunPluginInfoTest(g_handler->GetBrowser());

View File

@ -13,11 +13,9 @@
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "include/cef_runnable.h"
#include "cefclient/binding_test.h"
#include "cefclient/client_handler.h"
#include "cefclient/extension_test.h"
#include "cefclient/osrplugin_test.h"
#include "cefclient/performance_test.h"
#include "cefclient/plugin_test.h"
#include "cefclient/resource.h"
#include "cefclient/scheme_test.h"
@ -453,18 +451,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
if (browser.get())
RunRequestTest(browser);
return 0;
case ID_TESTS_SCHEME_HANDLER: // Test the scheme handler
if (browser.get())
scheme_test::RunTest(browser);
return 0;
case ID_TESTS_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())
extension_test::RunTest(browser);
return 0;
case ID_TESTS_JAVASCRIPT_EXECUTE: // Test execution of javascript
if (browser.get())
RunJavaScriptExecuteTest(browser);
@ -473,10 +459,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
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_PLUGIN_INFO: // Test plugin info
if (browser.get())
RunPluginInfoTest(browser);
@ -509,14 +491,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
if (browser.get())
browser->CloseDevTools();
return 0;
case ID_TESTS_PLUGIN: // Test the custom plugin
if (browser.get())
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);

View File

@ -78,8 +78,6 @@ ClientHandler::ClientHandler()
m_StopHwnd(NULL),
m_ReloadHwnd(NULL),
m_bFormElementHasFocus(false) {
CreateRequestDelegates(request_delegates_);
CefRefPtr<CefCommandLine> commandLine = AppGetCommandLine();
if (commandLine.get()) {
if (commandLine->HasSwitch(cefclient::kUrl))
@ -220,18 +218,7 @@ bool ClientHandler::OnBeforeResourceLoad(
}
}
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;
return false;
}
bool ClientHandler::GetDownloadHandler(CefRefPtr<CefBrowser> browser,
@ -368,7 +355,7 @@ void ClientHandler::OnContextCreated(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefV8Value> object = context->GetGlobal();
// Add the V8 bindings.
InitBindingTest(browser, frame, object);
binding_test::InitTest(browser, frame, object);
std::string url = frame->GetURL();
if (url == performance_test::kTestUrl)
@ -483,12 +470,3 @@ CefRefPtr<CefDOMVisitor> ClientHandler::GetDOMVisitor(const std::string& path) {
return it->second;
return NULL;
}
// static
void ClientHandler::CreateRequestDelegates(RequestDelegateSet& delegates) {
#if defined(OS_WIN)
// Create the plugin test delegates.
plugin_test::CreateRequestDelegates(delegates);
#endif
}

View File

@ -34,25 +34,6 @@ class ClientHandler : public CefClient,
public CefGeolocationHandler,
public DownloadListener {
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();
virtual ~ClientHandler();
@ -235,9 +216,6 @@ class ClientHandler : public CefClient,
void SetLoading(bool isLoading);
void SetNavState(bool canGoBack, bool canGoForward);
// Create all of RequestDelegateSet objects.
static void CreateRequestDelegates(RequestDelegateSet& delegates);
// The child browser window
CefRefPtr<CefBrowser> m_Browser;
@ -272,9 +250,6 @@ class ClientHandler : public CefClient,
// The URL to be loaded at application startup.
std::string m_StartupURL;
// Registered delegates.
RequestDelegateSet request_delegates_;
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(ClientHandler);
// Include the default locking implementation.

View File

@ -8,7 +8,6 @@
#include "include/cef_frame.h"
#include "include/cef_stream.h"
#include "include/cef_v8.h"
#include "cefclient/resource_util.h"
namespace extension_test {
@ -95,22 +94,4 @@ void InitTest() {
CefRegisterExtension("v8/test", code, new ClientV8ExtensionHandler());
}
void RunTest(CefRefPtr<CefBrowser> browser) {
std::string html =
"<html><body>ClientV8ExtensionHandler says:<br><pre>"
"<script language=\"JavaScript\">"
"cef.test.test_param ="
" 'Assign and retrieve a value succeeded the first time.';"
"document.writeln(cef.test.test_param);"
"cef.test.test_param ="
" 'Assign and retrieve a value succeeded the second time.';"
"document.writeln(cef.test.test_param);"
"var obj = cef.test.test_object();"
"document.writeln(obj.param);"
"document.writeln(obj.GetMessage());"
"</script>"
"</pre></body></html>";
browser->GetMainFrame()->LoadString(html, "about:blank");
}
} // namespace extension_test

View File

@ -6,16 +6,11 @@
#define CEF_TESTS_CEFCLIENT_EXTENSION_TEST_H_
#pragma once
#include "include/cef_browser.h"
namespace extension_test {
// Register the V8 extension handler.
void InitTest();
// Run the test.
void RunTest(CefRefPtr<CefBrowser> browser);
} // namespace extension_test
#endif // CEF_TESTS_CEFCLIENT_EXTENSION_TEST_H_

View File

@ -1,4 +1,4 @@
// Copyright (c) 2012 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
// can be found in the LICENSE file.
@ -9,7 +9,6 @@
#include <string>
#include "cefclient/performance_test_setup.h"
#include "cefclient/resource_util.h"
namespace performance_test {
@ -96,9 +95,4 @@ void InitTest(CefRefPtr<CefBrowser> browser,
V8_PROPERTY_ATTRIBUTE_READONLY);
}
void RunTest(CefRefPtr<CefBrowser> browser) {
// Load the test URL.
browser->GetMainFrame()->LoadURL(kTestUrl);
}
} // namespace performance_test

View File

@ -1,4 +1,4 @@
// Copyright (c) 2012 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
// can be found in the LICENSE file.
@ -6,11 +6,9 @@
#define CEF_TESTS_CEFCLIENT_PERFORMANCE_TEST_H_
#pragma once
#include "include/cef_base.h"
class CefBrowser;
class CefFrame;
class CefV8Value;
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "include/cef_v8.h"
namespace performance_test {
@ -20,9 +18,6 @@ void InitTest(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefV8Value> object);
// Run the test.
void RunTest(CefRefPtr<CefBrowser> browser);
} // namespace performance_test
#endif // CEF_TESTS_CEFCLIENT_PERFORMANCE_TEST_H_

View File

@ -2,61 +2,11 @@
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "include/cef_base.h"
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "include/cef_nplugin.h"
#include "cefclient/clientplugin.h"
#include "cefclient/client_handler.h"
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;\">&nbsp;</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.
CefPluginInfo plugin_info;
@ -74,13 +24,4 @@ void InitTest() {
CefRegisterPlugin(plugin_info);
}
void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates) {
delegates.insert(new RequestDelegate);
}
void RunTest(CefRefPtr<CefBrowser> browser) {
// Page content is provided in ClientHandler::OnBeforeResourceLoad().
browser->GetMainFrame()->LoadURL(kTestUrl);
}
} // namespace plugin_test

View File

@ -6,20 +6,11 @@
#define CEF_TESTS_CEFCLIENT_PLUGIN_TEST_H_
#pragma once
#include "include/cef_browser.h"
#include "cefclient/client_handler.h"
namespace plugin_test {
// Register the internal client plugin.
void InitTest();
// Delegate creation. Called from ClientHandler.
void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates);
// Run the test.
void RunTest(CefRefPtr<CefBrowser> browser);
} // namespace plugin_test
#endif // CEF_TESTS_CEFCLIENT_PLUGIN_TEST_H_

View File

@ -0,0 +1,22 @@
<html>
<body>
ClientV8FunctionHandler says:<br><pre>
<script>
document.writeln(window.cef_test.Dump(false, 1, 7.6654,'bar',
[false,true],[5, 7.654, 1, 'foo', [true, 'bar'], 8]));
document.writeln(window.cef_test.Dump(cef));
document.writeln(window.cef_test.Call(cef.test.test_object, 'GetMessage'));
function my_object() {
var obj = {};
(function() {
obj.GetMessage = function(a) {
return 'Calling a function with value '+a+' on a user object succeeded.';
};
})();
return obj;
};
document.writeln(window.cef_test.Call(my_object, 'GetMessage', 'foobar'));
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,15 @@
<html>
<body>
ClientV8ExtensionHandler says:<br><pre>
<script>
cef.test.test_param = 'Assign and retrieve a value succeeded the first time.';
document.writeln(cef.test.test_param);
cef.test.test_param = 'Assign and retrieve a value succeeded the second time.';
document.writeln(cef.test.test_param);
var obj = cef.test.test_object();
document.writeln(obj.param);
document.writeln(obj.GetMessage());
</script>
</pre>
</body>
</html>

View File

@ -15,8 +15,14 @@
<li><a href="http://html5demos.com/geo">Geolocation</a></li>
<li><a href="http://www.html5test.com">HTML5 Feature Test</a></li>
<li><a href="http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True">HTML5 Video</a></li>
<li><a href="http://tests/binding">JavaScript Binding</a></li>
<li><a href="http://tests/extension">JavaScript Extension</a></li>
<li><a href="http://tests/performance">JavaScript Performance Tests</a></li>
<li><a href="http://tests/localstorage">Local Storage</a></li>
<li><a href="http://tests/plugin">Plugin</a> - Windows only</li>
<li><a href="http://tests/uiplugin">Plugin (UI App Example)</a> - Windows only</li>
<li><a href="http://mrdoob.com/lab/javascript/requestanimationframe/">requestAnimationFrame</a></li>
<li><a href="client://tests/handler.html">Scheme Handler</a></li>
<li><a href="http://tests/transparency">Transparency</a></li>
<li><a href="http://webglsamples.googlecode.com/hg/field/field.html">WebGL</a></li>
<li><a href="http://tests/xmlhttprequest">XMLHttpRequest</a></li>

View File

@ -0,0 +1,10 @@
<html>
<body>
Client Plugin loaded by Mime Type:<br>
<embed type="application/x-client-plugin" width=600 height=40>
<br><br>Client Plugin loaded by File Extension:<br>
<embed src="test.xcp" width=600 height=40>
<!-- Add some extra space below the plugin to allow scrolling. -->
<div style="height:1000px;">&nbsp;</div>
</body>
</html>

View File

@ -32,39 +32,36 @@
#define ID_TESTS_GETIMAGE 32703
#define ID_TESTS_GETSOURCE 32704
#define ID_TESTS_GETTEXT 32705
#define ID_TESTS_JAVASCRIPT_BINDING 32706
#define ID_TESTS_JAVASCRIPT_EXTENSION 32707
#define ID_TESTS_JAVASCRIPT_EXECUTE 32708
#define ID_TESTS_JAVASCRIPT_INVOKE 32709
#define ID_TESTS_OSRAPP 32710
#define ID_TESTS_OTHER_TESTS 32811
#define ID_TESTS_PERFORMANCE 32712
#define ID_TESTS_PLUGIN 32713
#define ID_TESTS_PLUGIN_INFO 32814
#define ID_TESTS_POPUP 32715
#define ID_TESTS_REQUEST 32716
#define ID_TESTS_SCHEME_HANDLER 32717
#define ID_TESTS_UIAPP 32718
#define ID_TESTS_TRANSPARENT_POPUP 32719
#define ID_TESTS_TRANSPARENT_OSRAPP 32720
#define ID_TESTS_WEBURLREQUEST 32721
#define ID_TESTS_ZOOM_IN 32722
#define ID_TESTS_ZOOM_OUT 32723
#define ID_TESTS_ZOOM_RESET 32724
#define ID_TESTS_JAVASCRIPT_EXECUTE 32706
#define ID_TESTS_JAVASCRIPT_INVOKE 32707
#define ID_TESTS_OSRAPP 32708
#define ID_TESTS_OTHER_TESTS 32809
#define ID_TESTS_PLUGIN_INFO 32810
#define ID_TESTS_POPUP 32711
#define ID_TESTS_REQUEST 32712
#define ID_TESTS_TRANSPARENT_POPUP 32713
#define ID_TESTS_TRANSPARENT_OSRAPP 32714
#define ID_TESTS_WEBURLREQUEST 32715
#define ID_TESTS_ZOOM_IN 32716
#define ID_TESTS_ZOOM_OUT 32717
#define ID_TESTS_ZOOM_RESET 32718
#define IDC_STATIC -1
#define IDS_DIALOGS 1000
#define IDS_DOMACCESS 1001
#define IDS_LOCALSTORAGE 1002
#define IDS_LOGO 1003
#define IDS_LOGOBALL 1004
#define IDS_MODALDIALOG 1005
#define IDS_MODALMAIN 1006
#define IDS_OSRPLUGIN 1007
#define IDS_OTHER_TESTS 1008
#define IDS_PERFORMANCE 1009
#define IDS_TRANSPARENCY 1010
#define IDS_UIPLUGIN 1011
#define IDS_XMLHTTPREQUEST 1012
#define IDS_BINDING 1000
#define IDS_DIALOGS 1001
#define IDS_DOMACCESS 1002
#define IDS_EXTENSION 1003
#define IDS_LOCALSTORAGE 1004
#define IDS_LOGO 1005
#define IDS_LOGOBALL 1006
#define IDS_MODALDIALOG 1007
#define IDS_MODALMAIN 1008
#define IDS_OSRPLUGIN 1009
#define IDS_OTHER_TESTS 1010
#define IDS_PERFORMANCE 1011
#define IDS_PLUGIN 1012
#define IDS_TRANSPARENCY 1013
#define IDS_UIPLUGIN 1014
#define IDS_XMLHTTPREQUEST 1015
// Avoid files associated with MacOS
#define _X86_

View File

@ -33,8 +33,10 @@ int GetResourceId(const char* resource_name) {
char* name;
int id;
} resource_map[] = {
{"binding.html", IDS_BINDING},
{"dialogs.html", IDS_DIALOGS},
{"domaccess.html", IDS_DOMACCESS},
{"extension.html", IDS_EXTENSION},
{"localstorage.html", IDS_LOCALSTORAGE},
{"logo.png", IDS_LOGO},
{"logoball.png", IDS_LOGOBALL},
@ -43,6 +45,7 @@ int GetResourceId(const char* resource_name) {
{"osrplugin.html", IDS_OSRPLUGIN},
{"other_tests.html", IDS_OTHER_TESTS},
{"performance.html", IDS_PERFORMANCE},
{"plugin.html", IDS_PLUGIN},
{"transparency.html", IDS_TRANSPARENCY},
{"uiplugin.html", IDS_UIPLUGIN},
{"xmlhttprequest.html", IDS_XMLHTTPREQUEST},

View File

@ -154,8 +154,4 @@ void InitTest() {
new ClientSchemeHandlerFactory());
}
void RunTest(CefRefPtr<CefBrowser> browser) {
browser->GetMainFrame()->LoadURL("client://tests/handler.html");
}
} // namespace scheme_test

View File

@ -16,9 +16,6 @@ void AddSchemes(CefRefPtr<CefSchemeRegistrar> registrar);
// Register the scheme handler.
void InitTest();
// Run the test.
void RunTest(CefRefPtr<CefBrowser> browser);
} // namespace scheme_test
#endif // CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_

View File

@ -103,8 +103,4 @@ void InitTest() {
CefRegisterExtension("uiplugin/test", code, new ClientV8UIHandler());
}
void RunTest(CefRefPtr<CefBrowser> browser) {
browser->GetMainFrame()->LoadURL("http://tests/uiplugin");
}
} // namespace uiplugin_test

View File

@ -6,16 +6,11 @@
#define CEF_TESTS_CEFCLIENT_UIPLUGIN_TEST_H_
#pragma once
#include "include/cef_browser.h"
namespace uiplugin_test {
// Register the internal client plugin and V8 extension.
void InitTest();
// Run the test.
void RunTest(CefRefPtr<CefBrowser> browser);
} // namespace uiplugin_test
#endif // CEF_TESTS_CEFCLIENT_UIPLUGIN_TEST_H_