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

Side by Side Diff: base/tracked_objects_unittest.cc

Issue 9818004: Cleanup: Replace 'DurationInt' with int32, and always use 32-bit integers for tracking time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months 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 | Annotate | Revision Log
« base/profiler/tracked_time.h ('K') | « base/tracked_objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« base/profiler/tracked_time.h ('K') | « base/tracked_objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698