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

Unified Diff: base/trace_event/trace_event_unittest.cc

Issue 2739163004: [tracing] Use same code path for category filtering for recording and event filtering (Closed)
Patch Set: InitalizeWithString. Created 3 years, 9 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 | « base/trace_event/trace_config_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event_unittest.cc
diff --git a/base/trace_event/trace_event_unittest.cc b/base/trace_event/trace_event_unittest.cc
index 29be3feec835a85bfd850cd490de9f4985d41e73..7a30e4ee571c0f8a50bd3b08f2d862dceb549ed8 100644
--- a/base/trace_event/trace_event_unittest.cc
+++ b/base/trace_event/trace_event_unittest.cc
@@ -3087,11 +3087,15 @@ TEST_F(TraceEventTestFixture, EventFiltering) {
"{"
" \"included_categories\": ["
" \"filtered_cat\","
- " \"unfiltered_cat\"],"
+ " \"unfiltered_cat\","
+ " \"" TRACE_DISABLED_BY_DEFAULT("filtered_cat") "\","
+ " \"" TRACE_DISABLED_BY_DEFAULT("unfiltered_cat") "\"],"
" \"event_filters\": ["
" {"
" \"filter_predicate\": \"testing_predicate\", "
- " \"included_categories\": [\"filtered_cat\"]"
+ " \"included_categories\": ["
+ " \"filtered_cat\","
+ " \"" TRACE_DISABLED_BY_DEFAULT("filtered_cat") "\"]"
" }"
" "
" ]"
@@ -3110,12 +3114,15 @@ TEST_F(TraceEventTestFixture, EventFiltering) {
TRACE_EVENT0("filtered_cat", "a mushroom");
TRACE_EVENT0("unfiltered_cat", "a horse");
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("filtered_cat"), "a dog");
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("unfiltered_cat"), "a pony");
+
// This is scoped so we can test the end event being filtered.
{ TRACE_EVENT0("filtered_cat", "another cat whoa"); }
EndTraceAndFlush();
- EXPECT_EQ(3u, filter_hits_counter.filter_trace_event_hit_count);
+ EXPECT_EQ(4u, filter_hits_counter.filter_trace_event_hit_count);
EXPECT_EQ(1u, filter_hits_counter.end_event_hit_count);
}
@@ -3124,12 +3131,14 @@ TEST_F(TraceEventTestFixture, EventWhitelistFiltering) {
"{"
" \"included_categories\": ["
" \"filtered_cat\","
- " \"unfiltered_cat\"],"
+ " \"unfiltered_cat\","
+ " \"" TRACE_DISABLED_BY_DEFAULT("filtered_cat") "\"],"
" \"event_filters\": ["
" {"
" \"filter_predicate\": \"%s\", "
- " \"included_categories\": [\"*\"], "
- " \"excluded_categories\": [\"unfiltered_cat\"], "
+ " \"included_categories\": ["
+ " \"filtered_cat\","
+ " \"" TRACE_DISABLED_BY_DEFAULT("*") "\"], "
" \"filter_args\": {"
" \"event_name_whitelist\": [\"a snake\", \"a dog\"]"
" }"
@@ -3147,12 +3156,16 @@ TEST_F(TraceEventTestFixture, EventWhitelistFiltering) {
TRACE_EVENT0("filtered_cat", "a snake");
TRACE_EVENT0("filtered_cat", "a mushroom");
TRACE_EVENT0("unfiltered_cat", "a cat");
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("filtered_cat"), "a dog");
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("filtered_cat"), "a pony");
EndTraceAndFlush();
EXPECT_TRUE(FindMatchingValue("name", "a snake"));
EXPECT_FALSE(FindMatchingValue("name", "a mushroom"));
EXPECT_TRUE(FindMatchingValue("name", "a cat"));
+ EXPECT_TRUE(FindMatchingValue("name", "a dog"));
+ EXPECT_FALSE(FindMatchingValue("name", "a pony"));
}
TEST_F(TraceEventTestFixture, HeapProfilerFiltering) {
@@ -3160,12 +3173,16 @@ TEST_F(TraceEventTestFixture, HeapProfilerFiltering) {
"{"
" \"included_categories\": ["
" \"filtered_cat\","
- " \"unfiltered_cat\"],"
+ " \"unfiltered_cat\","
+ " \"" TRACE_DISABLED_BY_DEFAULT("filtered_cat") "\","
+ " \"" TRACE_DISABLED_BY_DEFAULT("unfiltered_cat") "\"],"
" \"excluded_categories\": [\"excluded_cat\"],"
" \"event_filters\": ["
" {"
" \"filter_predicate\": \"%s\", "
- " \"included_categories\": [\"*\"]"
+ " \"included_categories\": ["
+ " \"*\","
+ " \"" TRACE_DISABLED_BY_DEFAULT("filtered_cat") "\"]"
" }"
" ]"
"}",
@@ -3179,6 +3196,8 @@ TEST_F(TraceEventTestFixture, HeapProfilerFiltering) {
TRACE_EVENT0("filtered_cat", "a snake");
TRACE_EVENT0("excluded_cat", "a mushroom");
TRACE_EVENT0("unfiltered_cat", "a cat");
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("filtered_cat"), "a dog");
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("unfiltered_cat"), "a pony");
EndTraceAndFlush();
@@ -3186,6 +3205,8 @@ TEST_F(TraceEventTestFixture, HeapProfilerFiltering) {
EXPECT_TRUE(FindMatchingValue("name", "a snake"));
EXPECT_FALSE(FindMatchingValue("name", "a mushroom"));
EXPECT_TRUE(FindMatchingValue("name", "a cat"));
+ EXPECT_TRUE(FindMatchingValue("name", "a dog"));
+ EXPECT_TRUE(FindMatchingValue("name", "a pony"));
}
TEST_F(TraceEventTestFixture, ClockSyncEventsAreAlwaysAddedToTrace) {
« no previous file with comments | « base/trace_event/trace_config_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698