OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <errno.h> | 5 #include <errno.h> |
6 #include <stddef.h> | 6 #include <stddef.h> |
7 #include <sys/types.h> | 7 #include <sys/types.h> |
8 #include <sys/xattr.h> | 8 #include <sys/xattr.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return referrer_url_; | 46 return referrer_url_; |
47 } | 47 } |
48 | 48 |
49 bool is_xattr_supported() const { | 49 bool is_xattr_supported() const { |
50 return is_xattr_supported_; | 50 return is_xattr_supported_; |
51 } | 51 } |
52 | 52 |
53 protected: | 53 protected: |
54 void SetUp() override { | 54 void SetUp() override { |
55 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 55 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
56 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &test_file_)); | 56 ASSERT_TRUE( |
| 57 base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &test_file_)); |
57 int result = setxattr(test_file_.value().c_str(), | 58 int result = setxattr(test_file_.value().c_str(), |
58 "user.test", "test", 4, 0); | 59 "user.test", "test", 4, 0); |
59 is_xattr_supported_ = (!result) || (errno != ENOTSUP); | 60 is_xattr_supported_ = (!result) || (errno != ENOTSUP); |
60 if (!is_xattr_supported_) { | 61 if (!is_xattr_supported_) { |
61 DVLOG(0) << "Test will be skipped because extended attributes are not " | 62 DVLOG(0) << "Test will be skipped because extended attributes are not " |
62 << "supported on this OS/file system."; | 63 << "supported on this OS/file system."; |
63 } | 64 } |
64 } | 65 } |
65 | 66 |
66 void CheckExtendedAttributeValue(const string attr_name, | 67 void CheckExtendedAttributeValue(const string attr_name, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 AddOriginMetadataToFile(test_file(), invalid_url, invalid_url); | 157 AddOriginMetadataToFile(test_file(), invalid_url, invalid_url); |
157 GetExtendedAttributeNames(&attr_names); | 158 GetExtendedAttributeNames(&attr_names); |
158 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(), | 159 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(), |
159 kSourceURLAttrName)); | 160 kSourceURLAttrName)); |
160 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(), | 161 EXPECT_EQ(attr_names.end(), find(attr_names.begin(), attr_names.end(), |
161 kReferrerURLAttrName)); | 162 kReferrerURLAttrName)); |
162 } | 163 } |
163 | 164 |
164 } // namespace | 165 } // namespace |
165 } // namespace content | 166 } // namespace content |
OLD | NEW |