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

Side by Side Diff: base/win/event_trace_controller_unittest.cc

Issue 10382159: Revert 136990 - Make sure the thread calling CoCreateGuid is CoInitialized. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months 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
« no previous file with comments | « base/win/event_trace_consumer_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/process.h" 13 #include "base/process.h"
14 #include "base/scoped_temp_dir.h" 14 #include "base/scoped_temp_dir.h"
15 #include "base/stringprintf.h" 15 #include "base/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 "base/win/scoped_com_initializer.h"
21 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
22 21
23 namespace { 22 namespace {
24 23
25 using base::win::EtwTraceController; 24 using base::win::EtwTraceController;
26 using base::win::EtwTraceProvider; 25 using base::win::EtwTraceProvider;
27 using base::win::EtwTraceProperties; 26 using base::win::EtwTraceProperties;
28 27
29 DEFINE_GUID(kGuidNull, 28 DEFINE_GUID(kGuidNull,
30 0x0000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0); 29 0x0000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Allocate a new provider name GUID for each test. 121 // Allocate a new provider name GUID for each test.
123 ASSERT_HRESULT_SUCCEEDED(::CoCreateGuid(&test_provider_)); 122 ASSERT_HRESULT_SUCCEEDED(::CoCreateGuid(&test_provider_));
124 } 123 }
125 124
126 virtual void TearDown() { 125 virtual void TearDown() {
127 EtwTraceProperties prop; 126 EtwTraceProperties prop;
128 EtwTraceController::Stop(session_name_.c_str(), &prop); 127 EtwTraceController::Stop(session_name_.c_str(), &prop);
129 } 128 }
130 129
131 protected: 130 protected:
132 base::win::ScopedCOMInitializer com_initializer_;
133 GUID test_provider_; 131 GUID test_provider_;
134 std::wstring session_name_; 132 std::wstring session_name_;
135 }; 133 };
136 134
137 } // namespace 135 } // namespace
138 136
139 TEST_F(EtwTraceControllerTest, Initialize) { 137 TEST_F(EtwTraceControllerTest, Initialize) {
140 EtwTraceController controller; 138 EtwTraceController controller;
141 139
142 EXPECT_EQ(NULL, controller.session()); 140 EXPECT_EQ(NULL, controller.session());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 EXPECT_EQ(kTestProviderFlags, provider.enable_flags()); 227 EXPECT_EQ(kTestProviderFlags, provider.enable_flags());
230 228
231 EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL)); 229 EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL));
232 230
233 provider.WaitForCallback(); 231 provider.WaitForCallback();
234 232
235 // Session should have wound down. 233 // Session should have wound down.
236 EXPECT_EQ(0, provider.enable_level()); 234 EXPECT_EQ(0, provider.enable_level());
237 EXPECT_EQ(0, provider.enable_flags()); 235 EXPECT_EQ(0, provider.enable_flags());
238 } 236 }
OLDNEW
« no previous file with comments | « base/win/event_trace_consumer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698