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

Side by Side Diff: base/trace_event/heap_profiler_allocation_context_tracker_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 unified diff | Download patch
« no previous file with comments | « base/BUILD.gn ('k') | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/pending_task.h" 10 #include "base/pending_task.h"
(...skipping 16 matching lines...) Expand all
27 const char kFroyo[] = "Froyo"; 27 const char kFroyo[] = "Froyo";
28 const char kGingerbread[] = "Gingerbread"; 28 const char kGingerbread[] = "Gingerbread";
29 29
30 const char kFilteringTraceConfig[] = 30 const char kFilteringTraceConfig[] =
31 "{" 31 "{"
32 " \"event_filters\": [" 32 " \"event_filters\": ["
33 " {" 33 " {"
34 " \"excluded_categories\": []," 34 " \"excluded_categories\": [],"
35 " \"filter_args\": {}," 35 " \"filter_args\": {},"
36 " \"filter_predicate\": \"heap_profiler_predicate\"," 36 " \"filter_predicate\": \"heap_profiler_predicate\","
37 " \"included_categories\": [\"*\"]" 37 " \"included_categories\": ["
38 " \"*\","
39 " \"" TRACE_DISABLED_BY_DEFAULT("Testing") "\"]"
38 " }" 40 " }"
39 " ]" 41 " ]"
40 "}"; 42 "}";
41 43
42 // Asserts that the fixed-size array |expected_backtrace| matches the backtrace 44 // Asserts that the fixed-size array |expected_backtrace| matches the backtrace
43 // in |AllocationContextTracker::GetContextSnapshot|. 45 // in |AllocationContextTracker::GetContextSnapshot|.
44 template <size_t N> 46 template <size_t N>
45 void AssertBacktraceEquals(const StackFrame(&expected_backtrace)[N]) { 47 void AssertBacktraceEquals(const StackFrame(&expected_backtrace)[N]) {
46 AllocationContext ctx; 48 AllocationContext ctx;
47 ASSERT_TRUE(AllocationContextTracker::GetInstanceForCurrentThread() 49 ASSERT_TRUE(AllocationContextTracker::GetInstanceForCurrentThread()
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 117
116 AssertBacktraceEquals(frame_c); 118 AssertBacktraceEquals(frame_c);
117 119
118 { 120 {
119 TRACE_EVENT0("Testing", kEclair); 121 TRACE_EVENT0("Testing", kEclair);
120 StackFrame frame_ce[] = {t, c, e}; 122 StackFrame frame_ce[] = {t, c, e};
121 AssertBacktraceEquals(frame_ce); 123 AssertBacktraceEquals(frame_ce);
122 } 124 }
123 125
124 { 126 {
127 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("NotTesting"), kDonut);
125 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("Testing"), kCupcake); 128 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("Testing"), kCupcake);
126 StackFrame frame_cc[] = {t, c, c}; 129 StackFrame frame_cc[] = {t, c, c};
127 AssertBacktraceEquals(frame_cc); 130 AssertBacktraceEquals(frame_cc);
128 } 131 }
129 132
130 AssertBacktraceEquals(frame_c); 133 AssertBacktraceEquals(frame_c);
131 } 134 }
132 135
133 AssertBacktraceContainsOnlyThreadName(); 136 AssertBacktraceContainsOnlyThreadName();
134 137
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 TRACE_EVENT0("Testing", kCupcake); 312 TRACE_EVENT0("Testing", kCupcake);
310 TRACE_EVENT0("Testing", kDonut); 313 TRACE_EVENT0("Testing", kDonut);
311 HEAP_PROFILER_SCOPED_IGNORE; 314 HEAP_PROFILER_SCOPED_IGNORE;
312 AllocationContext ctx; 315 AllocationContext ctx;
313 ASSERT_FALSE(AllocationContextTracker::GetInstanceForCurrentThread() 316 ASSERT_FALSE(AllocationContextTracker::GetInstanceForCurrentThread()
314 ->GetContextSnapshot(&ctx)); 317 ->GetContextSnapshot(&ctx));
315 } 318 }
316 319
317 } // namespace trace_event 320 } // namespace trace_event
318 } // namespace base 321 } // namespace base
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698