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

Side by Side Diff: util/mac/xattr_test.cc

Issue 842513002: Create CrashReportDatabase interface, a test, and a Mac implementation. (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 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 unified diff | Download patch
« util/mac/xattr.cc ('K') | « util/mac/xattr.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« util/mac/xattr.cc ('K') | « util/mac/xattr.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698