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

Side by Side Diff: mojo/common/task_tracker_unittest.cc

Issue 1426843004: Remove the task tracking stuff in the bindings. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « mojo/common/task_tracker.cc ('k') | mojo/environment/BUILD.gn » ('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 2015 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 "mojo/common/task_tracker.h"
6
7 #include "base/tracked_objects.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace mojo {
11 namespace common {
12 namespace test {
13
14 class TaskTrackerTest : public testing::Test {
15 public:
16 void SetUp() override {
17 tracked_objects::ThreadData::InitializeAndSetTrackingStatus(
18 tracked_objects::ThreadData::PROFILING_ACTIVE);
19 }
20
21 void TearDown() override {
22 tracked_objects::ThreadData::InitializeAndSetTrackingStatus(
23 tracked_objects::ThreadData::DEACTIVATED);
24 }
25 };
26
27 TEST_F(TaskTrackerTest, Nesting) {
28 intptr_t id0 = TaskTracker::StartTracking("Foo", "foo.cc", 1, nullptr);
29 intptr_t id1 = TaskTracker::StartTracking("Bar", "bar.cc", 1, nullptr);
30 TaskTracker::EndTracking(id1);
31 TaskTracker::EndTracking(id0);
32
33 tracked_objects::ProcessDataSnapshot snapshot;
34 tracked_objects::ThreadData::Snapshot(0, &snapshot);
35
36 // Nested one is ignored.
37 EXPECT_EQ(1U, snapshot.phased_snapshots[0].tasks.size());
38 }
39
40 TEST_F(TaskTrackerTest, Twice) {
41 intptr_t id0 = TaskTracker::StartTracking("Foo", "foo.cc", 1, nullptr);
42 TaskTracker::EndTracking(id0);
43 intptr_t id1 = TaskTracker::StartTracking("Bar", "bar.cc", 1, nullptr);
44 TaskTracker::EndTracking(id1);
45
46 tracked_objects::ProcessDataSnapshot snapshot;
47 tracked_objects::ThreadData::Snapshot(0, &snapshot);
48
49 EXPECT_EQ(2U, snapshot.phased_snapshots[0].tasks.size());
50 }
51
52 } // namespace test
53 } // namespace common
54 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/common/task_tracker.cc ('k') | mojo/environment/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698