Chromium Code Reviews| 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 |