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 controller. | 5 // Unit tests for event trace controller. |
6 | 6 |
7 #include <objbase.h> | 7 #include <objbase.h> |
8 #include <initguid.h> | 8 #include <initguid.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/process/process.h" | 14 #include "base/process/process_handle.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
17 #include "base/win/event_trace_controller.h" | 17 #include "base/win/event_trace_controller.h" |
18 #include "base/win/event_trace_provider.h" | 18 #include "base/win/event_trace_provider.h" |
19 #include "base/win/scoped_handle.h" | 19 #include "base/win/scoped_handle.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 namespace win { | 23 namespace win { |
24 | 24 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 std::wstring name2(1024, L'A'); | 103 std::wstring name2(1024, L'A'); |
104 ASSERT_HRESULT_FAILED(prop.SetLoggerFileName(name2.c_str())); | 104 ASSERT_HRESULT_FAILED(prop.SetLoggerFileName(name2.c_str())); |
105 ASSERT_HRESULT_FAILED(prop.SetLoggerName(name2.c_str())); | 105 ASSERT_HRESULT_FAILED(prop.SetLoggerName(name2.c_str())); |
106 } | 106 } |
107 | 107 |
108 namespace { | 108 namespace { |
109 | 109 |
110 class EtwTraceControllerTest : public testing::Test { | 110 class EtwTraceControllerTest : public testing::Test { |
111 public: | 111 public: |
112 EtwTraceControllerTest() | 112 EtwTraceControllerTest() |
113 : session_name_( | 113 : session_name_(StringPrintf(L"TestSession-%d", GetCurrentProcId())) { |
114 StringPrintf(L"TestSession-%d", Process::Current().pid())) { | |
115 } | 114 } |
116 | 115 |
117 virtual void SetUp() { | 116 virtual void SetUp() { |
118 EtwTraceProperties ignore; | 117 EtwTraceProperties ignore; |
119 EtwTraceController::Stop(session_name_.c_str(), &ignore); | 118 EtwTraceController::Stop(session_name_.c_str(), &ignore); |
120 | 119 |
121 // Allocate a new provider name GUID for each test. | 120 // Allocate a new provider name GUID for each test. |
122 ASSERT_HRESULT_SUCCEEDED(::CoCreateGuid(&test_provider_)); | 121 ASSERT_HRESULT_SUCCEEDED(::CoCreateGuid(&test_provider_)); |
123 } | 122 } |
124 | 123 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 229 |
231 provider.WaitForCallback(); | 230 provider.WaitForCallback(); |
232 | 231 |
233 // Session should have wound down. | 232 // Session should have wound down. |
234 EXPECT_EQ(0, provider.enable_level()); | 233 EXPECT_EQ(0, provider.enable_level()); |
235 EXPECT_EQ(0, provider.enable_flags()); | 234 EXPECT_EQ(0, provider.enable_flags()); |
236 } | 235 } |
237 | 236 |
238 } // namespace win | 237 } // namespace win |
239 } // namespace base | 238 } // namespace base |
OLD | NEW |