summaryrefslogtreecommitdiff
path: root/tools/stats_log_api_gen/test_collation.cpp
diff options
context:
space:
mode:
authorAndrei Onea <andreionea@google.com>2019-01-30 15:28:36 +0000
committerAndrei Onea <andreionea@google.com>2019-02-06 18:55:06 +0000
commitda01ea5b1cf324ca4d083696618131c5ba1c0cee (patch)
tree3175aec8e374c4f59b15e656f0ef5afdd9db90f0 /tools/stats_log_api_gen/test_collation.cpp
parent72be7c2a2f200a94435f6edd9c4c5be6e5185f50 (diff)
Add whitelist atom field option
Whitelisted atoms can be triggered from any source Test: stats-log-api-gen-test Bug: 119217680 Change-Id: Ia5faed04d696b59ba4ffaab13f5046f943d8a8b7
Diffstat (limited to 'tools/stats_log_api_gen/test_collation.cpp')
-rw-r--r--tools/stats_log_api_gen/test_collation.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/stats_log_api_gen/test_collation.cpp b/tools/stats_log_api_gen/test_collation.cpp
index ad3bffacd442..dc585c1c5dd1 100644
--- a/tools/stats_log_api_gen/test_collation.cpp
+++ b/tools/stats_log_api_gen/test_collation.cpp
@@ -226,5 +226,25 @@ TEST(CollationTest, FailOnBadBinaryFieldAtom) {
EXPECT_TRUE(errorCount > 0);
}
+TEST(CollationTest, PassOnWhitelistedAtom) {
+ Atoms atoms;
+ int errorCount =
+ collate_atoms(ListedAtoms::descriptor(), &atoms);
+ EXPECT_EQ(errorCount, 0);
+ EXPECT_EQ(atoms.decls.size(), 2ul);
+}
+
+TEST(CollationTest, RecogniseWhitelistedAtom) {
+ Atoms atoms;
+ collate_atoms(ListedAtoms::descriptor(), &atoms);
+ for (const auto& atomDecl : atoms.decls) {
+ if (atomDecl.code == 1) {
+ EXPECT_TRUE(atomDecl.whitelisted);
+ } else {
+ EXPECT_FALSE(atomDecl.whitelisted);
+ }
+ }
+}
+
} // namespace stats_log_api_gen
} // namespace android \ No newline at end of file