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

Unified Diff: content/common/quarantine/quarantine_linux.cc

Issue 2618083002: Disable Quarantine tests on platforms its not supported. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | content/common/quarantine/quarantine_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/quarantine/quarantine_linux.cc
diff --git a/content/common/quarantine/quarantine_linux.cc b/content/common/quarantine/quarantine_linux.cc
index af207836d758758c495114eae6674f5bdad655e8..e66eaf27b18dde4ff59b7f9170d23cb817168b9f 100644
--- a/content/common/quarantine/quarantine_linux.cc
+++ b/content/common/quarantine/quarantine_linux.cc
@@ -10,6 +10,7 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
+#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
#include "base/threading/thread_restrictions.h"
#include "content/common/quarantine/quarantine_constants_linux.h"
@@ -96,4 +97,21 @@ bool IsFileQuarantined(const base::FilePath& file,
referrer_url;
}
+// Only to be used in tests.
+bool IsQuarantineSupportedForTesting() {
bcf 2017/01/06 20:43:00 We should update quarantine_linux_unittest.cc to u
+ base::ScopedTempDir temp_dir;
+ if (!temp_dir.CreateUniqueTempDir())
+ return false;
+
+ base::FilePath xattr_test_file;
+ if (!base::CreateTemporaryFileInDir(temp_dir.GetPath(), &xattr_test_file))
+ return false;
+
+ int result =
+ setxattr(xattr_test_file.value().c_str(), "user.test", "test", 4, 0);
+ bool is_xattr_supported = (!result) || (errno != ENOTSUP);
+
+ return is_xattr_supported;
+}
+
} // namespace content
« no previous file with comments | « no previous file | content/common/quarantine/quarantine_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698