| 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 provider. | 5 // Unit tests for event trace provider. |
| 6 #include "base/event_trace_provider_win.h" | 6 #include "base/event_trace_provider_win.h" |
| 7 #include <new> | 7 #include <new> |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include <initguid.h> // NOLINT - has to be last | 9 #include <initguid.h> // NOLINT - has to be last |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 ASSERT_EQ(ERROR_SUCCESS, provider.Register()); | 82 ASSERT_EQ(ERROR_SUCCESS, provider.Register()); |
| 83 EXPECT_NE(NULL, provider.registration_handle()); | 83 EXPECT_NE(NULL, provider.registration_handle()); |
| 84 ASSERT_EQ(ERROR_SUCCESS, provider.Unregister()); | 84 ASSERT_EQ(ERROR_SUCCESS, provider.Unregister()); |
| 85 EXPECT_EQ(NULL, provider.registration_handle()); | 85 EXPECT_EQ(NULL, provider.registration_handle()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 TEST(EtwTraceProviderTest, RegisterWithNoNameFails) { | 88 TEST(EtwTraceProviderTest, RegisterWithNoNameFails) { |
| 89 EtwTraceProvider provider; | 89 EtwTraceProvider provider; |
| 90 | 90 |
| 91 EXPECT_TRUE(provider.Register() != ERROR_SUCCESS); | 91 EXPECT_NE(ERROR_SUCCESS, provider.Register()); |
| 92 } | 92 } |
| 93 | 93 |
| 94 TEST(EtwTraceProviderTest, Enable) { | 94 TEST(EtwTraceProviderTest, Enable) { |
| 95 EtwTraceProvider provider(kTestProvider); | 95 EtwTraceProvider provider(kTestProvider); |
| 96 | 96 |
| 97 ASSERT_EQ(ERROR_SUCCESS, provider.Register()); | 97 ASSERT_EQ(ERROR_SUCCESS, provider.Register()); |
| 98 EXPECT_NE(NULL, provider.registration_handle()); | 98 EXPECT_NE(NULL, provider.registration_handle()); |
| 99 | 99 |
| 100 // No session so far. | 100 // No session so far. |
| 101 EXPECT_EQ(NULL, provider.session_handle()); | 101 EXPECT_EQ(NULL, provider.session_handle()); |
| 102 EXPECT_EQ(0, provider.enable_flags()); | 102 EXPECT_EQ(0, provider.enable_flags()); |
| 103 EXPECT_EQ(0, provider.enable_level()); | 103 EXPECT_EQ(0, provider.enable_level()); |
| 104 | 104 |
| 105 ASSERT_EQ(ERROR_SUCCESS, provider.Unregister()); | 105 ASSERT_EQ(ERROR_SUCCESS, provider.Unregister()); |
| 106 EXPECT_EQ(NULL, provider.registration_handle()); | 106 EXPECT_EQ(NULL, provider.registration_handle()); |
| 107 } | 107 } |
| OLD | NEW |