OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_FILTER_TEST_UTILS_H_ |
| 6 #define BASE_TRACE_EVENT_TRACE_EVENT_FILTER_TEST_UTILS_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/trace_event/trace_event_filter.h" |
| 13 |
| 14 namespace base { |
| 15 namespace trace_event { |
| 16 |
| 17 class TestEventFilter : public TraceEventFilter { |
| 18 public: |
| 19 struct HitsCounter { |
| 20 HitsCounter(); |
| 21 ~HitsCounter(); |
| 22 void Reset(); |
| 23 size_t filter_trace_event_hit_count; |
| 24 size_t end_event_hit_count; |
| 25 }; |
| 26 |
| 27 static const char kName[]; |
| 28 |
| 29 // Factory method for TraceLog::SetFilterFactoryForTesting(). |
| 30 static std::unique_ptr<TraceEventFilter> Factory( |
| 31 const std::string& predicate_name); |
| 32 |
| 33 TestEventFilter(); |
| 34 ~TestEventFilter() override; |
| 35 |
| 36 // TraceEventFilter implementation. |
| 37 bool FilterTraceEvent(const TraceEvent& trace_event) const override; |
| 38 void EndEvent(const char* category_name, const char* name) const override; |
| 39 |
| 40 static void set_filter_return_value(bool value) { |
| 41 filter_return_value_ = value; |
| 42 } |
| 43 |
| 44 private: |
| 45 static bool filter_return_value_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(TestEventFilter); |
| 48 }; |
| 49 |
| 50 } // namespace trace_event |
| 51 } // namespace base |
| 52 |
| 53 #endif // BASE_TRACE_EVENT_TRACE_EVENT_FILTER_TEST_UTILS_H_ |
OLD | NEW |