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 "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return; | 220 return; |
221 | 221 |
222 scoped_ptr<DeathData> data(new DeathData()); | 222 scoped_ptr<DeathData> data(new DeathData()); |
223 ASSERT_NE(data, reinterpret_cast<DeathData*>(NULL)); | 223 ASSERT_NE(data, reinterpret_cast<DeathData*>(NULL)); |
224 EXPECT_EQ(data->run_duration_sum(), 0); | 224 EXPECT_EQ(data->run_duration_sum(), 0); |
225 EXPECT_EQ(data->run_duration_sample(), 0); | 225 EXPECT_EQ(data->run_duration_sample(), 0); |
226 EXPECT_EQ(data->queue_duration_sum(), 0); | 226 EXPECT_EQ(data->queue_duration_sum(), 0); |
227 EXPECT_EQ(data->queue_duration_sample(), 0); | 227 EXPECT_EQ(data->queue_duration_sample(), 0); |
228 EXPECT_EQ(data->count(), 0); | 228 EXPECT_EQ(data->count(), 0); |
229 | 229 |
230 DurationInt run_ms = 42; | 230 int32 run_ms = 42; |
231 DurationInt queue_ms = 8; | 231 int32 queue_ms = 8; |
232 | 232 |
233 const int kUnrandomInt = 0; // Fake random int that ensure we sample data. | 233 const int kUnrandomInt = 0; // Fake random int that ensure we sample data. |
234 data->RecordDeath(queue_ms, run_ms, kUnrandomInt); | 234 data->RecordDeath(queue_ms, run_ms, kUnrandomInt); |
235 EXPECT_EQ(data->run_duration_sum(), run_ms); | 235 EXPECT_EQ(data->run_duration_sum(), run_ms); |
236 EXPECT_EQ(data->run_duration_sample(), run_ms); | 236 EXPECT_EQ(data->run_duration_sample(), run_ms); |
237 EXPECT_EQ(data->queue_duration_sum(), queue_ms); | 237 EXPECT_EQ(data->queue_duration_sum(), queue_ms); |
238 EXPECT_EQ(data->queue_duration_sample(), queue_ms); | 238 EXPECT_EQ(data->queue_duration_sample(), queue_ms); |
239 EXPECT_EQ(data->count(), 1); | 239 EXPECT_EQ(data->count(), 1); |
240 | 240 |
241 data->RecordDeath(queue_ms, run_ms, kUnrandomInt); | 241 data->RecordDeath(queue_ms, run_ms, kUnrandomInt); |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 "\"line_number\":999" | 813 "\"line_number\":999" |
814 "}" | 814 "}" |
815 "}" | 815 "}" |
816 "]" | 816 "]" |
817 "}"; | 817 "}"; |
818 EXPECT_EQ(one_line_result, json); | 818 EXPECT_EQ(one_line_result, json); |
819 } | 819 } |
820 | 820 |
821 | 821 |
822 } // namespace tracked_objects | 822 } // namespace tracked_objects |
OLD | NEW |