OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/common/task_tracker.h" | 5 #include "mojo/common/task_tracker.h" |
6 | 6 |
7 #include "base/tracked_objects.h" | 7 #include "base/tracked_objects.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
(...skipping 16 matching lines...) Expand all Loading... |
27 TEST_F(TaskTrackerTest, Nesting) { | 27 TEST_F(TaskTrackerTest, Nesting) { |
28 intptr_t id0 = TaskTracker::StartTracking("Foo", "foo.cc", 1, nullptr); | 28 intptr_t id0 = TaskTracker::StartTracking("Foo", "foo.cc", 1, nullptr); |
29 intptr_t id1 = TaskTracker::StartTracking("Bar", "bar.cc", 1, nullptr); | 29 intptr_t id1 = TaskTracker::StartTracking("Bar", "bar.cc", 1, nullptr); |
30 TaskTracker::EndTracking(id1); | 30 TaskTracker::EndTracking(id1); |
31 TaskTracker::EndTracking(id0); | 31 TaskTracker::EndTracking(id0); |
32 | 32 |
33 tracked_objects::ProcessDataSnapshot snapshot; | 33 tracked_objects::ProcessDataSnapshot snapshot; |
34 tracked_objects::ThreadData::Snapshot(&snapshot); | 34 tracked_objects::ThreadData::Snapshot(&snapshot); |
35 | 35 |
36 // Nested one is ignored. | 36 // Nested one is ignored. |
37 EXPECT_EQ(1U, snapshot.tasks.size()); | 37 EXPECT_EQ(1U, snapshot.phased_process_data_snapshots[0].tasks.size()); |
38 } | 38 } |
39 | 39 |
40 TEST_F(TaskTrackerTest, Twice) { | 40 TEST_F(TaskTrackerTest, Twice) { |
41 intptr_t id0 = TaskTracker::StartTracking("Foo", "foo.cc", 1, nullptr); | 41 intptr_t id0 = TaskTracker::StartTracking("Foo", "foo.cc", 1, nullptr); |
42 TaskTracker::EndTracking(id0); | 42 TaskTracker::EndTracking(id0); |
43 intptr_t id1 = TaskTracker::StartTracking("Bar", "bar.cc", 1, nullptr); | 43 intptr_t id1 = TaskTracker::StartTracking("Bar", "bar.cc", 1, nullptr); |
44 TaskTracker::EndTracking(id1); | 44 TaskTracker::EndTracking(id1); |
45 | 45 |
46 tracked_objects::ProcessDataSnapshot snapshot; | 46 tracked_objects::ProcessDataSnapshot snapshot; |
47 tracked_objects::ThreadData::Snapshot(&snapshot); | 47 tracked_objects::ThreadData::Snapshot(&snapshot); |
48 | 48 |
49 EXPECT_EQ(2U, snapshot.tasks.size()); | 49 EXPECT_EQ(2U, snapshot.phased_process_data_snapshots[0].tasks.size()); |
50 } | 50 } |
51 | 51 |
52 } // namespace test | 52 } // namespace test |
53 } // namespace common | 53 } // namespace common |
54 } // namespace mojo | 54 } // namespace mojo |
OLD | NEW |