| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/debug/trace_event.h" | 5 #include "base/debug/trace_event.h" |
| 6 | 6 |
| 7 #include <strstream> | 7 #include <strstream> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 TEST_F(TraceEventWinTest, TraceLog) { | 210 TEST_F(TraceEventWinTest, TraceLog) { |
| 211 ExpectPlayLog(); | 211 ExpectPlayLog(); |
| 212 | 212 |
| 213 // The events should arrive in the same sequence as the expects. | 213 // The events should arrive in the same sequence as the expects. |
| 214 InSequence in_sequence; | 214 InSequence in_sequence; |
| 215 | 215 |
| 216 // Full argument version, passing lengths explicitly. | 216 // Full argument version, passing lengths explicitly. |
| 217 TraceEventETWProvider::Trace(kName, | 217 TraceEventETWProvider::Trace(kName, |
| 218 strlen(kName), | 218 strlen(kName), |
| 219 base::debug::TRACE_EVENT_PHASE_BEGIN, | 219 TRACE_EVENT_PHASE_BEGIN, |
| 220 kId, | 220 kId, |
| 221 kExtra, | 221 kExtra, |
| 222 strlen(kExtra)); | 222 strlen(kExtra)); |
| 223 | 223 |
| 224 ExpectEvent(kTraceEventClass32, | 224 ExpectEvent(kTraceEventClass32, |
| 225 kTraceEventTypeBegin, | 225 kTraceEventTypeBegin, |
| 226 kName, strlen(kName), | 226 kName, strlen(kName), |
| 227 kId, | 227 kId, |
| 228 kExtra, strlen(kExtra)); | 228 kExtra, strlen(kExtra)); |
| 229 | 229 |
| 230 // Const char* version. | 230 // Const char* version. |
| 231 TraceEventETWProvider::Trace(static_cast<const char*>(kName), | 231 TraceEventETWProvider::Trace(static_cast<const char*>(kName), |
| 232 base::debug::TRACE_EVENT_PHASE_END, | 232 TRACE_EVENT_PHASE_END, |
| 233 kId, | 233 kId, |
| 234 static_cast<const char*>(kExtra)); | 234 static_cast<const char*>(kExtra)); |
| 235 | 235 |
| 236 ExpectEvent(kTraceEventClass32, | 236 ExpectEvent(kTraceEventClass32, |
| 237 kTraceEventTypeEnd, | 237 kTraceEventTypeEnd, |
| 238 kName, strlen(kName), | 238 kName, strlen(kName), |
| 239 kId, | 239 kId, |
| 240 kExtra, strlen(kExtra)); | 240 kExtra, strlen(kExtra)); |
| 241 | 241 |
| 242 // std::string extra version. | 242 // std::string extra version. |
| 243 TraceEventETWProvider::Trace(static_cast<const char*>(kName), | 243 TraceEventETWProvider::Trace(static_cast<const char*>(kName), |
| 244 base::debug::TRACE_EVENT_PHASE_INSTANT, | 244 TRACE_EVENT_PHASE_INSTANT, |
| 245 kId, | 245 kId, |
| 246 std::string(kExtra)); | 246 std::string(kExtra)); |
| 247 | 247 |
| 248 ExpectEvent(kTraceEventClass32, | 248 ExpectEvent(kTraceEventClass32, |
| 249 kTraceEventTypeInstant, | 249 kTraceEventTypeInstant, |
| 250 kName, strlen(kName), | 250 kName, strlen(kName), |
| 251 kId, | 251 kId, |
| 252 kExtra, strlen(kExtra)); | 252 kExtra, strlen(kExtra)); |
| 253 | 253 |
| 254 | 254 |
| 255 // Test for sanity on NULL inputs. | 255 // Test for sanity on NULL inputs. |
| 256 TraceEventETWProvider::Trace(NULL, | 256 TraceEventETWProvider::Trace(NULL, |
| 257 0, | 257 0, |
| 258 base::debug::TRACE_EVENT_PHASE_BEGIN, | 258 TRACE_EVENT_PHASE_BEGIN, |
| 259 kId, | 259 kId, |
| 260 NULL, | 260 NULL, |
| 261 0); | 261 0); |
| 262 | 262 |
| 263 ExpectEvent(kTraceEventClass32, | 263 ExpectEvent(kTraceEventClass32, |
| 264 kTraceEventTypeBegin, | 264 kTraceEventTypeBegin, |
| 265 kEmpty, 0, | 265 kEmpty, 0, |
| 266 kId, | 266 kId, |
| 267 kEmpty, 0); | 267 kEmpty, 0); |
| 268 | 268 |
| 269 TraceEventETWProvider::Trace(NULL, | 269 TraceEventETWProvider::Trace(NULL, |
| 270 -1, | 270 -1, |
| 271 base::debug::TRACE_EVENT_PHASE_END, | 271 TRACE_EVENT_PHASE_END, |
| 272 kId, | 272 kId, |
| 273 NULL, | 273 NULL, |
| 274 -1); | 274 -1); |
| 275 | 275 |
| 276 ExpectEvent(kTraceEventClass32, | 276 ExpectEvent(kTraceEventClass32, |
| 277 kTraceEventTypeEnd, | 277 kTraceEventTypeEnd, |
| 278 kEmpty, 0, | 278 kEmpty, 0, |
| 279 kId, | 279 kId, |
| 280 kEmpty, 0); | 280 kEmpty, 0); |
| 281 | 281 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 307 kTraceEventTypeInstant, | 307 kTraceEventTypeInstant, |
| 308 kName, strlen(kName), | 308 kName, strlen(kName), |
| 309 kId, | 309 kId, |
| 310 kExtra, strlen(kExtra)); | 310 kExtra, strlen(kExtra)); |
| 311 | 311 |
| 312 PlayLog(); | 312 PlayLog(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace debug | 315 } // namespace debug |
| 316 } // namespace base | 316 } // namespace base |
| OLD | NEW |