OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 const base::FilePath& path() const { return path_; } | 49 const base::FilePath& path() const { return path_; } |
50 | 50 |
51 private: | 51 private: |
52 ScopedTempDir temp_dir_; | 52 ScopedTempDir temp_dir_; |
53 base::FilePath path_; | 53 base::FilePath path_; |
54 }; | 54 }; |
55 | 55 |
56 const char kKey[] = "com.google.crashpad.test"; | 56 const char kKey[] = "com.google.crashpad.test"; |
57 | 57 |
| 58 TEST_F(Xattr, HasXattr) { |
| 59 EXPECT_FALSE(HasXattr(path(), kKey)); |
| 60 EXPECT_TRUE(WriteXattr(path(), kKey, "")); |
| 61 EXPECT_TRUE(HasXattr(path(), kKey)); |
| 62 } |
| 63 |
58 TEST_F(Xattr, ReadNonExistentXattr) { | 64 TEST_F(Xattr, ReadNonExistentXattr) { |
59 std::string value; | 65 std::string value; |
60 EXPECT_FALSE(ReadXattr(path(), kKey, &value)); | 66 EXPECT_FALSE(ReadXattr(path(), kKey, &value)); |
61 } | 67 } |
62 | 68 |
63 TEST_F(Xattr, WriteAndReadString) { | 69 TEST_F(Xattr, WriteAndReadString) { |
64 std::string value = "hello world"; | 70 std::string value = "hello world"; |
65 EXPECT_TRUE(WriteXattr(path(), kKey, value)); | 71 EXPECT_TRUE(WriteXattr(path(), kKey, value)); |
66 | 72 |
67 std::string actual; | 73 std::string actual; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 119 |
114 expected = std::numeric_limits<time_t>::max(); | 120 expected = std::numeric_limits<time_t>::max(); |
115 EXPECT_TRUE(WriteXattrTimeT(path(), kKey, expected)); | 121 EXPECT_TRUE(WriteXattrTimeT(path(), kKey, expected)); |
116 EXPECT_TRUE(ReadXattrTimeT(path(), kKey, &actual)); | 122 EXPECT_TRUE(ReadXattrTimeT(path(), kKey, &actual)); |
117 EXPECT_EQ(expected, actual); | 123 EXPECT_EQ(expected, actual); |
118 } | 124 } |
119 | 125 |
120 } // namespace | 126 } // namespace |
121 } // namespace test | 127 } // namespace test |
122 } // namespace crashpad | 128 } // namespace crashpad |
OLD | NEW |