1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/trees/blocking_task_runner.h"
8 #include "base/run_loop.h"
9 #include "cc/test/ordered_simple_task_runner.h"
10 #include "testing/gtest/include/gtest/gtest.h"
15 void TestTask(bool* result
) {
19 TEST(BlockingTaskRunnerTest
, NoCapture
) {
21 scoped_ptr
<BlockingTaskRunner
> runner(
22 BlockingTaskRunner::Create(base::MessageLoopProxy::current()));
23 runner
->PostTask(FROM_HERE
, base::Bind(&TestTask
, &did_run
));
24 EXPECT_FALSE(did_run
);
25 base::RunLoop().RunUntilIdle();
29 TEST(BlockingTaskRunnerTest
, Capture
) {
31 scoped_ptr
<BlockingTaskRunner
> runner(
32 BlockingTaskRunner::Create(base::MessageLoopProxy::current()));
34 BlockingTaskRunner::CapturePostTasks
capture(runner
.get());
35 runner
->PostTask(FROM_HERE
, base::Bind(&TestTask
, &did_run
));
36 EXPECT_FALSE(did_run
);