Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / cc / trees / blocking_task_runner_unittest.cc
blobf837a7ccd4808192fca15c6547cd74e258cf28f9
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"
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h"
12 #include "cc/test/ordered_simple_task_runner.h"
13 #include "testing/gtest/include/gtest/gtest.h"
15 namespace cc {
16 namespace {
18 void TestTask(bool* result) {
19 *result = true;
22 TEST(BlockingTaskRunnerTest, NoCapture) {
23 bool did_run = false;
24 scoped_ptr<BlockingTaskRunner> runner(
25 BlockingTaskRunner::Create(base::ThreadTaskRunnerHandle::Get()));
26 runner->PostTask(FROM_HERE, base::Bind(&TestTask, &did_run));
27 EXPECT_FALSE(did_run);
28 base::RunLoop().RunUntilIdle();
29 EXPECT_TRUE(did_run);
32 TEST(BlockingTaskRunnerTest, Capture) {
33 bool did_run = false;
34 scoped_ptr<BlockingTaskRunner> runner(
35 BlockingTaskRunner::Create(base::ThreadTaskRunnerHandle::Get()));
37 BlockingTaskRunner::CapturePostTasks capture(runner.get());
38 runner->PostTask(FROM_HERE, base::Bind(&TestTask, &did_run));
39 EXPECT_FALSE(did_run);
41 EXPECT_TRUE(did_run);
44 } // namespace
45 } // namespace cc