OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/event_trace_consumer_win.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/event_trace_controller_win.h" |
10 #include "base/event_trace_provider_win.h" | 10 #include "base/event_trace_provider_win.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 ASSERT_EQ(0, TestConsumer::events_.size()); | 226 ASSERT_EQ(0, TestConsumer::events_.size()); |
227 | 227 |
228 EtwMofEvent<1> event(kTestEventType, 1, TRACE_LEVEL_ERROR); | 228 EtwMofEvent<1> event(kTestEventType, 1, TRACE_LEVEL_ERROR); |
229 EXPECT_EQ(ERROR_SUCCESS, provider.Log(&event.header)); | 229 EXPECT_EQ(ERROR_SUCCESS, provider.Log(&event.header)); |
230 | 230 |
231 EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(TestConsumer::sank_event_, | 231 EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(TestConsumer::sank_event_, |
232 INFINITE)); | 232 INFINITE)); |
233 ASSERT_HRESULT_SUCCEEDED(controller.Stop(NULL)); | 233 ASSERT_HRESULT_SUCCEEDED(controller.Stop(NULL)); |
234 ASSERT_HRESULT_SUCCEEDED(JoinConsumerThread()); | 234 ASSERT_HRESULT_SUCCEEDED(JoinConsumerThread()); |
235 ASSERT_NE(0u, TestConsumer::events_.size()); | 235 ASSERT_NE(0, TestConsumer::events_.size()); |
236 } | 236 } |
237 | 237 |
238 namespace { | 238 namespace { |
239 | 239 |
240 // We run events through a file session to assert that | 240 // We run events through a file session to assert that |
241 // the content comes through. | 241 // the content comes through. |
242 class EtwTraceConsumerDataTest: public testing::Test { | 242 class EtwTraceConsumerDataTest: public testing::Test { |
243 public: | 243 public: |
244 EtwTraceConsumerDataTest() { | 244 EtwTraceConsumerDataTest() { |
245 } | 245 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 PEVENT_TRACE trace = NULL; | 328 PEVENT_TRACE trace = NULL; |
329 HRESULT hr = RoundTripEvent(&event.header, &trace); | 329 HRESULT hr = RoundTripEvent(&event.header, &trace); |
330 if (hr == E_ACCESSDENIED) { | 330 if (hr == E_ACCESSDENIED) { |
331 LOG(INFO) << "You must be an administrator to run this test on Vista"; | 331 LOG(INFO) << "You must be an administrator to run this test on Vista"; |
332 return; | 332 return; |
333 } | 333 } |
334 ASSERT_TRUE(NULL != trace); | 334 ASSERT_TRUE(NULL != trace); |
335 ASSERT_EQ(sizeof(kData), trace->MofLength); | 335 ASSERT_EQ(sizeof(kData), trace->MofLength); |
336 ASSERT_STREQ(kData, reinterpret_cast<const char*>(trace->MofData)); | 336 ASSERT_STREQ(kData, reinterpret_cast<const char*>(trace->MofData)); |
337 } | 337 } |
OLD | NEW |