Commit afaf7a45 authored by Wez's avatar Wez Committed by Commit Bot

Fix AudioDebugRecording*Tests to use isolated temporary directories.

https://chromium-review.googlesource.com/881501 introduced fixed file
paths into some of these tests, causing them to randomly interfere with
one another if they happened to end up being run in parallel.

Bug: 809780
TBR: olka@chromium.org
Change-Id: Idb2143f9c44ddab559b7402182e69d3b2e7220de
Reviewed-on: https://chromium-review.googlesource.com/905991Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534893}
parent d1b39b94
......@@ -11,6 +11,7 @@
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
......@@ -144,10 +145,10 @@ class AudioDebugRecordingHelperTest : public ::testing::Test {
// Check that AudioDebugRecordingHelper::EnableDebugRecording adds file
// extension to file name suffix.
EXPECT_EQ(file_name_suffix_.AddExtension(kFileExtension), file_name_suffix);
base::FilePath temp_dir;
ASSERT_TRUE(base::GetTempDir(&temp_dir));
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
base::FilePath base_file_path(
temp_dir.Append(base::FilePath(kBaseFileName)));
temp_dir.GetPath().Append(base::FilePath(kBaseFileName)));
base::FilePath file_path =
base_file_path.AddExtension(file_name_suffix.value());
base::File debug_file(base::File(
......
......@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/test/scoped_task_environment.h"
#include "media/audio/mock_audio_debug_recording_manager.h"
#include "media/audio/mock_audio_manager.h"
......@@ -85,12 +86,12 @@ class AudioDebugRecordingSessionImplTest : public testing::Test {
private:
void SetBaseFilePath() {
base::FilePath temp_dir;
if (!base::GetTempDir(&temp_dir))
FAIL();
base_file_path_ = temp_dir.Append(base::FilePath(kBaseFileName));
CHECK(temp_dir_.CreateUniqueTempDir());
base_file_path_ = temp_dir_.GetPath().Append(base::FilePath(kBaseFileName));
}
base::ScopedTempDir temp_dir_;
DISALLOW_COPY_AND_ASSIGN(AudioDebugRecordingSessionImplTest);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment