mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-25 17:12:25 +01:00
4fbd247231
This change adds support for: - Protocol and request handling. - Loading and navigation events. - Display and focus events. - Mouse/keyboard events. - Popup browsers. - Callbacks in the renderer process. - Misc. functionality required for ceftests. This change also adds a new CefBrowserProcessHandler::GetCookieableSchemes callback for configuring global state that will be applied to all CefCookieManagers by default. This global callback is currently required by the chrome runtime because the primary ProfileImpl is created via ChromeBrowserMainParts::PreMainMessageLoopRun (CreatePrimaryProfile) before OnContextCreated can be called. ProfileImpl will use the "C:\Users\[user]\AppData\Local\CEF\User Data\Default" directory by default (on Windows). Cookies may persist in this directory when running ceftests and may need to be manually deleted if those tests fail. Remaining work includes: - Support for client-created request contexts. - Embedding the browser in a Views hierarchy (cefclient support). - TryCloseBrowser and DoClose support. - Most of the CefSettings configuration. - DevTools protocol and window control (ShowDevTools, ExecuteDevToolsMethod). - CEF-specific WebUI pages (about, license, webui-hosts). - Context menu customization (CefContextMenuHandler). - Auto resize (SetAutoResizeEnabled). - Zoom settings (SetZoomLevel). - File dialog runner (RunFileDialog). - File and JS dialog handlers (CefDialogHandler, CefJSDialogHandler). - Extension loading (LoadExtension, etc). - Plugin loading (OnBeforePluginLoad). - Widevine loading (CefRegisterWidevineCdm). - PDF and print preview does not display. - Crash reporting is untested. - Mac: Web content loads but does not display. The following ceftests are now passing when run with the "--enable-chrome-runtime" command-line flag: CorsTest.* DisplayTest.*:-DisplayTest.AutoResize DOMTest.* DraggableRegionsTest.* ImageTest.* MessageRouterTest.* NavigationTest.* ParserTest.* RequestContextTest.*Global* RequestTest.* ResourceManagerTest.* ResourceRequestHandlerTest.* ResponseTest.* SchemeHandlerTest.* ServerTest.* StreamResourceHandlerTest.* StreamTest.* StringTest.* TaskTest.* TestServerTest.* ThreadTest.* URLRequestTest.*Global* V8Test.*:-V8Test.OnUncaughtExceptionDevTools ValuesTest.* WaitableEventTest.* XmlReaderTest.* ZipReaderTest.*
74 lines
3.3 KiB
C
74 lines
3.3 KiB
C
// 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.
|
|
|
|
#ifndef CEF_TESTS_CEFTESTS_THREAD_HELPER_H_
|
|
#define CEF_TESTS_CEFTESTS_THREAD_HELPER_H_
|
|
#pragma once
|
|
|
|
#include "include/base/cef_bind.h"
|
|
#include "include/cef_task.h"
|
|
#include "include/cef_waitable_event.h"
|
|
|
|
// Helper for signaling |event|.
|
|
void SignalEvent(CefRefPtr<CefWaitableEvent> event);
|
|
|
|
// Post a task to the specified thread and wait for the task to execute as
|
|
// indication that all previously pending tasks on that thread have completed.
|
|
void WaitForThread(CefThreadId thread_id, int64 delay_ms = 0);
|
|
void WaitForThread(CefRefPtr<CefTaskRunner> task_runner, int64 delay_ms = 0);
|
|
|
|
#define WaitForIOThread() WaitForThread(TID_IO)
|
|
#define WaitForUIThread() WaitForThread(TID_UI)
|
|
#define WaitForFILEThread() WaitForThread(TID_FILE_USER_VISIBLE)
|
|
#define WaitForIOThreadWithDelay(delay_ms) WaitForThread(TID_IO, delay_ms)
|
|
#define WaitForUIThreadWithDelay(delay_ms) WaitForThread(TID_UI, delay_ms)
|
|
#define WaitForFILEThreadWithDelay(delay_ms) \
|
|
WaitForThread(TID_FILE_USER_VISIBLE, delay_ms)
|
|
|
|
// Assert that execution is occuring on the named thread.
|
|
#define EXPECT_UI_THREAD() EXPECT_TRUE(CefCurrentlyOn(TID_UI));
|
|
#define EXPECT_IO_THREAD() EXPECT_TRUE(CefCurrentlyOn(TID_IO));
|
|
#define EXPECT_FILE_THREAD() EXPECT_TRUE(CefCurrentlyOn(TID_FILE_USER_VISIBLE));
|
|
#define EXPECT_RENDERER_THREAD() EXPECT_TRUE(CefCurrentlyOn(TID_RENDERER));
|
|
|
|
// Executes |test_impl| on the specified |thread_id|. |event| will be signaled
|
|
// once execution is complete.
|
|
void RunOnThread(CefThreadId thread_id,
|
|
const base::Callback<void(void)>& test_impl,
|
|
CefRefPtr<CefWaitableEvent> event);
|
|
|
|
#define NAMED_THREAD_TEST(thread_id, test_case_name, test_name) \
|
|
TEST(test_case_name, test_name) { \
|
|
CefRefPtr<CefWaitableEvent> event = \
|
|
CefWaitableEvent::CreateWaitableEvent(true, false); \
|
|
RunOnThread(thread_id, base::Bind(test_name##Impl), event); \
|
|
event->Wait(); \
|
|
}
|
|
|
|
// Execute "test_case_name.test_name" test on the named thread. The test
|
|
// implementation is "void test_nameImpl()".
|
|
#define UI_THREAD_TEST(test_case_name, test_name) \
|
|
NAMED_THREAD_TEST(TID_UI, test_case_name, test_name)
|
|
|
|
// Like RunOnThread() but |test_impl| is responsible for signaling |event|.
|
|
void RunOnThreadAsync(
|
|
CefThreadId thread_id,
|
|
const base::Callback<void(CefRefPtr<CefWaitableEvent>)>& test_impl,
|
|
CefRefPtr<CefWaitableEvent>);
|
|
|
|
#define NAMED_THREAD_TEST_ASYNC(thread_id, test_case_name, test_name) \
|
|
TEST(test_case_name, test_name) { \
|
|
CefRefPtr<CefWaitableEvent> event = \
|
|
CefWaitableEvent::CreateWaitableEvent(true, false); \
|
|
RunOnThreadAsync(thread_id, base::Bind(test_name##Impl), event); \
|
|
event->Wait(); \
|
|
}
|
|
|
|
// Execute "test_case_name.test_name" test on the named thread. The test
|
|
// implementation is "void test_nameImpl(CefRefPtr<CefWaitableEvent> event)".
|
|
#define UI_THREAD_TEST_ASYNC(test_case_name, test_name) \
|
|
NAMED_THREAD_TEST_ASYNC(TID_UI, test_case_name, test_name)
|
|
|
|
#endif // CEF_TESTS_CEFTESTS_THREAD_HELPER_H_
|