From bba0221e23f706144c509a0630a4e48cbb892717 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 4 Apr 2013 00:53:32 +0000 Subject: [PATCH] cefclient: Simplify tests and related resource loading. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1175 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- cef1/cef_paths2.gypi | 3 ++ cef1/tests/cefclient/binding_test.cpp | 36 +++---------- cef1/tests/cefclient/binding_test.h | 17 +++--- cef1/tests/cefclient/cefclient.rc | 9 ++-- cef1/tests/cefclient/cefclient_gtk.cpp | 42 --------------- cef1/tests/cefclient/cefclient_mac.mm | 38 -------------- cef1/tests/cefclient/cefclient_win.cpp | 26 --------- cef1/tests/cefclient/client_handler.cpp | 26 +-------- cef1/tests/cefclient/client_handler.h | 25 --------- cef1/tests/cefclient/extension_test.cpp | 19 ------- cef1/tests/cefclient/extension_test.h | 5 -- cef1/tests/cefclient/performance_test.cpp | 8 +-- cef1/tests/cefclient/performance_test.h | 13 ++--- cef1/tests/cefclient/plugin_test.cpp | 59 --------------------- cef1/tests/cefclient/plugin_test.h | 9 ---- cef1/tests/cefclient/res/binding.html | 22 ++++++++ cef1/tests/cefclient/res/extension.html | 15 ++++++ cef1/tests/cefclient/res/other_tests.html | 6 +++ cef1/tests/cefclient/res/plugin.html | 10 ++++ cef1/tests/cefclient/resource.h | 61 ++++++++++------------ cef1/tests/cefclient/resource_util_win.cpp | 3 ++ cef1/tests/cefclient/scheme_test.cpp | 4 -- cef1/tests/cefclient/scheme_test.h | 3 -- cef1/tests/cefclient/uiplugin_test.cpp | 4 -- cef1/tests/cefclient/uiplugin_test.h | 5 -- 25 files changed, 114 insertions(+), 354 deletions(-) create mode 100644 cef1/tests/cefclient/res/binding.html create mode 100644 cef1/tests/cefclient/res/extension.html create mode 100644 cef1/tests/cefclient/res/plugin.html diff --git a/cef1/cef_paths2.gypi b/cef1/cef_paths2.gypi index 5a8ba864d..db86374bd 100644 --- a/cef1/cef_paths2.gypi +++ b/cef1/cef_paths2.gypi @@ -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', diff --git a/cef1/tests/cefclient/binding_test.cpp b/cef1/tests/cefclient/binding_test.cpp index e5c262e45..79490a1b2 100644 --- a/cef1/tests/cefclient/binding_test.cpp +++ b/cef1/tests/cefclient/binding_test.cpp @@ -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 browser, - CefRefPtr frame, - CefRefPtr object) { +void InitTest(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr object) { // Create the new V8 object. CefRefPtr testObjPtr = CefV8Value::CreateObject(NULL); // Add the new V8 object to the global window object with the name @@ -152,28 +156,4 @@ void InitBindingTest(CefRefPtr browser, V8_PROPERTY_ATTRIBUTE_NONE); } -void RunBindingTest(CefRefPtr browser) { - std::string html = - "ClientV8FunctionHandler says:
"
-    ""
-    "
"; - browser->GetMainFrame()->LoadString(html, "about:blank"); -} +} // namespace binding_test diff --git a/cef1/tests/cefclient/binding_test.h b/cef1/tests/cefclient/binding_test.h index 4aa7948a5..23a626a49 100644 --- a/cef1/tests/cefclient/binding_test.h +++ b/cef1/tests/cefclient/binding_test.h @@ -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 browser, - CefRefPtr frame, - CefRefPtr object); +void InitTest(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr object); -// Run the test. -void RunBindingTest(CefRefPtr browser); +} // namespace binding_test #endif // CEF_TESTS_CEFCLIENT_BINDING_TEST_H_ diff --git a/cef1/tests/cefclient/cefclient.rc b/cef1/tests/cefclient/cefclient.rc index ca9794486..31bc1dda4 100644 --- a/cef1/tests/cefclient/cefclient.rc +++ b/cef1/tests/cefclient/cefclient.rc @@ -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 diff --git a/cef1/tests/cefclient/cefclient_gtk.cpp b/cef1/tests/cefclient/cefclient_gtk.cpp index bb1cbac1a..3dc3da96b 100644 --- a/cef1/tests/cefclient/cefclient_gtk.cpp +++ b/cef1/tests/cefclient/cefclient_gtk.cpp @@ -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", diff --git a/cef1/tests/cefclient/cefclient_mac.mm b/cef1/tests/cefclient/cefclient_mac.mm index 05039a9b3..f6fa2e71d 100644 --- a/cef1/tests/cefclient/cefclient_mac.mm +++ b/cef1/tests/cefclient/cefclient_mac.mm @@ -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()); diff --git a/cef1/tests/cefclient/cefclient_win.cpp b/cef1/tests/cefclient/cefclient_win.cpp index b6fb7e71b..bf8549c7e 100644 --- a/cef1/tests/cefclient/cefclient_win.cpp +++ b/cef1/tests/cefclient/cefclient_win.cpp @@ -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); diff --git a/cef1/tests/cefclient/client_handler.cpp b/cef1/tests/cefclient/client_handler.cpp index 766760d8b..573227c42 100644 --- a/cef1/tests/cefclient/client_handler.cpp +++ b/cef1/tests/cefclient/client_handler.cpp @@ -78,8 +78,6 @@ ClientHandler::ClientHandler() m_StopHwnd(NULL), m_ReloadHwnd(NULL), m_bFormElementHasFocus(false) { - CreateRequestDelegates(request_delegates_); - CefRefPtr 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 browser, @@ -368,7 +355,7 @@ void ClientHandler::OnContextCreated(CefRefPtr browser, CefRefPtr 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 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 -} diff --git a/cef1/tests/cefclient/client_handler.h b/cef1/tests/cefclient/client_handler.h index 9bfefd33a..4ee2fa269 100644 --- a/cef1/tests/cefclient/client_handler.h +++ b/cef1/tests/cefclient/client_handler.h @@ -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 handler, - CefRefPtr browser, - CefRefPtr request, - CefString& redirectUrl, - CefRefPtr& resourceStream, - CefRefPtr response, - int loadFlags) { - return false; - } - }; - - typedef std::set > 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 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. diff --git a/cef1/tests/cefclient/extension_test.cpp b/cef1/tests/cefclient/extension_test.cpp index c7bb7b9bf..921be81a0 100644 --- a/cef1/tests/cefclient/extension_test.cpp +++ b/cef1/tests/cefclient/extension_test.cpp @@ -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 browser) { - std::string html = - "ClientV8ExtensionHandler says:
"
-    ""
-    "
"; - browser->GetMainFrame()->LoadString(html, "about:blank"); -} - } // namespace extension_test diff --git a/cef1/tests/cefclient/extension_test.h b/cef1/tests/cefclient/extension_test.h index 195307485..9ddd734e2 100644 --- a/cef1/tests/cefclient/extension_test.h +++ b/cef1/tests/cefclient/extension_test.h @@ -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 browser); - } // namespace extension_test #endif // CEF_TESTS_CEFCLIENT_EXTENSION_TEST_H_ diff --git a/cef1/tests/cefclient/performance_test.cpp b/cef1/tests/cefclient/performance_test.cpp index c851dc9b1..12f9935a4 100644 --- a/cef1/tests/cefclient/performance_test.cpp +++ b/cef1/tests/cefclient/performance_test.cpp @@ -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 #include "cefclient/performance_test_setup.h" -#include "cefclient/resource_util.h" namespace performance_test { @@ -96,9 +95,4 @@ void InitTest(CefRefPtr browser, V8_PROPERTY_ATTRIBUTE_READONLY); } -void RunTest(CefRefPtr browser) { - // Load the test URL. - browser->GetMainFrame()->LoadURL(kTestUrl); -} - } // namespace performance_test diff --git a/cef1/tests/cefclient/performance_test.h b/cef1/tests/cefclient/performance_test.h index a47f66987..f279301b3 100644 --- a/cef1/tests/cefclient/performance_test.h +++ b/cef1/tests/cefclient/performance_test.h @@ -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 browser, CefRefPtr frame, CefRefPtr object); -// Run the test. -void RunTest(CefRefPtr browser); - } // namespace performance_test #endif // CEF_TESTS_CEFCLIENT_PERFORMANCE_TEST_H_ diff --git a/cef1/tests/cefclient/plugin_test.cpp b/cef1/tests/cefclient/plugin_test.cpp index bb2f3bcae..db4161bc6 100644 --- a/cef1/tests/cefclient/plugin_test.cpp +++ b/cef1/tests/cefclient/plugin_test.cpp @@ -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 handler, - CefRefPtr browser, - CefRefPtr request, - CefString& redirectUrl, - CefRefPtr& resourceStream, - CefRefPtr response, - int loadFlags) OVERRIDE { - std::string url = request->GetURL(); - if (url == kTestUrl) { - std::string html = - "\n" - "Client Plugin loaded by Mime Type:
\n" - "\n" - "

Client Plugin loaded by File Extension:
\n" - "\n" - // Add some extra space below the plugin to allow scrolling. - "
 
\n" - ""; - - resourceStream = CefStreamReader::CreateForData( - static_cast(const_cast(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 browser) { - // Page content is provided in ClientHandler::OnBeforeResourceLoad(). - browser->GetMainFrame()->LoadURL(kTestUrl); -} - } // namespace plugin_test diff --git a/cef1/tests/cefclient/plugin_test.h b/cef1/tests/cefclient/plugin_test.h index 2fe48bb68..8885105dc 100644 --- a/cef1/tests/cefclient/plugin_test.h +++ b/cef1/tests/cefclient/plugin_test.h @@ -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 browser); - } // namespace plugin_test #endif // CEF_TESTS_CEFCLIENT_PLUGIN_TEST_H_ diff --git a/cef1/tests/cefclient/res/binding.html b/cef1/tests/cefclient/res/binding.html new file mode 100644 index 000000000..9672f8ada --- /dev/null +++ b/cef1/tests/cefclient/res/binding.html @@ -0,0 +1,22 @@ + + +ClientV8FunctionHandler says:
+
+
+ + diff --git a/cef1/tests/cefclient/res/extension.html b/cef1/tests/cefclient/res/extension.html new file mode 100644 index 000000000..f713996de --- /dev/null +++ b/cef1/tests/cefclient/res/extension.html @@ -0,0 +1,15 @@ + + +ClientV8ExtensionHandler says:
+
+
+ + diff --git a/cef1/tests/cefclient/res/other_tests.html b/cef1/tests/cefclient/res/other_tests.html index ad04ab19c..41a8d51d3 100644 --- a/cef1/tests/cefclient/res/other_tests.html +++ b/cef1/tests/cefclient/res/other_tests.html @@ -15,8 +15,14 @@
  • Geolocation
  • HTML5 Feature Test
  • HTML5 Video
  • +
  • JavaScript Binding
  • +
  • JavaScript Extension
  • +
  • JavaScript Performance Tests
  • Local Storage
  • +
  • Plugin - Windows only
  • +
  • Plugin (UI App Example) - Windows only
  • requestAnimationFrame
  • +
  • Scheme Handler
  • Transparency
  • WebGL
  • XMLHttpRequest
  • diff --git a/cef1/tests/cefclient/res/plugin.html b/cef1/tests/cefclient/res/plugin.html new file mode 100644 index 000000000..3deedd903 --- /dev/null +++ b/cef1/tests/cefclient/res/plugin.html @@ -0,0 +1,10 @@ + + +Client Plugin loaded by Mime Type:
    + +

    Client Plugin loaded by File Extension:
    + + +
     
    + + diff --git a/cef1/tests/cefclient/resource.h b/cef1/tests/cefclient/resource.h index 2e921ce9c..fb28ac227 100644 --- a/cef1/tests/cefclient/resource.h +++ b/cef1/tests/cefclient/resource.h @@ -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_ diff --git a/cef1/tests/cefclient/resource_util_win.cpp b/cef1/tests/cefclient/resource_util_win.cpp index b40380a81..d8e39abdf 100644 --- a/cef1/tests/cefclient/resource_util_win.cpp +++ b/cef1/tests/cefclient/resource_util_win.cpp @@ -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}, diff --git a/cef1/tests/cefclient/scheme_test.cpp b/cef1/tests/cefclient/scheme_test.cpp index cb4ca0678..c9a0c35b4 100644 --- a/cef1/tests/cefclient/scheme_test.cpp +++ b/cef1/tests/cefclient/scheme_test.cpp @@ -154,8 +154,4 @@ void InitTest() { new ClientSchemeHandlerFactory()); } -void RunTest(CefRefPtr browser) { - browser->GetMainFrame()->LoadURL("client://tests/handler.html"); -} - } // namespace scheme_test diff --git a/cef1/tests/cefclient/scheme_test.h b/cef1/tests/cefclient/scheme_test.h index dd8f95c4a..83bed62db 100644 --- a/cef1/tests/cefclient/scheme_test.h +++ b/cef1/tests/cefclient/scheme_test.h @@ -16,9 +16,6 @@ void AddSchemes(CefRefPtr registrar); // Register the scheme handler. void InitTest(); -// Run the test. -void RunTest(CefRefPtr browser); - } // namespace scheme_test #endif // CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_ diff --git a/cef1/tests/cefclient/uiplugin_test.cpp b/cef1/tests/cefclient/uiplugin_test.cpp index 0b4508c4a..e205d8f82 100644 --- a/cef1/tests/cefclient/uiplugin_test.cpp +++ b/cef1/tests/cefclient/uiplugin_test.cpp @@ -103,8 +103,4 @@ void InitTest() { CefRegisterExtension("uiplugin/test", code, new ClientV8UIHandler()); } -void RunTest(CefRefPtr browser) { - browser->GetMainFrame()->LoadURL("http://tests/uiplugin"); -} - } // namespace uiplugin_test \ No newline at end of file diff --git a/cef1/tests/cefclient/uiplugin_test.h b/cef1/tests/cefclient/uiplugin_test.h index f7dd2db69..f322abfb3 100644 --- a/cef1/tests/cefclient/uiplugin_test.h +++ b/cef1/tests/cefclient/uiplugin_test.h @@ -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 browser); - } // namespace uiplugin_test #endif // CEF_TESTS_CEFCLIENT_UIPLUGIN_TEST_H_