summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/scoped_temp_dir_unittest.cc7
-rw-r--r--base/win/event_trace_controller_unittest.cc8
2 files changed, 11 insertions, 4 deletions
diff --git a/base/scoped_temp_dir_unittest.cc b/base/scoped_temp_dir_unittest.cc
index 72e410f..eddea83 100644
--- a/base/scoped_temp_dir_unittest.cc
+++ b/base/scoped_temp_dir_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <string>
+
#include "base/file_util.h"
#include "base/platform_file.h"
#include "base/scoped_temp_dir.h"
@@ -60,8 +62,8 @@ TEST(ScopedTempDir, TempDir) {
TEST(ScopedTempDir, UniqueTempDirUnderPath) {
// Create a path which will contain a unique temp path.
FilePath base_path;
- file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("base_dir"),
- &base_path);
+ ASSERT_TRUE(file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("base_dir"),
+ &base_path));
FilePath test_path;
{
@@ -73,6 +75,7 @@ TEST(ScopedTempDir, UniqueTempDirUnderPath) {
EXPECT_TRUE(test_path.value().find(base_path.value()) != std::string::npos);
}
EXPECT_FALSE(file_util::DirectoryExists(test_path));
+ file_util::Delete(base_path, true);
}
TEST(ScopedTempDir, MultipleInvocations) {
diff --git a/base/win/event_trace_controller_unittest.cc b/base/win/event_trace_controller_unittest.cc
index 8eab40a..78969d8 100644
--- a/base/win/event_trace_controller_unittest.cc
+++ b/base/win/event_trace_controller_unittest.cc
@@ -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, StartRealTimeSession) {
}
TEST(EtwTraceControllerTest, StartFileSession) {
+ ScopedTempDir temp_dir;
+ ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
FilePath temp;
-
- ASSERT_HRESULT_SUCCEEDED(file_util::CreateTemporaryFile(&temp));
+ ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), &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 @@ TEST(EtwTraceControllerTest, StartFileSession) {
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) {