Replace NewCefRunnable* usage with base::Bind and fix CefCreateClosureTask typo (issue #1336).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1776 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2014-07-15 18:10:40 +00:00
parent 646ae3310f
commit 1a819fe284
22 changed files with 101 additions and 111 deletions

View File

@ -85,7 +85,7 @@
// Create a CefTask that wraps a base::Closure. Can be used in combination with
// CefTaskRunner.
///
CefRefPtr<CefTask> CefCreateClosureRask(const base::Closure& closure);
CefRefPtr<CefTask> CefCreateClosureTask(const base::Closure& closure);
///
// Post a Closure for execution on the specified thread.

View File

@ -28,7 +28,7 @@ class CefClosureTask : public CefTask {
} // namespace
CefRefPtr<CefTask> CefCreateClosureRask(const base::Closure& closure) {
CefRefPtr<CefTask> CefCreateClosureTask(const base::Closure& closure) {
return new CefClosureTask(closure);
}

View File

@ -7,9 +7,10 @@
#include <map>
#include <set>
#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,
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,8 +492,7 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide {
if (!CefCurrentlyOn(TID_UI)) {
// Must execute on the UI thread.
CefPostTask(TID_UI,
NewCefRunnableMethod(this,
&CefMessageRouterBrowserSideImpl::CancelPendingFor,
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));
}

View File

@ -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<CefCookieManager> 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<CefCookieManager> manager,
void DeleteCookies(CefRefPtr<CefCookieManager> 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<CefCookieManager> manager,
// Delete all system cookies.
void DeleteAllCookies(CefRefPtr<CefCookieManager> 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();
}

View File

@ -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);
}

View File

@ -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"

View File

@ -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;

View File

@ -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;

View File

@ -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() {

View File

@ -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));
}
}

View File

@ -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,7 +1931,7 @@ class BrowseNavTestHandler : public TestHandler {
// Time out the test after a reasonable period of time.
CefPostDelayedTask(TID_UI,
NewCefRunnableMethod(this, &BrowseNavTestHandler::DestroyTest),
base::Bind(&BrowseNavTestHandler::DestroyTest, this),
2000);
}

View File

@ -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() {

View File

@ -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,

View File

@ -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,

View File

@ -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,8 +493,7 @@ 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),
CefPostDelayedTask(TID_UI, base::Bind(&TypeTestHandler::DestroyTest, this),
2000);
}
@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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
}

View File

@ -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<CefTaskRunner> task_runner) {
base::WaitableEvent event(true, false);
task_runner->PostTask(NewCefRunnableFunction(&NotifyEvent, &event));
task_runner->PostTask(CefCreateClosureTask(base::Bind(&NotifyEvent, &event)));
event.Wait();
}

View File

@ -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();

View File

@ -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<CefURLRequest> request,

View File

@ -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;