Use stricter type checking in UMA_HISTOGRAM_ENUMERATION
Add one more type checking: if |boundary| is enum, |sample| must be
an enum as well.
Common violations:
1) Casting to int for convenience or bitfield: fixed by static_cast'ing.
2) Ranges: use UMA_HISTOGRAM_EXACT_LINEAR instead.
Bug: 661401
TBR: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Id143d15bd66d363d84c2ad2edd6feb5b47fe72ef
Reviewed-on: https://chromium-review.googlesource.com/575428
Commit-Queue: Wei-Yin Chen (陳威尹) <[email protected]>
Reviewed-by: calamity <[email protected]>
Reviewed-by: Olivier Robin <[email protected]>
Reviewed-by: Nicolas Zea <[email protected]>
Reviewed-by: Alexei Svitkine (OOO July28-Aug6) <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Reviewed-by: Mitsuru Oshima <[email protected]>
Reviewed-by: Julia Tuttle <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#490008}
diff --git a/base/metrics/histogram_functions_unittest.cc b/base/metrics/histogram_functions_unittest.cc
index 77a584b..7bfd202e 100644
--- a/base/metrics/histogram_functions_unittest.cc
+++ b/base/metrics/histogram_functions_unittest.cc
@@ -47,7 +47,7 @@
// Verify the overflow & underflow bucket exists.
UMA_HISTOGRAM_ENUMERATION(
histogram, static_cast<int>(UMA_HISTOGRAM_TESTING_ENUM_THIRD) + 10,
- UMA_HISTOGRAM_TESTING_ENUM_THIRD);
+ static_cast<int>(UMA_HISTOGRAM_TESTING_ENUM_THIRD));
tester.ExpectBucketCount(
histogram, static_cast<int>(UMA_HISTOGRAM_TESTING_ENUM_THIRD) + 1, 1);
tester.ExpectTotalCount(histogram, 2);