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

Side by Side Diff: base/trace_event/trace_event_unittest.cc

Issue 2040663002: Tracing: Added necessary plumbing to make sure clocksync metadata events are always included. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/trace_event/trace_event.h ('k') | base/trace_event/trace_log.h » ('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 (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 "base/trace_event/trace_event.h" 5 #include "base/trace_event/trace_event.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 out->append("\"metadata_value\""); 1250 out->append("\"metadata_value\"");
1251 } 1251 }
1252 1252
1253 private: 1253 private:
1254 int* num_calls_; 1254 int* num_calls_;
1255 }; 1255 };
1256 1256
1257 std::unique_ptr<ConvertableToTraceFormat> conv1(new Convertable(&num_calls)); 1257 std::unique_ptr<ConvertableToTraceFormat> conv1(new Convertable(&num_calls));
1258 std::unique_ptr<Convertable> conv2(new Convertable(&num_calls)); 1258 std::unique_ptr<Convertable> conv2(new Convertable(&num_calls));
1259 1259
1260 BeginTrace(); 1260 BeginSpecificTrace("irrelevant_cat");
1261 TRACE_EVENT_API_ADD_METADATA_EVENT( 1261 TRACE_EVENT_METADATA_FORCED1("metadata_event_1", "metadata_arg_name",
1262 TraceLog::GetCategoryGroupEnabled("__metadata"), "metadata_event_1", 1262 std::move(conv1));
1263 "metadata_arg_name", std::move(conv1)); 1263 TRACE_EVENT_METADATA_FORCED1("metadata_event_2", "metadata_arg_name",
1264 TRACE_EVENT_API_ADD_METADATA_EVENT( 1264 std::move(conv2));
1265 TraceLog::GetCategoryGroupEnabled("__metadata"), "metadata_event_2",
1266 "metadata_arg_name", std::move(conv2));
1267 // |AppendAsTraceFormat| should only be called on flush, not when the event 1265 // |AppendAsTraceFormat| should only be called on flush, not when the event
1268 // is added. 1266 // is added.
1269 ASSERT_EQ(0, num_calls); 1267 ASSERT_EQ(0, num_calls);
1270 EndTraceAndFlush(); 1268 EndTraceAndFlush();
1271 ASSERT_EQ(2, num_calls); 1269 ASSERT_EQ(2, num_calls);
1272 EXPECT_TRUE(FindNamePhaseKeyValue("metadata_event_1", "M", 1270 EXPECT_TRUE(FindNamePhaseKeyValue("metadata_event_1", "M",
1273 "metadata_arg_name", "metadata_value")); 1271 "metadata_arg_name", "metadata_value"));
1274 EXPECT_TRUE(FindNamePhaseKeyValue("metadata_event_2", "M", 1272 EXPECT_TRUE(FindNamePhaseKeyValue("metadata_event_2", "M",
1275 "metadata_arg_name", "metadata_value")); 1273 "metadata_arg_name", "metadata_value"));
1276 1274
(...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after
3114 } 3112 }
3115 3113
3116 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { 3114 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) {
3117 const char filter[] = "DELAY(test.Delay;16;oneshot)"; 3115 const char filter[] = "DELAY(test.Delay;16;oneshot)";
3118 TraceConfig config(filter, ""); 3116 TraceConfig config(filter, "");
3119 EXPECT_EQ(filter, config.ToCategoryFilterString()); 3117 EXPECT_EQ(filter, config.ToCategoryFilterString());
3120 } 3118 }
3121 3119
3122 } // namespace trace_event 3120 } // namespace trace_event
3123 } // namespace base 3121 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_event.h ('k') | base/trace_event/trace_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698