Fix temp files being left on system.

The webm temp files for testing and mkvmuxer_sample were not being
deleted.

BUG=https://bugs.chromium.org/p/webm/issues/detail?id=1314

Change-Id: I5d402de4b434965185e0fe73f2efd5f4dad8c6d6
This commit is contained in:
Frank Galligan 2016-10-15 20:54:57 -07:00
parent c04a134986
commit fc5f88d3d1
2 changed files with 9 additions and 2 deletions

View File

@ -311,8 +311,9 @@ int main(int argc, char* argv[]) {
// Set muxer header info
mkvmuxer::MkvWriter writer;
const std::string temp_file = libwebm::GetTempFileName();
if (!writer.Open(cues_before_clusters ? temp_file.c_str() : output)) {
const std::string temp_file =
cues_before_clusters ? libwebm::GetTempFileName() : output;
if (!writer.Open(temp_file.c_str())) {
printf("\n Filename is invalid or error while opening.\n");
return EXIT_FAILURE;
}

View File

@ -104,6 +104,11 @@ class MuxerTest : public testing::Test {
}
protected:
virtual void TearDown() {
remove(filename_.c_str());
testing::Test::TearDown();
}
std::unique_ptr<MkvWriter> writer_;
bool is_writer_open_ = false;
Segment segment_;
@ -507,6 +512,7 @@ TEST_F(MuxerTest, CuesBeforeClusters) {
ASSERT_TRUE(HasCuePoints(parser.segment, &cues_offset));
ASSERT_GT(cues_offset, 0);
ASSERT_TRUE(ValidateCues(parser.segment, parser.reader));
remove(cues_filename.c_str());
}
TEST_F(MuxerTest, MaxClusterSize) {