Roll src/third_party/WebKit 5bc05e9:3d59927 (svn 202625:202627)
[chromium-blink-merge.git] / base / debug / task_annotator_unittest.cc
blob9f5c442327e0bf1a8698dfc1efcb1b75fb7921ad
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 "base/debug/task_annotator.h"
6 #include "base/bind.h"
7 #include "base/pending_task.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace base {
11 namespace debug {
12 namespace {
14 void TestTask(int* result) {
15 *result = 123;
18 } // namespace
20 TEST(TaskAnnotatorTest, QueueAndRunTask) {
21 int result = 0;
22 PendingTask pending_task(FROM_HERE, Bind(&TestTask, &result));
24 TaskAnnotator annotator;
25 annotator.DidQueueTask("TaskAnnotatorTest::Queue", pending_task);
26 EXPECT_EQ(0, result);
27 annotator.RunTask("TaskAnnotatorTest::Queue", pending_task);
28 EXPECT_EQ(123, result);
31 } // namespace debug
32 } // namespace base