diff --git a/include/wrapper/cef_closure_task.h b/include/wrapper/cef_closure_task.h index 95b7c2a52..76db4fa42 100644 --- a/include/wrapper/cef_closure_task.h +++ b/include/wrapper/cef_closure_task.h @@ -85,7 +85,7 @@ // Create a CefTask that wraps a base::Closure. Can be used in combination with // CefTaskRunner. /// -CefRefPtr CefCreateClosureRask(const base::Closure& closure); +CefRefPtr CefCreateClosureTask(const base::Closure& closure); /// // Post a Closure for execution on the specified thread. diff --git a/libcef_dll/wrapper/cef_closure_task.cc b/libcef_dll/wrapper/cef_closure_task.cc index 2a3b74254..0b4939053 100644 --- a/libcef_dll/wrapper/cef_closure_task.cc +++ b/libcef_dll/wrapper/cef_closure_task.cc @@ -28,7 +28,7 @@ class CefClosureTask : public CefTask { } // namespace -CefRefPtr CefCreateClosureRask(const base::Closure& closure) { +CefRefPtr CefCreateClosureTask(const base::Closure& closure) { return new CefClosureTask(closure); } diff --git a/libcef_dll/wrapper/cef_message_router.cc b/libcef_dll/wrapper/cef_message_router.cc index 7019edc51..8966ffa52 100644 --- a/libcef_dll/wrapper/cef_message_router.cc +++ b/libcef_dll/wrapper/cef_message_router.cc @@ -7,9 +7,10 @@ #include #include +#include "include/base/cef_bind.h" #include "include/base/cef_macros.h" -#include "include/cef_runnable.h" #include "include/cef_task.h" +#include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_helpers.h" #include "libcef_dll/wrapper/cef_browser_info_map.h" @@ -87,16 +88,14 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide { if (!CefCurrentlyOn(TID_UI)) { // Must execute on the UI thread to access member variables. CefPostTask(TID_UI, - NewCefRunnableMethod(this, &CallbackImpl::Success, response)); + base::Bind(&CallbackImpl::Success, this, response)); return; } if (router_) { CefPostTask(TID_UI, - NewCefRunnableMethod( - router_.get(), - &CefMessageRouterBrowserSideImpl::OnCallbackSuccess, - browser_id_, query_id_, response)); + base::Bind(&CefMessageRouterBrowserSideImpl::OnCallbackSuccess, + router_, browser_id_, query_id_, response)); if (!persistent_) { // Non-persistent callbacks are only good for a single use. @@ -110,17 +109,16 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide { if (!CefCurrentlyOn(TID_UI)) { // Must execute on the UI thread to access member variables. CefPostTask(TID_UI, - NewCefRunnableMethod(this, &CallbackImpl::Failure, - error_code, error_message)); + base::Bind(&CallbackImpl::Failure, this, + error_code, error_message)); return; } if (router_) { CefPostTask(TID_UI, - NewCefRunnableMethod( - router_.get(), - &CefMessageRouterBrowserSideImpl::OnCallbackFailure, - browser_id_, query_id_, error_code, error_message)); + base::Bind(&CefMessageRouterBrowserSideImpl::OnCallbackFailure, + router_, browser_id_, query_id_, error_code, + error_message)); // Failure always invalidates the callback. router_ = NULL; @@ -494,9 +492,8 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide { if (!CefCurrentlyOn(TID_UI)) { // Must execute on the UI thread. CefPostTask(TID_UI, - NewCefRunnableMethod(this, - &CefMessageRouterBrowserSideImpl::CancelPendingFor, - browser, handler, notify_renderer)); + base::Bind(&CefMessageRouterBrowserSideImpl::CancelPendingFor, this, + browser, handler, notify_renderer)); return; } @@ -843,16 +840,16 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide { DCHECK_EQ(args->GetSize(), 4U); const CefString& response = args->GetString(3); CefPostTask(TID_RENDERER, - NewCefRunnableMethod(this, - &CefMessageRouterRendererSideImpl::ExecuteSuccessCallback, + base::Bind( + &CefMessageRouterRendererSideImpl::ExecuteSuccessCallback, this, browser->GetIdentifier(), context_id, request_id, response)); } else { DCHECK_EQ(args->GetSize(), 5U); int error_code = args->GetInt(3); const CefString& error_message = args->GetString(4); CefPostTask(TID_RENDERER, - NewCefRunnableMethod(this, - &CefMessageRouterRendererSideImpl::ExecuteFailureCallback, + base::Bind( + &CefMessageRouterRendererSideImpl::ExecuteFailureCallback, this, browser->GetIdentifier(), context_id, request_id, error_code, error_message)); } diff --git a/tests/unittests/cookie_unittest.cc b/tests/unittests/cookie_unittest.cc index 9571c5307..15d148862 100644 --- a/tests/unittests/cookie_unittest.cc +++ b/tests/unittests/cookie_unittest.cc @@ -10,11 +10,12 @@ #include "base/files/scoped_temp_dir.h" #include "base/synchronization/waitable_event.h" +#include "include/base/cef_bind.h" #include "include/base/cef_logging.h" #include "include/base/cef_ref_counted.h" #include "include/cef_cookie.h" -#include "include/cef_runnable.h" #include "include/cef_scheme.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/test_handler.h" #include "tests/unittests/test_suite.h" @@ -74,8 +75,7 @@ class TestVisitor : public CefCookieVisitor { void SetCookies(CefRefPtr manager, const CefString& url, CookieVector& cookies, base::WaitableEvent& event) { - CefPostTask(TID_IO, NewCefRunnableFunction(IOT_Set, manager, url, - &cookies, &event)); + CefPostTask(TID_IO, base::Bind(IOT_Set, manager, url, &cookies, &event)); event.Wait(); } @@ -83,8 +83,8 @@ void SetCookies(CefRefPtr manager, void DeleteCookies(CefRefPtr manager, const CefString& url, const CefString& cookie_name, base::WaitableEvent& event) { - CefPostTask(TID_IO, NewCefRunnableFunction(IOT_Delete, manager, url, - cookie_name, &event)); + CefPostTask(TID_IO, + base::Bind(IOT_Delete, manager, url, cookie_name, &event)); event.Wait(); } @@ -191,8 +191,8 @@ void VerifyNoCookies(CefRefPtr manager, // Delete all system cookies. void DeleteAllCookies(CefRefPtr manager, base::WaitableEvent& event) { - CefPostTask(TID_IO, NewCefRunnableFunction(IOT_Delete, manager, CefString(), - CefString(), &event)); + CefPostTask(TID_IO, + base::Bind(IOT_Delete, manager, CefString(), CefString(), &event)); event.Wait(); } diff --git a/tests/unittests/dialog_unittest.cc b/tests/unittests/dialog_unittest.cc index 6cf682149..4a1c982f7 100644 --- a/tests/unittests/dialog_unittest.cc +++ b/tests/unittests/dialog_unittest.cc @@ -5,7 +5,8 @@ // Include this first to avoid type conflicts with CEF headers. #include "tests/unittests/chromium_includes.h" -#include "include/cef_runnable.h" +#include "include/base/cef_bind.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/test_handler.h" #include "tests/unittests/test_util.h" @@ -116,8 +117,7 @@ class DialogTestHandler : public TestHandler { if (config_.callback_async) { CefPostTask(TID_UI, - NewCefRunnableMethod(this, &DialogTestHandler::ExecuteCallback, - callback)); + base::Bind(&DialogTestHandler::ExecuteCallback, this, callback)); } else { ExecuteCallback(callback); } diff --git a/tests/unittests/display_unittest.cc b/tests/unittests/display_unittest.cc index a1475cd45..ffd17ab9c 100644 --- a/tests/unittests/display_unittest.cc +++ b/tests/unittests/display_unittest.cc @@ -7,7 +7,6 @@ // Include this first to avoid type conflicts with CEF headers. #include "tests/unittests/chromium_includes.h" -#include "include/cef_runnable.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/test_handler.h" diff --git a/tests/unittests/geolocation_unittest.cc b/tests/unittests/geolocation_unittest.cc index 4022c726b..59fedee08 100644 --- a/tests/unittests/geolocation_unittest.cc +++ b/tests/unittests/geolocation_unittest.cc @@ -7,8 +7,9 @@ #include "base/synchronization/waitable_event.h" +#include "include/base/cef_bind.h" #include "include/cef_geolocation.h" -#include "include/cef_runnable.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/test_handler.h" #include "tests/unittests/test_util.h" @@ -98,8 +99,7 @@ class GeolocationTestHandler : public TestHandler { ExecuteCallback(callback); } else { CefPostTask(TID_UI, - NewCefRunnableMethod(this, &GeolocationTestHandler::ExecuteCallback, - callback)); + base::Bind(&GeolocationTestHandler::ExecuteCallback, this, callback)); } return true; diff --git a/tests/unittests/jsdialog_unittest.cc b/tests/unittests/jsdialog_unittest.cc index 75fcb1b96..b0a0389e7 100644 --- a/tests/unittests/jsdialog_unittest.cc +++ b/tests/unittests/jsdialog_unittest.cc @@ -5,7 +5,8 @@ // Include this first to avoid type conflicts with CEF headers. #include "tests/unittests/chromium_includes.h" -#include "include/cef_runnable.h" +#include "include/base/cef_bind.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/test_handler.h" @@ -127,7 +128,7 @@ class JSDialogTestHandler : public TestHandler { } else if (mode_ == MODE_RUN_DELAYED) { // Continue asynchronously. CefPostTask(TID_UI, - NewCefRunnableMethod(this, &JSDialogTestHandler::Continue, callback)); + base::Bind(&JSDialogTestHandler::Continue, this, callback)); } return true; @@ -151,7 +152,7 @@ class JSDialogTestHandler : public TestHandler { } else if (mode_ == MODE_RUN_DELAYED) { // Continue asynchronously. CefPostTask(TID_UI, - NewCefRunnableMethod(this, &JSDialogTestHandler::Continue, callback)); + base::Bind(&JSDialogTestHandler::Continue, this, callback)); } return true; diff --git a/tests/unittests/life_span_unittest.cc b/tests/unittests/life_span_unittest.cc index c782e5721..0f79b074f 100644 --- a/tests/unittests/life_span_unittest.cc +++ b/tests/unittests/life_span_unittest.cc @@ -5,7 +5,8 @@ // Include this first to avoid type conflicts with CEF headers. #include "tests/unittests/chromium_includes.h" -#include "include/cef_runnable.h" +#include "include/base/cef_bind.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/routing_test_handler.h" @@ -146,7 +147,7 @@ class LifeSpanTestHandler : public RoutingTestHandler { // the window. void ScheduleDelayClose() { CefPostDelayedTask(TID_UI, - NewCefRunnableMethod(this, &LifeSpanTestHandler::DelayClose), 100); + base::Bind(&LifeSpanTestHandler::DelayClose, this), 100); } void DelayClose() { diff --git a/tests/unittests/message_router_unittest.cc b/tests/unittests/message_router_unittest.cc index e06427ab6..032f6f540 100644 --- a/tests/unittests/message_router_unittest.cc +++ b/tests/unittests/message_router_unittest.cc @@ -11,9 +11,10 @@ #include "base/strings/stringprintf.h" +#include "include/base/cef_bind.h" #include "include/base/cef_weak_ptr.h" #include "include/cef_v8.h" -#include "include/cef_runnable.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/routing_test_handler.h" #include "tests/cefclient/client_app.h" @@ -211,7 +212,7 @@ class MRTestHandler : public TestHandler { #if defined(TIMEOUT_ENABLED) // Time out the test after a reasonable period of time. CefPostDelayedTask(TID_UI, - NewCefRunnableMethod(this, &MRTestHandler::DestroyTest), + base::Bind(&MRTestHandler::DestroyTest, this), 4000); #endif } @@ -542,8 +543,7 @@ class SingleQueryTestHandler : public SingleLoadTestHandler { ExecuteCallback(); } else { CefPostTask(TID_UI, - NewCefRunnableMethod(this, - &SingleQueryTestHandler::ExecuteCallback)); + base::Bind(&SingleQueryTestHandler::ExecuteCallback, this)); } } @@ -767,8 +767,8 @@ class SinglePersistentQueryTestHandler : public SingleLoadTestHandler { ExecuteCallback(); } else { CefPostTask(TID_UI, - NewCefRunnableMethod(this, - &SinglePersistentQueryTestHandler::ExecuteCallback)); + base::Bind(&SinglePersistentQueryTestHandler::ExecuteCallback, + this)); } } @@ -1851,8 +1851,7 @@ class MultiQuerySingleFrameTestHandler : if (!SignalCompletionWhenAllBrowsersClose()) { // Complete asynchronously so the call stack has a chance to unwind. CefPostTask(TID_UI, - NewCefRunnableMethod(this, - &MultiQuerySingleFrameTestHandler::TestComplete)); + base::Bind(&MultiQuerySingleFrameTestHandler::TestComplete, this)); } } diff --git a/tests/unittests/navigation_unittest.cc b/tests/unittests/navigation_unittest.cc index 86d29e20d..9a7467d6f 100644 --- a/tests/unittests/navigation_unittest.cc +++ b/tests/unittests/navigation_unittest.cc @@ -8,9 +8,10 @@ // Include this first to avoid type conflicts with CEF headers. #include "tests/unittests/chromium_includes.h" +#include "include/base/cef_bind.h" #include "include/cef_callback.h" -#include "include/cef_runnable.h" #include "include/cef_scheme.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/cefclient/client_app.h" #include "tests/unittests/test_handler.h" @@ -1864,7 +1865,7 @@ class PopupNavTestHandler : public TestHandler { if (!allow_) { // Wait a bit to make sure the popup window isn't created. CefPostDelayedTask(TID_UI, - NewCefRunnableMethod(this, &PopupNavTestHandler::DestroyTest), 200); + base::Bind(&PopupNavTestHandler::DestroyTest, this), 200); } } else if (url == kPopupNavPopupUrl) { if (allow_) { @@ -1930,8 +1931,8 @@ class BrowseNavTestHandler : public TestHandler { // Time out the test after a reasonable period of time. CefPostDelayedTask(TID_UI, - NewCefRunnableMethod(this, &BrowseNavTestHandler::DestroyTest), - 2000); + base::Bind(&BrowseNavTestHandler::DestroyTest, this), + 2000); } virtual bool OnBeforeBrowse(CefRefPtr browser, diff --git a/tests/unittests/os_rendering_unittest.cc b/tests/unittests/os_rendering_unittest.cc index 4af3633db..4ed763af2 100644 --- a/tests/unittests/os_rendering_unittest.cc +++ b/tests/unittests/os_rendering_unittest.cc @@ -8,9 +8,10 @@ #include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_code_conversion.h" +#include "include/base/cef_bind.h" #include "include/base/cef_logging.h" -#include "include/cef_runnable.h" #include "include/cef_v8.h" +#include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_stream_resource_handler.h" #include "tests/cefclient/client_app.h" #include "tests/cefclient/resource_util.h" @@ -229,8 +230,8 @@ class OSRTestHandler : public RoutingTestHandler, // Each test has a 5 second timeout. After this timeout it will be destroyed // and the test will fail. DestroyTest will be called at the timeout even // if the test is already destroyed and this is fine. - CefPostDelayedTask(TID_UI, NewCefRunnableMethod(this, - &OSRTestHandler::DestroyTest), 5000); + CefPostDelayedTask(TID_UI, base::Bind(&OSRTestHandler::DestroyTest, this), + 5000); #endif // DEBUGGER_ATTACHED } @@ -936,10 +937,8 @@ class OSRTestHandler : public RoutingTestHandler, void DestroySucceededTestSoon() { if (succeeded()) return; - if (++event_count_ == event_total_) { - CefPostTask(TID_UI, NewCefRunnableMethod(this, - &OSRTestHandler::DestroyTest)); - } + if (++event_count_ == event_total_) + CefPostTask(TID_UI, base::Bind(&OSRTestHandler::DestroyTest, this)); } void ExpandDropDown() { diff --git a/tests/unittests/request_context_unittest.cc b/tests/unittests/request_context_unittest.cc index 005d50f1f..d6abdbd3e 100644 --- a/tests/unittests/request_context_unittest.cc +++ b/tests/unittests/request_context_unittest.cc @@ -5,9 +5,10 @@ // Include this first to avoid type conflicts with CEF headers. #include "tests/unittests/chromium_includes.h" +#include "include/base/cef_bind.h" #include "include/cef_request_context.h" #include "include/cef_request_context_handler.h" -#include "include/cef_runnable.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/test_handler.h" @@ -158,7 +159,7 @@ class CookieTestHandler : public TestHandler { virtual ~TestVisitor() { // Destroy the test. CefPostTask(TID_UI, - NewCefRunnableMethod(handler_, &CookieTestHandler::DestroyTest)); + base::Bind(&CookieTestHandler::DestroyTest, handler_)); } virtual bool Visit(const CefCookie& cookie, int count, int total, @@ -366,7 +367,7 @@ class PopupTestHandler : public TestHandler { virtual ~TestVisitor() { // Destroy the test. CefPostTask(TID_UI, - NewCefRunnableMethod(handler_, &PopupTestHandler::DestroyTest)); + base::Bind(&PopupTestHandler::DestroyTest, handler_)); } virtual bool Visit(const CefCookie& cookie, int count, int total, diff --git a/tests/unittests/request_handler_unittest.cc b/tests/unittests/request_handler_unittest.cc index a49542b11..8f8eab020 100644 --- a/tests/unittests/request_handler_unittest.cc +++ b/tests/unittests/request_handler_unittest.cc @@ -7,8 +7,9 @@ #include "base/strings/stringprintf.h" +#include "include/base/cef_bind.h" #include "include/cef_cookie.h" -#include "include/cef_runnable.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/cefclient/client_app.h" #include "tests/unittests/test_handler.h" @@ -269,7 +270,7 @@ class NetNotifyTestHandler : public TestHandler { virtual ~TestVisitor() { // Destroy the test. CefPostTask(TID_UI, - NewCefRunnableMethod(handler_, &NetNotifyTestHandler::DestroyTest)); + base::Bind(&NetNotifyTestHandler::DestroyTest, handler_)); } virtual bool Visit(const CefCookie& cookie, int count, int total, diff --git a/tests/unittests/request_unittest.cc b/tests/unittests/request_unittest.cc index 699d19e65..4bb241fee 100644 --- a/tests/unittests/request_unittest.cc +++ b/tests/unittests/request_unittest.cc @@ -7,8 +7,9 @@ // Include this first to avoid type conflicts with CEF headers. #include "tests/unittests/chromium_includes.h" +#include "include/base/cef_bind.h" #include "include/cef_request.h" -#include "include/cef_runnable.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/cefclient/client_app.h" #include "tests/unittests/test_handler.h" @@ -492,9 +493,8 @@ class TypeTestHandler : public TestHandler { CreateBrowser(std::string(kTypeTestOrigin) + "main.html"); // Time out the test after a reasonable period of time. - CefPostDelayedTask(TID_UI, - NewCefRunnableMethod(this, &TypeTestHandler::DestroyTest), - 2000); + CefPostDelayedTask(TID_UI, base::Bind(&TypeTestHandler::DestroyTest, this), + 2000); } virtual bool OnBeforeBrowse(CefRefPtr browser, @@ -523,7 +523,7 @@ class TypeTestHandler : public TestHandler { completed_browser_side_ = true; // Destroy the test on the UI thread. CefPostTask(TID_UI, - NewCefRunnableMethod(this, &TypeTestHandler::DestroyTestIfComplete)); + base::Bind(&TypeTestHandler::DestroyTestIfComplete, this)); } return TestHandler::GetResourceHandler(browser, frame, request); diff --git a/tests/unittests/run_all_unittests.cc b/tests/unittests/run_all_unittests.cc index 26a9b7769..acbbff030 100644 --- a/tests/unittests/run_all_unittests.cc +++ b/tests/unittests/run_all_unittests.cc @@ -11,13 +11,11 @@ #include "include/cef_app.h" #include "include/cef_task.h" #include "include/wrapper/cef_helpers.h" +#include "include/wrapper/cef_closure_task.h" #include "tests/cefclient/client_app.h" #include "tests/unittests/test_handler.h" #include "tests/unittests/test_suite.h" -// Include after base/bind.h to avoid name collisions with cef_tuple.h. -#include "include/cef_runnable.h" - #if defined(OS_WIN) #include "include/cef_sandbox_win.h" #endif @@ -41,7 +39,7 @@ class CefTestThread : public base::Thread { base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); // Quit the CEF message loop. - CefPostTask(TID_UI, NewCefRunnableFunction(CefQuitMessageLoop)); + CefPostTask(TID_UI, base::Bind(&CefQuitMessageLoop)); } int retval() { return retval_; } @@ -124,7 +122,7 @@ int main(int argc, char* argv[]) { // Start the tests from the UI thread so that any pending UI tasks get a // chance to execute first. - CefPostTask(TID_UI, NewCefRunnableFunction(RunTests, thread.get())); + CefPostTask(TID_UI, base::Bind(&RunTests, thread.get())); // Run the CEF message loop. CefRunMessageLoop(); diff --git a/tests/unittests/scheme_handler_unittest.cc b/tests/unittests/scheme_handler_unittest.cc index a582c1cdc..c471ba21b 100644 --- a/tests/unittests/scheme_handler_unittest.cc +++ b/tests/unittests/scheme_handler_unittest.cc @@ -7,10 +7,11 @@ // Include this first to avoid type conflicts with CEF headers. #include "tests/unittests/chromium_includes.h" +#include "include/base/cef_bind.h" #include "include/cef_origin_whitelist.h" #include "include/cef_callback.h" -#include "include/cef_runnable.h" #include "include/cef_scheme.h" +#include "include/wrapper/cef_closure_task.h" #include "tests/unittests/test_handler.h" namespace { @@ -194,7 +195,7 @@ class ClientSchemeHandler : public CefResourceHandler { if (test_results_->delay > 0) { // Continue after the delay. CefPostDelayedTask(TID_IO, - NewCefRunnableMethod(callback.get(), &CefCallback::Continue), + base::Bind(&CefCallback::Continue, callback), test_results_->delay); } else { // Continue immediately. @@ -254,8 +255,8 @@ class ClientSchemeHandler : public CefResourceHandler { if (!has_delayed_) { // Continue after a delay. CefPostDelayedTask(TID_IO, - NewCefRunnableMethod(this, - &ClientSchemeHandler::ContinueAfterDelay, callback), + base::Bind(&ClientSchemeHandler::ContinueAfterDelay, + this, callback), test_results_->delay); bytes_read = 0; return true; diff --git a/tests/unittests/stream_resource_handler_unittest.cc b/tests/unittests/stream_resource_handler_unittest.cc index fd78f8417..057f18a96 100644 --- a/tests/unittests/stream_resource_handler_unittest.cc +++ b/tests/unittests/stream_resource_handler_unittest.cc @@ -9,8 +9,9 @@ // Include this first to avoid type conflicts with CEF headers. #include "tests/unittests/chromium_includes.h" -#include "include/cef_runnable.h" +#include "include/base/cef_bind.h" #include "include/cef_stream.h" +#include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_stream_resource_handler.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/routing_test_handler.h" @@ -108,7 +109,7 @@ class ReadTestHandler : public RoutingTestHandler { #if defined(TIMEOUT_ENABLED) // Time out the test after a reasonable period of time. CefPostDelayedTask(TID_UI, - NewCefRunnableMethod(this, &ReadTestHandler::DestroyTest), 3000); + base::Bind(&ReadTestHandler::DestroyTest, this), 3000); #endif } diff --git a/tests/unittests/test_handler.cc b/tests/unittests/test_handler.cc index 8713f2c11..6c8c6c613 100644 --- a/tests/unittests/test_handler.cc +++ b/tests/unittests/test_handler.cc @@ -7,9 +7,10 @@ #include "tests/unittests/test_handler.h" +#include "include/base/cef_bind.h" #include "include/cef_command_line.h" -#include "include/cef_runnable.h" #include "include/cef_stream.h" +#include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_stream_resource_handler.h" namespace { @@ -202,7 +203,7 @@ void TestHandler::SetupComplete() { void TestHandler::DestroyTest() { if (!CefCurrentlyOn(TID_UI)) { - CefPostTask(TID_UI, NewCefRunnableMethod(this, &TestHandler::DestroyTest)); + CefPostTask(TID_UI, base::Bind(&TestHandler::DestroyTest, this)); return; } @@ -236,8 +237,7 @@ void TestHandler::AddResource(const std::string& url, const std::string& mimeType) { if (!CefCurrentlyOn(TID_IO)) { CefPostTask(TID_IO, - NewCefRunnableMethod(this, &TestHandler::AddResource, url, content, - mimeType)); + base::Bind(&TestHandler::AddResource, this, url, content, mimeType)); return; } @@ -253,8 +253,7 @@ void TestHandler::AddResource(const std::string& url, void TestHandler::ClearResources() { if (!CefCurrentlyOn(TID_IO)) { - CefPostTask(TID_IO, - NewCefRunnableMethod(this, &TestHandler::ClearResources)); + CefPostTask(TID_IO, base::Bind(&TestHandler::ClearResources, this)); return; } @@ -263,7 +262,7 @@ void TestHandler::ClearResources() { void TestHandler::TestComplete() { if (!CefCurrentlyOn(TID_UI)) { - CefPostTask(TID_UI, NewCefRunnableMethod(this, &TestHandler::TestComplete)); + CefPostTask(TID_UI, base::Bind(&TestHandler::TestComplete, this)); return; } @@ -276,13 +275,13 @@ void TestHandler::TestComplete() { void WaitForThread(CefThreadId thread_id) { base::WaitableEvent event(true, false); - CefPostTask(thread_id, NewCefRunnableFunction(&NotifyEvent, &event)); + CefPostTask(thread_id, base::Bind(&NotifyEvent, &event)); event.Wait(); } void WaitForThread(CefRefPtr task_runner) { base::WaitableEvent event(true, false); - task_runner->PostTask(NewCefRunnableFunction(&NotifyEvent, &event)); + task_runner->PostTask(CefCreateClosureTask(base::Bind(&NotifyEvent, &event))); event.Wait(); } diff --git a/tests/unittests/tracing_unittest.cc b/tests/unittests/tracing_unittest.cc index 83cbb5945..94826492c 100644 --- a/tests/unittests/tracing_unittest.cc +++ b/tests/unittests/tracing_unittest.cc @@ -8,10 +8,11 @@ #include "base/file_util.h" #include "base/synchronization/waitable_event.h" -#include "include/cef_runnable.h" +#include "include/base/cef_bind.h" +#include "include/base/cef_trace_event.h" #include "include/cef_task.h" #include "include/cef_trace.h" -#include "include/base/cef_trace_event.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/test_handler.h" @@ -93,8 +94,7 @@ class TracingTestHandler : public CefEndTracingCallback, base::FilePath file_path(tracing_file); CefPostTask(TID_FILE, - NewCefRunnableMethod(this, &TracingTestHandler::ReadTracingFile, - file_path)); + base::Bind(&TracingTestHandler::ReadTracingFile, this, file_path)); } void RunTracing() { @@ -324,8 +324,7 @@ class TracingTestHandler : public CefEndTracingCallback, void ExecuteTest() { // Run the test. - CefPostTask(TID_UI, - NewCefRunnableMethod(this, &TracingTestHandler::RunTracing)); + CefPostTask(TID_UI, base::Bind(&TracingTestHandler::RunTracing, this)); // Wait for the test to complete. completion_event_.Wait(); diff --git a/tests/unittests/urlrequest_unittest.cc b/tests/unittests/urlrequest_unittest.cc index d2717ef76..a2e8b7c0e 100644 --- a/tests/unittests/urlrequest_unittest.cc +++ b/tests/unittests/urlrequest_unittest.cc @@ -17,15 +17,12 @@ #include "include/cef_scheme.h" #include "include/cef_task.h" #include "include/cef_urlrequest.h" +#include "include/wrapper/cef_closure_task.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/cefclient/client_app.h" #include "tests/unittests/test_handler.h" #include "tests/unittests/test_util.h" -// Include after base/bind.h to avoid name collisions with cef_tuple.h. -#include "include/cef_runnable.h" - - // How to add a new test: // 1. Add a new value to the RequestTestMode enumeration. // 2. Add methods to set up and run the test in RequestTestRunner. @@ -1010,8 +1007,7 @@ class RequestTestHandler : public TestHandler, } else { // Execute on the IO thread. CefPostTask(TID_IO, - NewCefRunnableMethod(this, &RequestTestHandler::SetTestCookie, - event)); + base::Bind(&RequestTestHandler::SetTestCookie, this, event)); } } @@ -1027,8 +1023,7 @@ class RequestTestHandler : public TestHandler, } else { // Execute on the IO thread. CefPostTask(TID_IO, - NewCefRunnableMethod(this, &RequestTestHandler::ClearTestCookie, - event)); + base::Bind(&RequestTestHandler::ClearTestCookie, this, event)); } } @@ -1107,8 +1102,7 @@ class InvalidURLTestClient : public CefURLRequestClient { } void RunTest() { - CefPostTask(TID_UI, - NewCefRunnableMethod(this, &InvalidURLTestClient::RunOnUIThread)); + CefPostTask(TID_UI, base::Bind(&InvalidURLTestClient::RunOnUIThread, this)); // Wait for the test to complete. event_.Wait(); @@ -1119,7 +1113,7 @@ class InvalidURLTestClient : public CefURLRequestClient { // Let the call stack unwind before signaling completion. CefPostTask(TID_UI, - NewCefRunnableMethod(this, &InvalidURLTestClient::CompleteOnUIThread)); + base::Bind(&InvalidURLTestClient::CompleteOnUIThread, this)); } virtual void OnUploadProgress(CefRefPtr request, diff --git a/tests/unittests/v8_unittest.cc b/tests/unittests/v8_unittest.cc index bddfd250c..c054eb693 100644 --- a/tests/unittests/v8_unittest.cc +++ b/tests/unittests/v8_unittest.cc @@ -7,9 +7,10 @@ // Include this first to avoid type conflicts with CEF headers. #include "tests/unittests/chromium_includes.h" -#include "include/cef_runnable.h" +#include "include/base/cef_bind.h" #include "include/cef_task.h" #include "include/cef_v8.h" +#include "include/wrapper/cef_closure_task.h" #include "tests/cefclient/client_app.h" #include "testing/gtest/include/gtest/gtest.h" #include "tests/unittests/test_handler.h" @@ -1816,8 +1817,7 @@ class V8RendererTest : public ClientApp::RenderDelegate, test_context_ = browser_->GetMainFrame()->GetV8Context(); test_object_ = CefV8Value::CreateArray(10); - CefPostTask(TID_RENDERER, - NewCefRunnableMethod(this, &V8RendererTest::DestroyTest)); + CefPostTask(TID_RENDERER, base::Bind(&V8RendererTest::DestroyTest, this)); } } @@ -1861,8 +1861,7 @@ class V8RendererTest : public ClientApp::RenderDelegate, const std::string& message_name = message->GetName(); if (message_name == kV8RunTestMsg) { // Run the test asynchronously. - CefPostTask(TID_RENDERER, - NewCefRunnableMethod(this, &V8RendererTest::RunTest)); + CefPostTask(TID_RENDERER, base::Bind(&V8RendererTest::RunTest, this)); return true; } return false;