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

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

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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/test/test_file_util_win.cc ('k') | base/win/event_trace_controller_unittest.cc » ('j') | 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 consumer base class. 5 // Unit tests for event trace consumer base class.
6 #include "base/win/event_trace_consumer.h" 6 #include "base/win/event_trace_consumer.h"
7 7
8 #include <list> 8 #include <list>
9 9
10 #include <objbase.h> 10 #include <objbase.h>
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 EtwTraceProperties prop; 284 EtwTraceProperties prop;
285 EtwTraceController::Stop(session_name_.c_str(), &prop); 285 EtwTraceController::Stop(session_name_.c_str(), &prop);
286 286
287 // Create a temp dir for this test. 287 // Create a temp dir for this test.
288 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 288 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
289 // Construct a temp file name in our dir. 289 // Construct a temp file name in our dir.
290 temp_file_ = temp_dir_.path().Append(L"test.etl"); 290 temp_file_ = temp_dir_.path().Append(L"test.etl");
291 } 291 }
292 292
293 virtual void TearDown() { 293 virtual void TearDown() {
294 EXPECT_TRUE(file_util::Delete(temp_file_, false)); 294 EXPECT_TRUE(base::Delete(temp_file_, false));
295 295
296 EtwTraceConsumerBaseTest::TearDown(); 296 EtwTraceConsumerBaseTest::TearDown();
297 } 297 }
298 298
299 HRESULT LogEventToTempSession(PEVENT_TRACE_HEADER header) { 299 HRESULT LogEventToTempSession(PEVENT_TRACE_HEADER header) {
300 EtwTraceController controller; 300 EtwTraceController controller;
301 301
302 // Set up a file session. 302 // Set up a file session.
303 HRESULT hr = controller.StartFileSession(session_name_.c_str(), 303 HRESULT hr = controller.StartFileSession(session_name_.c_str(),
304 temp_file_.value().c_str()); 304 temp_file_.value().c_str());
(...skipping 23 matching lines...) Expand all
328 HRESULT hr = consumer_.OpenFileSession(temp_file_.value().c_str()); 328 HRESULT hr = consumer_.OpenFileSession(temp_file_.value().c_str());
329 if (SUCCEEDED(hr)) 329 if (SUCCEEDED(hr))
330 hr = consumer_.Consume(); 330 hr = consumer_.Consume();
331 consumer_.Close(); 331 consumer_.Close();
332 // And nab the result. 332 // And nab the result.
333 events_.swap(TestConsumer::events_); 333 events_.swap(TestConsumer::events_);
334 return hr; 334 return hr;
335 } 335 }
336 336
337 HRESULT RoundTripEvent(PEVENT_TRACE_HEADER header, PEVENT_TRACE* trace) { 337 HRESULT RoundTripEvent(PEVENT_TRACE_HEADER header, PEVENT_TRACE* trace) {
338 file_util::Delete(temp_file_, false); 338 base::Delete(temp_file_, false);
339 339
340 HRESULT hr = LogEventToTempSession(header); 340 HRESULT hr = LogEventToTempSession(header);
341 if (SUCCEEDED(hr)) 341 if (SUCCEEDED(hr))
342 hr = ConsumeEventFromTempSession(); 342 hr = ConsumeEventFromTempSession();
343 343
344 if (FAILED(hr)) 344 if (FAILED(hr))
345 return hr; 345 return hr;
346 346
347 // We should now have the event in the queue. 347 // We should now have the event in the queue.
348 if (events_.empty()) 348 if (events_.empty())
(...skipping 25 matching lines...) Expand all
374 return; 374 return;
375 } 375 }
376 ASSERT_HRESULT_SUCCEEDED(hr) << "RoundTripEvent failed"; 376 ASSERT_HRESULT_SUCCEEDED(hr) << "RoundTripEvent failed";
377 ASSERT_TRUE(NULL != trace); 377 ASSERT_TRUE(NULL != trace);
378 ASSERT_EQ(sizeof(kData), trace->MofLength); 378 ASSERT_EQ(sizeof(kData), trace->MofLength);
379 ASSERT_STREQ(kData, reinterpret_cast<const char*>(trace->MofData)); 379 ASSERT_STREQ(kData, reinterpret_cast<const char*>(trace->MofData));
380 } 380 }
381 381
382 } // namespace win 382 } // namespace win
383 } // namespace base 383 } // namespace base
OLDNEW
« no previous file with comments | « base/test/test_file_util_win.cc ('k') | base/win/event_trace_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698