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

Side by Side Diff: base/trace_event_win_unittest.cc

Issue 3800006: Fix event tracing for windows test flakyness.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « base/event_trace_provider_win.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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.h" 5 #include "base/trace_event.h"
6 6
7 #include <strstream> 7 #include <strstream>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 static TestEventConsumer* current_; 72 static TestEventConsumer* current_;
73 }; 73 };
74 74
75 TestEventConsumer* TestEventConsumer::current_ = NULL; 75 TestEventConsumer* TestEventConsumer::current_ = NULL;
76 76
77 class TraceEventTest: public testing::Test { 77 class TraceEventTest: public testing::Test {
78 public: 78 public:
79 void SetUp() { 79 void SetUp() {
80 bool is_xp = base::win::GetVersion() < base::win::VERSION_VISTA; 80 bool is_xp = base::win::GetVersion() < base::win::VERSION_VISTA;
81 81
82 if (is_xp) {
83 // Tear down any dangling session from an earlier failing test.
84 EtwTraceProperties ignore;
85
86 EtwTraceController::Stop(kTestSessionName, &ignore);
87 }
88
82 // Resurrect and initialize the TraceLog singleton instance. 89 // Resurrect and initialize the TraceLog singleton instance.
83 // On Vista and better, we need the provider registered before we 90 // On Vista and better, we need the provider registered before we
84 // start the private, in-proc session, but on XP we need the global 91 // start the private, in-proc session, but on XP we need the global
85 // session created and the provider enabled before we register our 92 // session created and the provider enabled before we register our
86 // provider. 93 // provider.
87 if (!is_xp) { 94 if (!is_xp) {
88 base::TraceLog::Resurrect(); 95 base::TraceLog::Resurrect();
89 base::TraceLog* tracelog = base::TraceLog::Get(); 96 base::TraceLog* tracelog = base::TraceLog::Get();
90 ASSERT_TRUE(tracelog != NULL); 97 ASSERT_TRUE(tracelog != NULL);
91 } 98 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 254
248 ExpectEvent(base::kTraceEventClass32, 255 ExpectEvent(base::kTraceEventClass32,
249 base::kTraceEventTypeEnd, 256 base::kTraceEventTypeEnd,
250 kEmpty, 0, 257 kEmpty, 0,
251 kId, 258 kId,
252 kEmpty, 0); 259 kEmpty, 0);
253 260
254 PlayLog(); 261 PlayLog();
255 } 262 }
256 263
257 // Marked flaky per http://crbug.com/52388 264 TEST_F(TraceEventTest, Macros) {
258 TEST_F(TraceEventTest, FLAKY_Macros) {
259 ExpectPlayLog(); 265 ExpectPlayLog();
260 266
261 // The events should arrive in the same sequence as the expects. 267 // The events should arrive in the same sequence as the expects.
262 InSequence in_sequence; 268 InSequence in_sequence;
263 269
264 TRACE_EVENT_BEGIN(kName, kId, kExtra); 270 TRACE_EVENT_BEGIN(kName, kId, kExtra);
265 ExpectEvent(base::kTraceEventClass32, 271 ExpectEvent(base::kTraceEventClass32,
266 base::kTraceEventTypeBegin, 272 base::kTraceEventTypeBegin,
267 kName, strlen(kName), 273 kName, strlen(kName),
268 kId, 274 kId,
269 kExtra, strlen(kExtra)); 275 kExtra, strlen(kExtra));
270 276
271 TRACE_EVENT_END(kName, kId, kExtra); 277 TRACE_EVENT_END(kName, kId, kExtra);
272 ExpectEvent(base::kTraceEventClass32, 278 ExpectEvent(base::kTraceEventClass32,
273 base::kTraceEventTypeEnd, 279 base::kTraceEventTypeEnd,
274 kName, strlen(kName), 280 kName, strlen(kName),
275 kId, 281 kId,
276 kExtra, strlen(kExtra)); 282 kExtra, strlen(kExtra));
277 283
278 TRACE_EVENT_INSTANT(kName, kId, kExtra); 284 TRACE_EVENT_INSTANT(kName, kId, kExtra);
279 ExpectEvent(base::kTraceEventClass32, 285 ExpectEvent(base::kTraceEventClass32,
280 base::kTraceEventTypeInstant, 286 base::kTraceEventTypeInstant,
281 kName, strlen(kName), 287 kName, strlen(kName),
282 kId, 288 kId,
283 kExtra, strlen(kExtra)); 289 kExtra, strlen(kExtra));
284 290
285 PlayLog(); 291 PlayLog();
286 } 292 }
OLDNEW
« no previous file with comments | « base/event_trace_provider_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698