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

Issue 1984763003: Delete tmp_path_ at the end of the tests (Closed)

Created:
4 years, 7 months ago by vakh (use Gerrit instead)
Modified:
4 years, 7 months ago
Reviewers:
asanka, Nathan Parker
CC:
asanka, chromium-reviews, grt+watch_chromium.org, Jialiu Lin
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Delete tmp_path_ at the end of the tests BUG=612296 Committed: https://crrev.com/e4f9ac949175541f148eee4b11488c30b7177623 Cr-Commit-Position: refs/heads/master@{#394069}

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -0 lines) Patch
M chrome/browser/safe_browsing/download_protection_service_unittest.cc View 2 chunks +4 lines, -0 lines 1 comment Download

Messages

Total messages: 10 (4 generated)
vakh (use Gerrit instead)
4 years, 7 months ago (2016-05-16 22:59:03 UTC) #2
Nathan Parker
lgtm
4 years, 7 months ago (2016-05-17 01:08:23 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1984763003/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1984763003/1
4 years, 7 months ago (2016-05-17 06:28:04 UTC) #5
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 7 months ago (2016-05-17 06:32:15 UTC) #6
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/e4f9ac949175541f148eee4b11488c30b7177623 Cr-Commit-Position: refs/heads/master@{#394069}
4 years, 7 months ago (2016-05-17 06:33:52 UTC) #8
asanka
4 years, 7 months ago (2016-05-17 14:51:56 UTC) #10
Message was sent while issue was closed.
In general, it's best to avoid writing to the current directory, specially when
dealing with test isolation etc. The current directory may not be writeable.

A better setup is to use a base::ScopedTempDir to create a temporary directory
whenever the test needs to write somewhere. That way,
* the resulting path is entirely under the control of the test, and is known to
be writeable by the test binary,
* the resulting path is unique (i.e. the tests won't fail if there are
concurrent tests running)
* even if the test fails or crashes the files will still be cleaned up by the
platform at some point.

https://codereview.chromium.org/1984763003/diff/1/chrome/browser/safe_browsin...
File chrome/browser/safe_browsing/download_protection_service_unittest.cc
(right):

https://codereview.chromium.org/1984763003/diff/1/chrome/browser/safe_browsin...
chrome/browser/safe_browsing/download_protection_service_unittest.cc:569:
base::DeleteFile(tmp_path_, false);
This won't be executed if any of the ASSERT_*s fail above.

Powered by Google App Engine
This is Rietveld 408576698