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

Unified Diff: sandbox/linux/services/credentials_unittest.cc

Issue 1522653002: Use std=c++11 instead of std=gnu++11 everywhere except nacl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years 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 | « build/config/compiler/BUILD.gn ('k') | skia/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/services/credentials_unittest.cc
diff --git a/sandbox/linux/services/credentials_unittest.cc b/sandbox/linux/services/credentials_unittest.cc
index 39fd6a7e6def2fcca19b62766c688f2ae7e0d50e..5d14153eac0d9eb9c66d3178e01956be5d4b85f7 100644
--- a/sandbox/linux/services/credentials_unittest.cc
+++ b/sandbox/linux/services/credentials_unittest.cc
@@ -31,16 +31,6 @@ namespace sandbox {
namespace {
-struct CapFreeDeleter {
- inline void operator()(cap_t cap) const {
- int ret = cap_free(cap);
- CHECK_EQ(0, ret);
- }
-};
-
-// Wrapper to manage libcap2's cap_t type.
-typedef scoped_ptr<typeof(*((cap_t)0)), CapFreeDeleter> ScopedCap;
-
bool WorkingDirectoryIsRoot() {
char current_dir[PATH_MAX];
char* cwd = getcwd(current_dir, sizeof(current_dir));
@@ -224,19 +214,22 @@ SANDBOX_TEST(Credentials, SetCapabilitiesMatchesLibCap2) {
caps.push_back(Credentials::Capability::SYS_CHROOT);
CHECK(Credentials::SetCapabilities(proc_fd.get(), caps));
- ScopedCap actual_cap(cap_get_proc());
+ cap_t actual_cap(cap_get_proc());
PCHECK(actual_cap != nullptr);
- ScopedCap expected_cap(cap_init());
+ cap_t expected_cap(cap_init());
PCHECK(expected_cap != nullptr);
const cap_value_t allowed_cap = CAP_SYS_CHROOT;
for (const cap_flag_t flag : {CAP_EFFECTIVE, CAP_PERMITTED}) {
- PCHECK(cap_set_flag(expected_cap.get(), flag, 1, &allowed_cap, CAP_SET) ==
+ PCHECK(cap_set_flag(expected_cap, flag, 1, &allowed_cap, CAP_SET) ==
0);
}
- CHECK_EQ(0, cap_compare(expected_cap.get(), actual_cap.get()));
+ CHECK_EQ(0, cap_compare(expected_cap, actual_cap));
+
+ CHECK_EQ(0, cap_free(expected_cap));
+ CHECK_EQ(0, cap_free(actual_cap));
}
volatile sig_atomic_t signal_handler_called;
« no previous file with comments | « build/config/compiler/BUILD.gn ('k') | skia/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698