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 #include "base/trace_event.h" | 5 #include "base/trace_event.h" |
| 6 |
5 #include <strstream> | 7 #include <strstream> |
| 8 |
6 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
7 #include "base/file_util.h" | 10 #include "base/file_util.h" |
8 #include "base/event_trace_consumer_win.h" | 11 #include "base/event_trace_consumer_win.h" |
9 #include "base/event_trace_controller_win.h" | 12 #include "base/event_trace_controller_win.h" |
10 #include "base/win_util.h" | 13 #include "base/win/windows_version.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
13 #include <initguid.h> // NOLINT - must be last include. | 16 #include <initguid.h> // NOLINT - must be last include. |
14 | 17 |
15 namespace { | 18 namespace { |
16 using testing::_; | 19 using testing::_; |
17 using testing::AnyNumber; | 20 using testing::AnyNumber; |
18 using testing::InSequence; | 21 using testing::InSequence; |
19 using testing::Ge; | 22 using testing::Ge; |
20 using testing::Le; | 23 using testing::Le; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 70 |
68 private: | 71 private: |
69 static TestEventConsumer* current_; | 72 static TestEventConsumer* current_; |
70 }; | 73 }; |
71 | 74 |
72 TestEventConsumer* TestEventConsumer::current_ = NULL; | 75 TestEventConsumer* TestEventConsumer::current_ = NULL; |
73 | 76 |
74 class TraceEventTest: public testing::Test { | 77 class TraceEventTest: public testing::Test { |
75 public: | 78 public: |
76 void SetUp() { | 79 void SetUp() { |
77 bool is_xp = win_util::GetWinVersion() < win_util::WINVERSION_VISTA; | 80 bool is_xp = base::win::GetVersion() < base::win::VERSION_VISTA; |
78 | 81 |
79 // Resurrect and initialize the TraceLog singleton instance. | 82 // Resurrect and initialize the TraceLog singleton instance. |
80 // On Vista and better, we need the provider registered before we | 83 // On Vista and better, we need the provider registered before we |
81 // start the private, in-proc session, but on XP we need the global | 84 // start the private, in-proc session, but on XP we need the global |
82 // session created and the provider enabled before we register our | 85 // session created and the provider enabled before we register our |
83 // provider. | 86 // provider. |
84 if (!is_xp) { | 87 if (!is_xp) { |
85 base::TraceLog::Resurrect(); | 88 base::TraceLog::Resurrect(); |
86 base::TraceLog* tracelog = base::TraceLog::Get(); | 89 base::TraceLog* tracelog = base::TraceLog::Get(); |
87 ASSERT_TRUE(tracelog != NULL); | 90 ASSERT_TRUE(tracelog != NULL); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 277 |
275 TRACE_EVENT_INSTANT(kName, kId, kExtra); | 278 TRACE_EVENT_INSTANT(kName, kId, kExtra); |
276 ExpectEvent(base::kTraceEventClass32, | 279 ExpectEvent(base::kTraceEventClass32, |
277 base::kTraceEventTypeInstant, | 280 base::kTraceEventTypeInstant, |
278 kName, strlen(kName), | 281 kName, strlen(kName), |
279 kId, | 282 kId, |
280 kExtra, strlen(kExtra)); | 283 kExtra, strlen(kExtra)); |
281 | 284 |
282 PlayLog(); | 285 PlayLog(); |
283 } | 286 } |
OLD | NEW |