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

Unified Diff: components/update_client/test_installer.cc

Issue 2918653003: Unconditionally delete the unpack path in the UpdateClient. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/update_client/test_installer.h ('k') | components/update_client/update_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/test_installer.cc
diff --git a/components/update_client/test_installer.cc b/components/update_client/test_installer.cc
index 3232bd6cf58bea2970635f49bf7033d92f60cf04..7a003dbf817d31d2dd05a40bb963c5a9863b897c 100644
--- a/components/update_client/test_installer.cc
+++ b/components/update_client/test_installer.cc
@@ -10,12 +10,21 @@
#include "base/files/file_util.h"
#include "base/values.h"
#include "components/update_client/update_client_errors.h"
+#include "testing/gtest/include/gtest/gtest.h"
namespace update_client {
TestInstaller::TestInstaller() : error_(0), install_count_(0) {
}
+TestInstaller::~TestInstaller() {
+ // The unpack path is deleted unconditionally by the component state code,
+ // which is driving this installer. Therefore, the unpack path must not
+ // exist when this object is destroyed.
+ if (!unpack_path_.empty())
+ EXPECT_FALSE(base::DirectoryExists(unpack_path_));
+}
+
void TestInstaller::OnUpdateError(int error) {
error_ = error;
}
@@ -24,8 +33,8 @@ CrxInstaller::Result TestInstaller::Install(
const base::DictionaryValue& manifest,
const base::FilePath& unpack_path) {
++install_count_;
- if (!base::DeleteFile(unpack_path, true))
- return Result(InstallError::GENERIC_ERROR);
+
+ unpack_path_ = unpack_path;
return Result(InstallError::NONE);
}
@@ -35,9 +44,6 @@ bool TestInstaller::GetInstalledFile(const std::string& file,
return false;
}
-TestInstaller::~TestInstaller() {
-}
-
bool TestInstaller::Uninstall() {
return false;
}
« no previous file with comments | « components/update_client/test_installer.h ('k') | components/update_client/update_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698