Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: cc/trees/blocking_task_runner_unittest.cc

Issue 485043003: cc: Use correct message loop proxy in BlockingTaskRunner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/trees/blocking_task_runner.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "cc/trees/blocking_task_runner.h"
6
7 #include "base/bind.h"
8 #include "base/run_loop.h"
9 #include "cc/test/ordered_simple_task_runner.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace cc {
13 namespace {
14
15 void TestTask(bool* result) {
16 *result = true;
17 }
18
19 TEST(BlockingTaskRunnerTest, NoCapture) {
20 bool did_run = false;
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();
26 EXPECT_TRUE(did_run);
27 }
28
29 TEST(BlockingTaskRunnerTest, Capture) {
30 bool did_run = false;
31 scoped_ptr<BlockingTaskRunner> runner(
32 BlockingTaskRunner::Create(base::MessageLoopProxy::current()));
33 {
34 BlockingTaskRunner::CapturePostTasks capture(runner.get());
35 runner->PostTask(FROM_HERE, base::Bind(&TestTask, &did_run));
36 EXPECT_FALSE(did_run);
37 }
38 EXPECT_TRUE(did_run);
39 }
40
41 } // namespace
42 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/blocking_task_runner.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698