OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <math.h> | 5 #include <math.h> |
6 #include <stddef.h> | 6 #include <stddef.h> |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <cstdlib> | 9 #include <cstdlib> |
10 | 10 |
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 | 1244 |
1245 private: | 1245 private: |
1246 ~Convertable() override {} | 1246 ~Convertable() override {} |
1247 int* num_calls_; | 1247 int* num_calls_; |
1248 }; | 1248 }; |
1249 | 1249 |
1250 scoped_refptr<ConvertableToTraceFormat> convertable = | 1250 scoped_refptr<ConvertableToTraceFormat> convertable = |
1251 new Convertable(&num_calls); | 1251 new Convertable(&num_calls); |
1252 | 1252 |
1253 BeginTrace(); | 1253 BeginTrace(); |
1254 TRACE_EVENT_API_ADD_METADATA_EVENT("metadata_event_name", "metadata_arg_name", | 1254 TRACE_EVENT_API_ADD_METADATA_EVENT( |
1255 convertable); | 1255 TraceLog::GetCategoryGroupEnabled("__metadata"), "metadata_event_name", |
| 1256 "metadata_arg_name", convertable); |
1256 | 1257 |
1257 // |AppendAsTraceFormat| should only be called on flush, not when the event | 1258 // |AppendAsTraceFormat| should only be called on flush, not when the event |
1258 // is added. | 1259 // is added. |
1259 ASSERT_EQ(0, num_calls); | 1260 ASSERT_EQ(0, num_calls); |
1260 EndTraceAndFlush(); | 1261 EndTraceAndFlush(); |
1261 ASSERT_EQ(1, num_calls); | 1262 ASSERT_EQ(1, num_calls); |
1262 EXPECT_TRUE(FindNamePhaseKeyValue("metadata_event_name", "M", | 1263 EXPECT_TRUE(FindNamePhaseKeyValue("metadata_event_name", "M", |
1263 "metadata_arg_name", "metadata_value")); | 1264 "metadata_arg_name", "metadata_value")); |
1264 | 1265 |
1265 // The metadata event should only be adde to the current trace. In this new | 1266 // The metadata event should only be adde to the current trace. In this new |
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3066 } | 3067 } |
3067 | 3068 |
3068 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { | 3069 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { |
3069 const char filter[] = "DELAY(test.Delay;16;oneshot)"; | 3070 const char filter[] = "DELAY(test.Delay;16;oneshot)"; |
3070 TraceConfig config(filter, ""); | 3071 TraceConfig config(filter, ""); |
3071 EXPECT_EQ(filter, config.ToCategoryFilterString()); | 3072 EXPECT_EQ(filter, config.ToCategoryFilterString()); |
3072 } | 3073 } |
3073 | 3074 |
3074 } // namespace trace_event | 3075 } // namespace trace_event |
3075 } // namespace base | 3076 } // namespace base |
OLD | NEW |