OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Test of classes in the tracked_objects.h classes. | 5 // Test of classes in the tracked_objects.h classes. |
6 | 6 |
7 #include "base/tracked_objects.h" | 7 #include "base/tracked_objects.h" |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace tracked_objects { | 12 namespace tracked_objects { |
13 | 13 |
14 class TrackedObjectsTest : public testing::Test { | 14 class TrackedObjectsTest : public testing::Test { |
15 public: | 15 public: |
| 16 TrackedObjectsTest() : message_loop_("TrackedObjectsTest") { } |
16 MessageLoop message_loop_; | 17 MessageLoop message_loop_; |
17 }; | 18 }; |
18 | 19 |
19 TEST_F(TrackedObjectsTest, MinimalStartupShutdown) { | 20 TEST_F(TrackedObjectsTest, MinimalStartupShutdown) { |
20 // Minimal test doesn't even create any tasks. | 21 // Minimal test doesn't even create any tasks. |
21 if (!ThreadData::StartTracking(true)) | 22 if (!ThreadData::StartTracking(true)) |
22 return; | 23 return; |
23 | 24 |
24 EXPECT_FALSE(ThreadData::first()); // No activity even on this thread. | 25 EXPECT_FALSE(ThreadData::first()); // No activity even on this thread. |
25 ThreadData* data = ThreadData::current(); | 26 ThreadData* data = ThreadData::current(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 EXPECT_EQ(1u, death_map.size()); // 1 location. | 92 EXPECT_EQ(1u, death_map.size()); // 1 location. |
92 EXPECT_EQ(1, death_map.begin()->second.count()); // 1 death. | 93 EXPECT_EQ(1, death_map.begin()->second.count()); // 1 death. |
93 | 94 |
94 // The births were at the same location as the one known death. | 95 // The births were at the same location as the one known death. |
95 EXPECT_EQ(birth_map.begin()->second, death_map.begin()->first); | 96 EXPECT_EQ(birth_map.begin()->second, death_map.begin()->first); |
96 | 97 |
97 ThreadData::ShutdownSingleThreadedCleanup(); | 98 ThreadData::ShutdownSingleThreadedCleanup(); |
98 } | 99 } |
99 | 100 |
100 } // namespace tracked_objects | 101 } // namespace tracked_objects |
OLD | NEW |