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 // Unit tests for event trace consumer base class. | 5 // Unit tests for event trace consumer base class. |
6 #include "base/win/event_trace_consumer.h" | 6 #include "base/win/event_trace_consumer.h" |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include <objbase.h> | 10 #include <objbase.h> |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 namespace { | 275 namespace { |
276 | 276 |
277 // We run events through a file session to assert that | 277 // We run events through a file session to assert that |
278 // the content comes through. | 278 // the content comes through. |
279 class EtwTraceConsumerDataTest: public EtwTraceConsumerBaseTest { | 279 class EtwTraceConsumerDataTest: public EtwTraceConsumerBaseTest { |
280 public: | 280 public: |
281 EtwTraceConsumerDataTest() { | 281 EtwTraceConsumerDataTest() { |
282 } | 282 } |
283 | 283 |
284 virtual void SetUp() { | 284 virtual void SetUp() { |
| 285 EtwTraceConsumerBaseTest::SetUp(); |
| 286 |
285 EtwTraceProperties prop; | 287 EtwTraceProperties prop; |
286 EtwTraceController::Stop(session_name_.c_str(), &prop); | 288 EtwTraceController::Stop(session_name_.c_str(), &prop); |
287 | 289 |
288 // Create a temp dir for this test. | 290 // Create a temp dir for this test. |
289 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 291 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
290 // Construct a temp file name in our dir. | 292 // Construct a temp file name in our dir. |
291 temp_file_ = temp_dir_.path().Append(L"test.etl"); | 293 temp_file_ = temp_dir_.path().Append(L"test.etl"); |
292 } | 294 } |
293 | 295 |
294 virtual void TearDown() { | 296 virtual void TearDown() { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 HRESULT hr = RoundTripEvent(&event.header, &trace); | 374 HRESULT hr = RoundTripEvent(&event.header, &trace); |
373 if (hr == E_ACCESSDENIED) { | 375 if (hr == E_ACCESSDENIED) { |
374 VLOG(1) << "You must be an administrator to run this test on Vista"; | 376 VLOG(1) << "You must be an administrator to run this test on Vista"; |
375 return; | 377 return; |
376 } | 378 } |
377 ASSERT_HRESULT_SUCCEEDED(hr) << "RoundTripEvent failed"; | 379 ASSERT_HRESULT_SUCCEEDED(hr) << "RoundTripEvent failed"; |
378 ASSERT_TRUE(NULL != trace); | 380 ASSERT_TRUE(NULL != trace); |
379 ASSERT_EQ(sizeof(kData), trace->MofLength); | 381 ASSERT_EQ(sizeof(kData), trace->MofLength); |
380 ASSERT_STREQ(kData, reinterpret_cast<const char*>(trace->MofData)); | 382 ASSERT_STREQ(kData, reinterpret_cast<const char*>(trace->MofData)); |
381 } | 383 } |
OLD | NEW |