OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 13 matching lines...) Expand all Loading... |
24 namespace tracked_objects { | 24 namespace tracked_objects { |
25 | 25 |
26 class TrackedObjectsTest : public testing::Test { | 26 class TrackedObjectsTest : public testing::Test { |
27 protected: | 27 protected: |
28 TrackedObjectsTest() { | 28 TrackedObjectsTest() { |
29 // On entry, leak any database structures in case they are still in use by | 29 // On entry, leak any database structures in case they are still in use by |
30 // prior threads. | 30 // prior threads. |
31 ThreadData::ShutdownSingleThreadedCleanup(true); | 31 ThreadData::ShutdownSingleThreadedCleanup(true); |
32 | 32 |
33 test_time_ = 0; | 33 test_time_ = 0; |
34 ThreadData::SetAlternateTimeSource(&TrackedObjectsTest::GetTestTime); | 34 ThreadData::now_function_for_testing_ = &TrackedObjectsTest::GetTestTime; |
35 ThreadData::now_function_is_time_ = true; | |
36 } | 35 } |
37 | 36 |
38 ~TrackedObjectsTest() override { | 37 ~TrackedObjectsTest() override { |
39 // We should not need to leak any structures we create, since we are | 38 // We should not need to leak any structures we create, since we are |
40 // single threaded, and carefully accounting for items. | 39 // single threaded, and carefully accounting for items. |
41 ThreadData::ShutdownSingleThreadedCleanup(false); | 40 ThreadData::ShutdownSingleThreadedCleanup(false); |
42 } | 41 } |
43 | 42 |
44 // Reset the profiler state. | 43 // Reset the profiler state. |
45 void Reset() { | 44 void Reset() { |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 EXPECT_EQ(2, process_data_phase.tasks[t1].death_data.run_duration_max); | 1177 EXPECT_EQ(2, process_data_phase.tasks[t1].death_data.run_duration_max); |
1179 EXPECT_EQ(2, process_data_phase.tasks[t1].death_data.run_duration_sample); | 1178 EXPECT_EQ(2, process_data_phase.tasks[t1].death_data.run_duration_sample); |
1180 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_sum); | 1179 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_sum); |
1181 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_max); | 1180 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_max); |
1182 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_sample); | 1181 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_sample); |
1183 EXPECT_EQ(kMainThreadName, process_data_phase.tasks[t1].death_thread_name); | 1182 EXPECT_EQ(kMainThreadName, process_data_phase.tasks[t1].death_thread_name); |
1184 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id); | 1183 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id); |
1185 } | 1184 } |
1186 | 1185 |
1187 } // namespace tracked_objects | 1186 } // namespace tracked_objects |
OLD | NEW |