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 395ef8f053a7fd46d4a7659c1a84038cc216c5bc..e825e672b13e08a64f88626dd333feb1c5464cd0 100644 |
--- a/components/metrics/call_stack_profile_metrics_provider_unittest.cc |
+++ b/components/metrics/call_stack_profile_metrics_provider_unittest.cc |
@@ -63,47 +63,37 @@ TEST_F(CallStackProfileMetricsProviderTest, MultipleProfiles) { |
const uintptr_t module3_base_address = 0x3000; |
const Module profile_modules[][2] = { |
- { |
- Module( |
- reinterpret_cast<const void*>(module1_base_address), |
- "ABCD", |
+ { |
Mike Wittman
2015/09/03 16:58:04
Please undo reformatting (see "git cl format" comm
sydli
2015/09/03 17:18:13
Gotcha. Unreformatted.
|
+ Module(module1_base_address, "ABCD", |
#if defined(OS_WIN) |
- base::FilePath(L"c:\\some\\path\\to\\chrome.exe") |
+ base::FilePath(L"c:\\some\\path\\to\\chrome.exe") |
#else |
- base::FilePath("/some/path/to/chrome") |
+ base::FilePath("/some/path/to/chrome") |
#endif |
- ), |
- Module( |
- reinterpret_cast<const void*>(module2_base_address), |
- "EFGH", |
+ ), |
+ Module(module2_base_address, "EFGH", |
#if defined(OS_WIN) |
- base::FilePath(L"c:\\some\\path\\to\\third_party.dll") |
+ base::FilePath(L"c:\\some\\path\\to\\third_party.dll") |
#else |
- base::FilePath("/some/path/to/third_party.so") |
+ base::FilePath("/some/path/to/third_party.so") |
#endif |
- ), |
- }, |
- { |
- Module( |
- reinterpret_cast<const void*>(module3_base_address), |
- "MNOP", |
+ ), |
+ }, |
+ {Module(module3_base_address, "MNOP", |
#if defined(OS_WIN) |
- base::FilePath(L"c:\\some\\path\\to\\third_party2.dll") |
+ base::FilePath(L"c:\\some\\path\\to\\third_party2.dll") |
#else |
- base::FilePath("/some/path/to/third_party2.so") |
+ base::FilePath("/some/path/to/third_party2.so") |
#endif |
- ), |
- Module( // Repeated from the first profile. |
- reinterpret_cast<const void*>(module1_base_address), |
- "ABCD", |
+ ), |
+ Module( // Repeated from the first profile. |
+ module1_base_address, "ABCD", |
#if defined(OS_WIN) |
- base::FilePath(L"c:\\some\\path\\to\\chrome.exe") |
+ base::FilePath(L"c:\\some\\path\\to\\chrome.exe") |
#else |
- base::FilePath("/some/path/to/chrome") |
+ base::FilePath("/some/path/to/chrome") |
#endif |
- ) |
- } |
- }; |
+ )}}; |
// Values for Windows generated with: |
// perl -MDigest::MD5=md5 -MEncode=encode |
@@ -145,31 +135,18 @@ TEST_F(CallStackProfileMetricsProviderTest, MultipleProfiles) { |
// at an offset of 0x20 from the module's base address, and the bottom frame |
// in module 0 at an offset of 0x30 from the module's base address |
const Frame profile_sample_frames[][2][3] = { |
- { |
- { |
- Frame(reinterpret_cast<const void*>(module1_base_address + 0x10), 0), |
- Frame(reinterpret_cast<const void*>(module2_base_address + 0x20), 1), |
- Frame(reinterpret_cast<const void*>(module1_base_address + 0x30), 0) |
- }, |
- { |
- Frame(reinterpret_cast<const void*>(module2_base_address + 0x10), 1), |
- Frame(reinterpret_cast<const void*>(module1_base_address + 0x20), 0), |
- Frame(reinterpret_cast<const void*>(module2_base_address + 0x30), 1) |
- } |
- }, |
- { |
- { |
- Frame(reinterpret_cast<const void*>(module3_base_address + 0x10), 0), |
- Frame(reinterpret_cast<const void*>(module1_base_address + 0x20), 1), |
- Frame(reinterpret_cast<const void*>(module3_base_address + 0x30), 0) |
- }, |
- { |
- Frame(reinterpret_cast<const void*>(module1_base_address + 0x10), 1), |
- Frame(reinterpret_cast<const void*>(module3_base_address + 0x20), 0), |
- Frame(reinterpret_cast<const void*>(module1_base_address + 0x30), 1) |
- } |
- } |
- }; |
+ {{Frame(module1_base_address + 0x10, 0), |
Mike Wittman
2015/09/03 16:58:04
Please undo reformatting.
|
+ Frame(module2_base_address + 0x20, 1), |
+ Frame(module1_base_address + 0x30, 0)}, |
+ {Frame(module2_base_address + 0x10, 1), |
+ Frame(module1_base_address + 0x20, 0), |
+ Frame(module2_base_address + 0x30, 1)}}, |
+ {{Frame(module3_base_address + 0x10, 0), |
+ Frame(module1_base_address + 0x20, 1), |
+ Frame(module3_base_address + 0x30, 0)}, |
+ {Frame(module1_base_address + 0x10, 1), |
+ Frame(module3_base_address + 0x20, 0), |
+ Frame(module1_base_address + 0x30, 1)}}}; |
base::TimeDelta profile_durations[2] = { |
base::TimeDelta::FromMilliseconds(100), |
@@ -276,24 +253,26 @@ TEST_F(CallStackProfileMetricsProviderTest, RepeatedStacksUnordered) { |
const uintptr_t module_base_address = 0x1000; |
const Module modules[] = { |
- Module( |
- reinterpret_cast<const void*>(module_base_address), |
- "ABCD", |
+ Module(module_base_address, "ABCD", |
Mike Wittman
2015/09/03 16:58:04
Please undo reformatting.
|
#if defined(OS_WIN) |
- base::FilePath(L"c:\\some\\path\\to\\chrome.exe") |
+ base::FilePath(L"c:\\some\\path\\to\\chrome.exe") |
#else |
- base::FilePath("/some/path/to/chrome") |
+ base::FilePath("/some/path/to/chrome") |
#endif |
- ) |
+ ) |
}; |
// Duplicate samples in slots 0, 2, and 3. |
- const Frame sample_frames[][1] = { |
- { Frame(reinterpret_cast<const void*>(module_base_address + 0x10), 0), }, |
- { Frame(reinterpret_cast<const void*>(module_base_address + 0x20), 0), }, |
- { Frame(reinterpret_cast<const void*>(module_base_address + 0x10), 0), }, |
- { Frame(reinterpret_cast<const void*>(module_base_address + 0x10), 0) } |
- }; |
+ const Frame sample_frames[][1] = {{ |
Mike Wittman
2015/09/03 16:58:04
Please undo reformatting.
|
+ Frame(module_base_address + 0x10, 0), |
+ }, |
+ { |
+ Frame(module_base_address + 0x20, 0), |
+ }, |
+ { |
+ Frame(module_base_address + 0x10, 0), |
+ }, |
+ {Frame(module_base_address + 0x10, 0)}}; |
Profile profile; |
profile.modules.insert(profile.modules.end(), &modules[0], |
@@ -355,24 +334,26 @@ TEST_F(CallStackProfileMetricsProviderTest, RepeatedStacksOrdered) { |
const uintptr_t module_base_address = 0x1000; |
const Module modules[] = { |
- Module( |
- reinterpret_cast<const void*>(module_base_address), |
- "ABCD", |
+ Module(module_base_address, "ABCD", |
Mike Wittman
2015/09/03 16:58:04
Please undo reformatting.
|
#if defined(OS_WIN) |
- base::FilePath(L"c:\\some\\path\\to\\chrome.exe") |
+ base::FilePath(L"c:\\some\\path\\to\\chrome.exe") |
#else |
- base::FilePath("/some/path/to/chrome") |
+ base::FilePath("/some/path/to/chrome") |
#endif |
- ) |
+ ) |
}; |
// Duplicate samples in slots 0, 2, and 3. |
- const Frame sample_frames[][1] = { |
- { Frame(reinterpret_cast<const void*>(module_base_address + 0x10), 0), }, |
- { Frame(reinterpret_cast<const void*>(module_base_address + 0x20), 0), }, |
- { Frame(reinterpret_cast<const void*>(module_base_address + 0x10), 0), }, |
- { Frame(reinterpret_cast<const void*>(module_base_address + 0x10), 0) } |
- }; |
+ const Frame sample_frames[][1] = {{ |
Mike Wittman
2015/09/03 16:58:04
Please undo reformatting.
|
+ Frame(module_base_address + 0x10, 0), |
+ }, |
+ { |
+ Frame(module_base_address + 0x20, 0), |
+ }, |
+ { |
+ Frame(module_base_address + 0x10, 0), |
+ }, |
+ {Frame(module_base_address + 0x10, 0)}}; |
Profile profile; |
profile.modules.insert(profile.modules.end(), &modules[0], |
@@ -390,9 +371,8 @@ TEST_F(CallStackProfileMetricsProviderTest, RepeatedStacksOrdered) { |
CallStackProfileMetricsProvider provider; |
provider.OnRecordingEnabled(); |
- AppendProfiles( |
- Params(CallStackProfileMetricsProvider::PROCESS_STARTUP, true), |
- std::vector<Profile>(1, profile)); |
+ AppendProfiles(Params(CallStackProfileMetricsProvider::PROCESS_STARTUP, true), |
+ std::vector<Profile>(1, profile)); |
ChromeUserMetricsExtension uma_proto; |
provider.ProvideGeneralMetrics(&uma_proto); |
@@ -430,8 +410,7 @@ TEST_F(CallStackProfileMetricsProviderTest, RepeatedStacksOrdered) { |
// Checks that unknown modules produce an empty Entry. |
TEST_F(CallStackProfileMetricsProviderTest, UnknownModule) { |
- const Frame frame(reinterpret_cast<const void*>(0x1000), |
- Frame::kUnknownModuleIndex); |
+ const Frame frame(0x1000, Frame::kUnknownModuleIndex); |
Profile profile; |
@@ -471,8 +450,8 @@ TEST_F(CallStackProfileMetricsProviderTest, ProfilesProvidedOnlyOnce) { |
CallStackProfileMetricsProvider provider; |
for (int i = 0; i < 2; ++i) { |
Profile profile; |
- profile.samples.push_back(Sample(1, Frame( |
- reinterpret_cast<const void*>(0x1000), Frame::kUnknownModuleIndex))); |
+ profile.samples.push_back( |
+ Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex))); |
profile.profile_duration = base::TimeDelta::FromMilliseconds(100); |
// Use the sampling period to distinguish the two profiles. |
@@ -500,8 +479,8 @@ TEST_F(CallStackProfileMetricsProviderTest, ProfilesProvidedOnlyOnce) { |
TEST_F(CallStackProfileMetricsProviderTest, |
ProfilesProvidedWhenCollectedBeforeInstantiation) { |
Profile profile; |
- profile.samples.push_back(Sample(1, Frame( |
- reinterpret_cast<const void*>(0x1000), Frame::kUnknownModuleIndex))); |
+ profile.samples.push_back( |
+ Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex))); |
profile.profile_duration = base::TimeDelta::FromMilliseconds(100); |
profile.sampling_period = base::TimeDelta::FromMilliseconds(10); |
@@ -522,8 +501,8 @@ TEST_F(CallStackProfileMetricsProviderTest, |
// while recording is disabled. |
TEST_F(CallStackProfileMetricsProviderTest, ProfilesNotProvidedWhileDisabled) { |
Profile profile; |
- profile.samples.push_back(Sample(1, Frame( |
- reinterpret_cast<const void*>(0x1000), Frame::kUnknownModuleIndex))); |
+ profile.samples.push_back( |
+ Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex))); |
profile.profile_duration = base::TimeDelta::FromMilliseconds(100); |
profile.sampling_period = base::TimeDelta::FromMilliseconds(10); |
@@ -544,8 +523,8 @@ TEST_F(CallStackProfileMetricsProviderTest, ProfilesNotProvidedWhileDisabled) { |
TEST_F(CallStackProfileMetricsProviderTest, |
ProfilesNotProvidedAfterChangeToDisabled) { |
Profile profile; |
- profile.samples.push_back(Sample(1, Frame( |
- reinterpret_cast<const void*>(0x1000), Frame::kUnknownModuleIndex))); |
+ profile.samples.push_back( |
+ Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex))); |
profile.profile_duration = base::TimeDelta::FromMilliseconds(100); |
profile.sampling_period = base::TimeDelta::FromMilliseconds(10); |
@@ -569,8 +548,8 @@ TEST_F(CallStackProfileMetricsProviderTest, |
TEST_F(CallStackProfileMetricsProviderTest, |
ProfilesNotProvidedAfterChangeToDisabledThenEnabled) { |
Profile profile; |
- profile.samples.push_back(Sample(1, Frame( |
- reinterpret_cast<const void*>(0x1000), Frame::kUnknownModuleIndex))); |
+ profile.samples.push_back( |
+ Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex))); |
profile.profile_duration = base::TimeDelta::FromMilliseconds(100); |
profile.sampling_period = base::TimeDelta::FromMilliseconds(10); |
@@ -595,8 +574,8 @@ TEST_F(CallStackProfileMetricsProviderTest, |
TEST_F(CallStackProfileMetricsProviderTest, |
ProfilesNotProvidedAfterChangeFromDisabled) { |
Profile profile; |
- profile.samples.push_back(Sample(1, Frame( |
- reinterpret_cast<const void*>(0x1000), Frame::kUnknownModuleIndex))); |
+ profile.samples.push_back( |
+ Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex))); |
profile.profile_duration = base::TimeDelta::FromMilliseconds(100); |
profile.sampling_period = base::TimeDelta::FromMilliseconds(10); |