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

Unified Diff: base/metrics/histogram_unittest.nc

Issue 2891613002: Add no-compile test for UmaHistogramEnumeration (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_unittest.nc
diff --git a/base/metrics/histogram_unittest.nc b/base/metrics/histogram_unittest.nc
index 6f913e89f1475ca2dfa3a94317eaea2db9f7a674..ed67854afdeb06ffd0c42f6462eea10311838f5b 100644
--- a/base/metrics/histogram_unittest.nc
+++ b/base/metrics/histogram_unittest.nc
@@ -5,6 +5,7 @@
// This is a "No Compile Test" suite.
// http://dev.chromium.org/developers/testing/no-compile-tests
+#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
namespace base {
@@ -33,6 +34,34 @@ void WontCompile() {
UMA_HISTOGRAM_ENUMERATION("", TypeA::A, TypeA::A);
}
+#elif defined(NCTEST_FUNCTION_INT) // [r"Non enum passed to UmaHistogramEnumeration"]
+
+void WontCompile() {
+ UmaHistogramEnumeration("", 1, 2);
+}
+
+#elif defined(NCTEST_FUNCTION_DIFFERENT_ENUM) // [r"no matching function for call to 'UmaHistogramEnumeration'"]
+
+void WontCompile() {
+ enum TypeA { A };
+ enum TypeB { B };
+ UmaHistogramEnumeration("", A, B);
+}
+
+#elif defined(NCTEST_FUNCTION_FIRST_NOT_ENUM) // [r"no matching function for call to 'UmaHistogramEnumeration'"]
+
+void WontCompile() {
+ enum TypeB { B };
+ UmaHistogramEnumeration("", 1, B);
+}
+
+#elif defined(NCTEST_FUNCTION_SECOND_NOT_ENUM) // [r"no matching function for call to 'UmaHistogramEnumeration'"]
+
+void WontCompile() {
+ enum TypeA { A };
+ UmaHistogramEnumeration("", A, 2);
+}
+
#endif
} // namespace base
« 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