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

Side by Side Diff: base/tracked_objects_unittest.cc

Issue 10071030: Fix timings in TrackedObjects unit test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | 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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 ThreadData::ParentChildSet parent_child_set; 150 ThreadData::ParentChildSet parent_child_set;
151 data->SnapshotMaps(false, &birth_map, &death_map, &parent_child_set); 151 data->SnapshotMaps(false, &birth_map, &death_map, &parent_child_set);
152 EXPECT_EQ(1u, birth_map.size()); // 1 birth location. 152 EXPECT_EQ(1u, birth_map.size()); // 1 birth location.
153 EXPECT_EQ(1, birth_map.begin()->second->birth_count()); // 1 birth. 153 EXPECT_EQ(1, birth_map.begin()->second->birth_count()); // 1 birth.
154 EXPECT_EQ(0u, death_map.size()); // No deaths. 154 EXPECT_EQ(0u, death_map.size()); // No deaths.
155 EXPECT_EQ(0u, parent_child_set.size()); // No children. 155 EXPECT_EQ(0u, parent_child_set.size()); // No children.
156 156
157 157
158 // Now instigate another birth, while we are timing the run of the first 158 // Now instigate another birth, while we are timing the run of the first
159 // execution. 159 // execution.
160 TrackedTime start_time = ThreadData::NowForStartOfRun(first_birth); 160 ThreadData::NowForStartOfRun(first_birth);
161 // Create a child (using the same birth location). 161 // Create a child (using the same birth location).
162 // TrackingInfo will call TallyABirth() during construction. 162 // TrackingInfo will call TallyABirth() during construction.
163 base::TimeTicks kBogusBirthTime; 163 base::TimeTicks kBogusBirthTime;
164 base::TrackingInfo pending_task(location, kBogusBirthTime); 164 base::TrackingInfo pending_task(location, kBogusBirthTime);
165 TrackedTime start_time(pending_task.time_posted);
165 // Finally conclude the outer run. 166 // Finally conclude the outer run.
166 TrackedTime end_time = ThreadData::NowForEndOfRun(); 167 TrackedTime end_time = ThreadData::NowForEndOfRun();
167 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, start_time, 168 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, start_time,
168 end_time); 169 end_time);
169 170
170 birth_map.clear(); 171 birth_map.clear();
171 death_map.clear(); 172 death_map.clear();
172 parent_child_set.clear(); 173 parent_child_set.clear();
173 data->SnapshotMaps(false, &birth_map, &death_map, &parent_child_set); 174 data->SnapshotMaps(false, &birth_map, &death_map, &parent_child_set);
174 EXPECT_EQ(1u, birth_map.size()); // 1 birth location. 175 EXPECT_EQ(1u, birth_map.size()); // 1 birth location.
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 EXPECT_EQ(0, process_data.tasks[1].death_data.run_duration_sample); 572 EXPECT_EQ(0, process_data.tasks[1].death_data.run_duration_sample);
572 EXPECT_EQ(0, process_data.tasks[1].death_data.queue_duration_sum); 573 EXPECT_EQ(0, process_data.tasks[1].death_data.queue_duration_sum);
573 EXPECT_EQ(0, process_data.tasks[1].death_data.queue_duration_max); 574 EXPECT_EQ(0, process_data.tasks[1].death_data.queue_duration_max);
574 EXPECT_EQ(0, process_data.tasks[1].death_data.queue_duration_sample); 575 EXPECT_EQ(0, process_data.tasks[1].death_data.queue_duration_sample);
575 EXPECT_EQ(kStillAlive, process_data.tasks[1].death_thread_name); 576 EXPECT_EQ(kStillAlive, process_data.tasks[1].death_thread_name);
576 EXPECT_EQ(0u, process_data.descendants.size()); 577 EXPECT_EQ(0u, process_data.descendants.size());
577 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id); 578 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
578 } 579 }
579 580
580 } // namespace tracked_objects 581 } // namespace tracked_objects
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698