| 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" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL)); | 155 EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL)); |
| 156 EXPECT_EQ(0u, controller.session()); | 156 EXPECT_EQ(0u, controller.session()); |
| 157 EXPECT_STREQ(L"", controller.session_name()); | 157 EXPECT_STREQ(L"", controller.session_name()); |
| 158 } | 158 } |
| 159 | 159 |
| 160 TEST_F(EtwTraceControllerTest, StartFileSession) { | 160 TEST_F(EtwTraceControllerTest, StartFileSession) { |
| 161 ScopedTempDir temp_dir; | 161 ScopedTempDir temp_dir; |
| 162 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 162 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 163 FilePath temp; | 163 FilePath temp; |
| 164 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &temp)); | 164 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.GetPath(), &temp)); |
| 165 | 165 |
| 166 EtwTraceController controller; | 166 EtwTraceController controller; |
| 167 HRESULT hr = controller.StartFileSession(session_name_.c_str(), | 167 HRESULT hr = controller.StartFileSession(session_name_.c_str(), |
| 168 temp.value().c_str()); | 168 temp.value().c_str()); |
| 169 if (hr == E_ACCESSDENIED) { | 169 if (hr == E_ACCESSDENIED) { |
| 170 VLOG(1) << "You must be an administrator to run this test on Vista"; | 170 VLOG(1) << "You must be an administrator to run this test on Vista"; |
| 171 base::DeleteFile(temp, false); | 171 base::DeleteFile(temp, false); |
| 172 return; | 172 return; |
| 173 } | 173 } |
| 174 | 174 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 provider.WaitForCallback(); | 235 provider.WaitForCallback(); |
| 236 | 236 |
| 237 // Session should have wound down. | 237 // Session should have wound down. |
| 238 EXPECT_EQ(0, provider.enable_level()); | 238 EXPECT_EQ(0, provider.enable_level()); |
| 239 EXPECT_EQ(0u, provider.enable_flags()); | 239 EXPECT_EQ(0u, provider.enable_flags()); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace win | 243 } // namespace win |
| 244 } // namespace base | 244 } // namespace base |
| OLD | NEW |