OLD | NEW |
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 // Unit tests for event trace consumer_ base class. | 5 // Unit tests for event trace consumer_ base class. |
6 #include "base/event_trace_consumer_win.h" | 6 #include "base/win/event_trace_consumer.h" |
7 #include <list> | 7 #include <list> |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/event_trace_controller_win.h" | 9 #include "base/win/event_trace_controller.h" |
10 #include "base/event_trace_provider_win.h" | 10 #include "base/win/event_trace_provider.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/scoped_handle.h" | 14 #include "base/scoped_handle.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 #include <initguid.h> // NOLINT - has to be last | 17 #include <initguid.h> // NOLINT - has to be last |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
| 21 using base::win::EtwMofEvent; |
| 22 using base::win::EtwTraceController; |
| 23 using base::win::EtwTraceConsumerBase; |
| 24 using base::win::EtwTraceProperties; |
| 25 using base::win::EtwTraceProvider; |
| 26 |
21 typedef std::list<EVENT_TRACE> EventQueue; | 27 typedef std::list<EVENT_TRACE> EventQueue; |
22 | 28 |
23 class TestConsumer: public EtwTraceConsumerBase<TestConsumer> { | 29 class TestConsumer: public EtwTraceConsumerBase<TestConsumer> { |
24 public: | 30 public: |
25 TestConsumer() { | 31 TestConsumer() { |
26 sank_event_.Set(::CreateEvent(NULL, TRUE, FALSE, NULL)); | 32 sank_event_.Set(::CreateEvent(NULL, TRUE, FALSE, NULL)); |
27 ClearQueue(); | 33 ClearQueue(); |
28 } | 34 } |
29 | 35 |
30 ~TestConsumer() { | 36 ~TestConsumer() { |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 PEVENT_TRACE trace = NULL; | 337 PEVENT_TRACE trace = NULL; |
332 HRESULT hr = RoundTripEvent(&event.header, &trace); | 338 HRESULT hr = RoundTripEvent(&event.header, &trace); |
333 if (hr == E_ACCESSDENIED) { | 339 if (hr == E_ACCESSDENIED) { |
334 VLOG(1) << "You must be an administrator to run this test on Vista"; | 340 VLOG(1) << "You must be an administrator to run this test on Vista"; |
335 return; | 341 return; |
336 } | 342 } |
337 ASSERT_TRUE(NULL != trace); | 343 ASSERT_TRUE(NULL != trace); |
338 ASSERT_EQ(sizeof(kData), trace->MofLength); | 344 ASSERT_EQ(sizeof(kData), trace->MofLength); |
339 ASSERT_STREQ(kData, reinterpret_cast<const char*>(trace->MofData)); | 345 ASSERT_STREQ(kData, reinterpret_cast<const char*>(trace->MofData)); |
340 } | 346 } |
OLD | NEW |