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

Unified Diff: base/win/event_trace_controller_unittest.cc

Issue 8972009: Fix file leaks in a ETW test and a ScopedTempDir test. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/scoped_temp_dir_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win/event_trace_controller_unittest.cc
===================================================================
--- base/win/event_trace_controller_unittest.cc (revision 114285)
+++ base/win/event_trace_controller_unittest.cc (working copy)
@@ -9,6 +9,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
+#include "base/scoped_temp_dir.h"
#include "base/sys_info.h"
#include "base/win/event_trace_controller.h"
#include "base/win/event_trace_provider.h"
@@ -139,15 +140,17 @@
}
TEST(EtwTraceControllerTest, StartFileSession) {
+ ScopedTempDir temp_dir;
+ ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
FilePath temp;
+ ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), &temp));
- ASSERT_HRESULT_SUCCEEDED(file_util::CreateTemporaryFile(&temp));
-
EtwTraceController controller;
HRESULT hr = controller.StartFileSession(kTestSessionName,
temp.value().c_str());
if (hr == E_ACCESSDENIED) {
VLOG(1) << "You must be an administrator to run this test on Vista";
+ file_util::Delete(temp, false);
return;
}
@@ -157,6 +160,7 @@
EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL));
EXPECT_EQ(NULL, controller.session());
EXPECT_STREQ(L"", controller.session_name());
+ file_util::Delete(temp, false);
}
TEST(EtwTraceControllerTest, EnableDisable) {
« no previous file with comments | « base/scoped_temp_dir_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698