Fix ImportantFileWriter leaking a .tmp file when passed an invalid path

When passed an invalid path (ex. "bad/../path"), ImportantFileWriter
creates a temp file, sees that it's invalid, then returns without deleting it.
The file being invalid is an implementation detail of base::File's
Initialize() method, which sets an error field to
FILE_ERROR_ACCESS_DENIED if the file's path contains the parent ".." operator.

This stops ImportantFileWriterTest.FailedWriteWithObserver from leaking
a temp file.

BUG=691388

Review-Url: https://codereview.chromium.org/2711523002
Cr-Commit-Position: refs/heads/master@{#452266}


CrOS-Libchrome-Original-Commit: 05db50c5c72b8368af872b768cb637c294e99f44
1 file changed
tree: dcf1c9815ea25123658fd1ff87ef1de002bb2832
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/