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

Unified Diff: components/metrics/call_stack_profile_metrics_provider_unittest.cc

Issue 2444143002: Add process lifetime annotations to stack samples. (Closed)
Patch Set: use bare function-pointer callback; added test Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/metrics/call_stack_profile_metrics_provider_unittest.cc
diff --git a/components/metrics/call_stack_profile_metrics_provider_unittest.cc b/components/metrics/call_stack_profile_metrics_provider_unittest.cc
index 3e515b5c2db336cc09e2b1cbf66d5e4437cfa6af..c0b2e2c20c87c63c0cadffe47b339c1573698ab7 100644
--- a/components/metrics/call_stack_profile_metrics_provider_unittest.cc
+++ b/components/metrics/call_stack_profile_metrics_provider_unittest.cc
@@ -193,9 +193,9 @@ TEST_F(CallStackProfileMetricsProviderTest, MultipleProfiles) {
for (size_t j = 0; j < arraysize(profile_sample_frames[i]); ++j) {
profile.samples.push_back(Sample());
Sample& sample = profile.samples.back();
- sample.insert(sample.end(), &profile_sample_frames[i][j][0],
- &profile_sample_frames[i][j][0] +
- arraysize(profile_sample_frames[i][j]));
+ sample.frames.insert(sample.frames.end(), &profile_sample_frames[i][j][0],
+ &profile_sample_frames[i][j][0] +
+ arraysize(profile_sample_frames[i][j]));
}
profile.profile_duration = profile_durations[i];
@@ -312,8 +312,8 @@ TEST_F(CallStackProfileMetricsProviderTest, RepeatedStacksUnordered) {
for (size_t i = 0; i < arraysize(sample_frames); ++i) {
profile.samples.push_back(Sample());
Sample& sample = profile.samples.back();
- sample.insert(sample.end(), &sample_frames[i][0],
- &sample_frames[i][0] + arraysize(sample_frames[i]));
+ sample.frames.insert(sample.frames.end(), &sample_frames[i][0],
+ &sample_frames[i][0] + arraysize(sample_frames[i]));
}
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
@@ -397,8 +397,8 @@ TEST_F(CallStackProfileMetricsProviderTest, RepeatedStacksOrdered) {
for (size_t i = 0; i < arraysize(sample_frames); ++i) {
profile.samples.push_back(Sample());
Sample& sample = profile.samples.back();
- sample.insert(sample.end(), &sample_frames[i][0],
- &sample_frames[i][0] + arraysize(sample_frames[i]));
+ sample.frames.insert(sample.frames.end(), &sample_frames[i][0],
+ &sample_frames[i][0] + arraysize(sample_frames[i]));
}
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
@@ -451,12 +451,8 @@ TEST_F(CallStackProfileMetricsProviderTest, RepeatedStacksOrdered) {
// Checks that unknown modules produce an empty Entry.
TEST_F(CallStackProfileMetricsProviderTest, UnknownModule) {
- const Frame frame(0x1000, Frame::kUnknownModuleIndex);
-
Profile profile;
-
- profile.samples.push_back(Sample(1, frame));
-
+ profile.samples.push_back(Sample(Frame(0x1000, Frame::kUnknownModuleIndex)));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);
Profiles profiles;
@@ -497,7 +493,7 @@ TEST_F(CallStackProfileMetricsProviderTest, ProfilesProvidedOnlyOnce) {
for (int i = 0; i < 2; ++i) {
Profile profile;
profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
+ Sample((Frame(0x1000, Frame::kUnknownModuleIndex))));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
// Use the sampling period to distinguish the two profiles.
@@ -530,9 +526,7 @@ TEST_F(CallStackProfileMetricsProviderTest, ProfilesProvidedOnlyOnce) {
TEST_F(CallStackProfileMetricsProviderTest,
ProfilesProvidedWhenCollectedBeforeInstantiation) {
Profile profile;
- profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
-
+ profile.samples.push_back(Sample(Frame(0x1000, Frame::kUnknownModuleIndex)));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);
Profiles profiles;
@@ -557,9 +551,7 @@ TEST_F(CallStackProfileMetricsProviderTest,
// while recording is disabled.
TEST_F(CallStackProfileMetricsProviderTest, ProfilesNotProvidedWhileDisabled) {
Profile profile;
- profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
-
+ profile.samples.push_back(Sample(Frame(0x1000, Frame::kUnknownModuleIndex)));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);
Profiles profiles;
@@ -584,9 +576,7 @@ TEST_F(CallStackProfileMetricsProviderTest, ProfilesNotProvidedWhileDisabled) {
TEST_F(CallStackProfileMetricsProviderTest,
ProfilesNotProvidedAfterChangeToDisabled) {
Profile profile;
- profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
-
+ profile.samples.push_back(Sample(Frame(0x1000, Frame::kUnknownModuleIndex)));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);
@@ -614,9 +604,7 @@ TEST_F(CallStackProfileMetricsProviderTest,
TEST_F(CallStackProfileMetricsProviderTest,
ProfilesNotProvidedAfterChangeToDisabledThenEnabled) {
Profile profile;
- profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
-
+ profile.samples.push_back(Sample(Frame(0x1000, Frame::kUnknownModuleIndex)));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);
@@ -645,9 +633,7 @@ TEST_F(CallStackProfileMetricsProviderTest,
TEST_F(CallStackProfileMetricsProviderTest,
ProfilesNotProvidedAfterChangeFromDisabled) {
Profile profile;
- profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
-
+ profile.samples.push_back(Sample(Frame(0x1000, Frame::kUnknownModuleIndex)));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);

Powered by Google App Engine
This is Rietveld 408576698