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/trace_event/trace_event.h" | 5 #include "base/trace_event/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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 static TestEventConsumer* current_; | 85 static TestEventConsumer* current_; |
86 }; | 86 }; |
87 | 87 |
88 TestEventConsumer* TestEventConsumer::current_ = NULL; | 88 TestEventConsumer* TestEventConsumer::current_ = NULL; |
89 | 89 |
90 class TraceEventWinTest: public testing::Test { | 90 class TraceEventWinTest: public testing::Test { |
91 public: | 91 public: |
92 TraceEventWinTest() { | 92 TraceEventWinTest() { |
93 } | 93 } |
94 | 94 |
95 void SetUp() { | 95 void SetUp() override { |
96 bool is_xp = win::GetVersion() < base::win::VERSION_VISTA; | 96 bool is_xp = win::GetVersion() < base::win::VERSION_VISTA; |
97 | 97 |
98 if (is_xp) { | 98 if (is_xp) { |
99 // Tear down any dangling session from an earlier failing test. | 99 // Tear down any dangling session from an earlier failing test. |
100 EtwTraceProperties ignore; | 100 EtwTraceProperties ignore; |
101 EtwTraceController::Stop(kTestSessionName, &ignore); | 101 EtwTraceController::Stop(kTestSessionName, &ignore); |
102 } | 102 } |
103 | 103 |
104 // Resurrect and initialize the TraceLog singleton instance. | 104 // Resurrect and initialize the TraceLog singleton instance. |
105 // On Vista and better, we need the provider registered before we | 105 // On Vista and better, we need the provider registered before we |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 0)); | 144 0)); |
145 | 145 |
146 if (is_xp) { | 146 if (is_xp) { |
147 TraceEventETWProvider::Resurrect(); | 147 TraceEventETWProvider::Resurrect(); |
148 tracelog = TraceEventETWProvider::GetInstance(); | 148 tracelog = TraceEventETWProvider::GetInstance(); |
149 } | 149 } |
150 ASSERT_TRUE(tracelog != NULL); | 150 ASSERT_TRUE(tracelog != NULL); |
151 EXPECT_TRUE(tracelog->IsTracing()); | 151 EXPECT_TRUE(tracelog->IsTracing()); |
152 } | 152 } |
153 | 153 |
154 void TearDown() { | 154 void TearDown() override { |
155 EtwTraceProperties prop; | 155 EtwTraceProperties prop; |
156 if (controller_.session() != 0) | 156 if (controller_.session() != 0) |
157 EXPECT_HRESULT_SUCCEEDED(controller_.Stop(&prop)); | 157 EXPECT_HRESULT_SUCCEEDED(controller_.Stop(&prop)); |
158 | 158 |
159 if (!log_file_.value().empty()) | 159 if (!log_file_.value().empty()) |
160 base::DeleteFile(log_file_, false); | 160 base::DeleteFile(log_file_, false); |
161 | 161 |
162 // We want our singleton torn down after each test. | 162 // We want our singleton torn down after each test. |
163 TraceLog::DeleteForTesting(); | 163 TraceLog::DeleteForTesting(); |
164 } | 164 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 kTraceEventTypeInstant, | 310 kTraceEventTypeInstant, |
311 kName, strlen(kName), | 311 kName, strlen(kName), |
312 kId, | 312 kId, |
313 kExtra, strlen(kExtra)); | 313 kExtra, strlen(kExtra)); |
314 | 314 |
315 PlayLog(); | 315 PlayLog(); |
316 } | 316 } |
317 | 317 |
318 } // namespace trace_event | 318 } // namespace trace_event |
319 } // namespace base | 319 } // namespace base |
OLD | NEW |