Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: base/debug/trace_event_win_unittest.cc

Issue 5527004: Access singletons with a new GetInstance() method instead of Singleton<T>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
5 #include "base/debug/trace_event.h" 5 #include "base/debug/trace_event.h"
6 6
7 #include <strstream> 7 #include <strstream>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 // Resurrect and initialize the TraceLog singleton instance. 101 // Resurrect and initialize the TraceLog singleton instance.
102 // On Vista and better, we need the provider registered before we 102 // On Vista and better, we need the provider registered before we
103 // start the private, in-proc session, but on XP we need the global 103 // start the private, in-proc session, but on XP we need the global
104 // session created and the provider enabled before we register our 104 // session created and the provider enabled before we register our
105 // provider. 105 // provider.
106 TraceLog* tracelog = NULL; 106 TraceLog* tracelog = NULL;
107 if (!is_xp) { 107 if (!is_xp) {
108 TraceLog::Resurrect(); 108 TraceLog::Resurrect();
109 tracelog = TraceLog::Get(); 109 tracelog = TraceLog::GetInstance();
110 ASSERT_TRUE(tracelog != NULL); 110 ASSERT_TRUE(tracelog != NULL);
111 ASSERT_FALSE(tracelog->IsTracing()); 111 ASSERT_FALSE(tracelog->IsTracing());
112 } 112 }
113 113
114 // Create the log file. 114 // Create the log file.
115 ASSERT_TRUE(file_util::CreateTemporaryFile(&log_file_)); 115 ASSERT_TRUE(file_util::CreateTemporaryFile(&log_file_));
116 116
117 // Create a private log session on the file. 117 // Create a private log session on the file.
118 EtwTraceProperties prop; 118 EtwTraceProperties prop;
119 ASSERT_HRESULT_SUCCEEDED(prop.SetLoggerFileName(log_file_.value().c_str())); 119 ASSERT_HRESULT_SUCCEEDED(prop.SetLoggerFileName(log_file_.value().c_str()));
(...skipping 15 matching lines...) Expand all
135 ASSERT_HRESULT_SUCCEEDED(controller_.Start(kTestSessionName, &prop)); 135 ASSERT_HRESULT_SUCCEEDED(controller_.Start(kTestSessionName, &prop));
136 136
137 // Enable the TraceLog provider GUID. 137 // Enable the TraceLog provider GUID.
138 ASSERT_HRESULT_SUCCEEDED( 138 ASSERT_HRESULT_SUCCEEDED(
139 controller_.EnableProvider(kChromeTraceProviderName, 139 controller_.EnableProvider(kChromeTraceProviderName,
140 TRACE_LEVEL_INFORMATION, 140 TRACE_LEVEL_INFORMATION,
141 0)); 141 0));
142 142
143 if (is_xp) { 143 if (is_xp) {
144 TraceLog::Resurrect(); 144 TraceLog::Resurrect();
145 tracelog = TraceLog::Get(); 145 tracelog = TraceLog::GetInstance();
146 } 146 }
147 ASSERT_TRUE(tracelog != NULL); 147 ASSERT_TRUE(tracelog != NULL);
148 EXPECT_TRUE(tracelog->IsTracing()); 148 EXPECT_TRUE(tracelog->IsTracing());
149 } 149 }
150 150
151 void TearDown() { 151 void TearDown() {
152 EtwTraceProperties prop; 152 EtwTraceProperties prop;
153 if (controller_.session() != 0) 153 if (controller_.session() != 0)
154 EXPECT_HRESULT_SUCCEEDED(controller_.Stop(&prop)); 154 EXPECT_HRESULT_SUCCEEDED(controller_.Stop(&prop));
155 155
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 kTraceEventTypeInstant, 304 kTraceEventTypeInstant,
305 kName, strlen(kName), 305 kName, strlen(kName),
306 kId, 306 kId,
307 kExtra, strlen(kExtra)); 307 kExtra, strlen(kExtra));
308 308
309 PlayLog(); 309 PlayLog();
310 } 310 }
311 311
312 } // namespace debug 312 } // namespace debug
313 } // namespace base 313 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698