diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-30 23:14:56 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-30 23:14:56 +0000 |
commit | 98136e4edec071d6a284e1c96ee8c49c628e571f (patch) | |
tree | e76b1383520e23667873d7d8d8446a6a0935007d /chrome | |
parent | 55fbe3d2b694fa3d0244802166aacadb068f61ad (diff) | |
download | chromium_src-98136e4edec071d6a284e1c96ee8c49c628e571f.zip chromium_src-98136e4edec071d6a284e1c96ee8c49c628e571f.tar.gz chromium_src-98136e4edec071d6a284e1c96ee8c49c628e571f.tar.bz2 |
Fix ChromeTestLauncherDelegate leaking temp directories.
BUG=120965
TEST=run any browser_tests, check for leaked directories in /tmp
Review URL: https://chromiumcodereview.appspot.com/9968022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129992 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/test/base/chrome_test_launcher.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/chrome/test/base/chrome_test_launcher.cc b/chrome/test/base/chrome_test_launcher.cc index 21aa802..677430d 100644 --- a/chrome/test/base/chrome_test_launcher.cc +++ b/chrome/test/base/chrome_test_launcher.cc @@ -79,13 +79,16 @@ class ChromeTestLauncherDelegate : public test_launcher::TestLauncherDelegate { new_command_line.AppendSwitchNative((*iter).first, (*iter).second); } + // Clean up previous temp dir. + if (!temp_dir_.path().empty() && !temp_dir_.Delete()) + LOG(ERROR) << "Error deleting previous temp profile directory"; + // Create a new user data dir and pass it to the child. - ScopedTempDir temp_dir; - if (!temp_dir.CreateUniqueTempDir() || !temp_dir.IsValid()) { + if (!temp_dir_.CreateUniqueTempDir() || !temp_dir_.IsValid()) { LOG(ERROR) << "Error creating temp profile directory"; return false; } - new_command_line.AppendSwitchPath(switches::kUserDataDir, temp_dir.path()); + new_command_line.AppendSwitchPath(switches::kUserDataDir, temp_dir_.path()); // file:// access for ChromeOS. new_command_line.AppendSwitch(switches::kAllowFileAccess); @@ -95,6 +98,8 @@ class ChromeTestLauncherDelegate : public test_launcher::TestLauncherDelegate { } private: + ScopedTempDir temp_dir_; + DISALLOW_COPY_AND_ASSIGN(ChromeTestLauncherDelegate); }; |