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

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

Issue 85343005: Revert 237242 "Linux sandbox: move CurrentProcessHasOpenDirectories" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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 | « trunk/src/sandbox/linux/services/credentials.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/sandbox/linux/services/credentials_unittest.cc
===================================================================
--- trunk/src/sandbox/linux/services/credentials_unittest.cc (revision 237250)
+++ trunk/src/sandbox/linux/services/credentials_unittest.cc (working copy)
@@ -5,20 +5,14 @@
#include "sandbox/linux/services/credentials.h"
#include <errno.h>
-#include <fcntl.h>
#include <stdio.h>
-#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
-#include "base/file_util.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "sandbox/linux/tests/unit_tests.h"
#include "testing/gtest/include/gtest/gtest.h"
-using file_util::ScopedFD;
-
namespace sandbox {
namespace {
@@ -58,44 +52,6 @@
scoped_ptr<Credentials> cred2(new Credentials);
}
-TEST(Credentials, HasOpenDirectory) {
- Credentials creds;
- // No open directory should exist at startup.
- EXPECT_FALSE(creds.HasOpenDirectory(-1));
- {
- // Have a "/dev" file descriptor around.
- int dev_fd = open("/dev", O_RDONLY | O_DIRECTORY);
- ScopedFD dev_fd_closer(&dev_fd);
- EXPECT_TRUE(creds.HasOpenDirectory(-1));
- }
- EXPECT_FALSE(creds.HasOpenDirectory(-1));
-}
-
-TEST(Credentials, HasOpenDirectoryWithFD) {
- Credentials creds;
-
- int proc_fd = open("/proc", O_RDONLY | O_DIRECTORY);
- ScopedFD proc_fd_closer(&proc_fd);
- ASSERT_LE(0, proc_fd);
-
- // Don't pass |proc_fd|, an open directory (proc_fd) should
- // be detected.
- EXPECT_TRUE(creds.HasOpenDirectory(-1));
- // Pass |proc_fd| and no open directory should be detected.
- EXPECT_FALSE(creds.HasOpenDirectory(proc_fd));
-
- {
- // Have a "/dev" file descriptor around.
- int dev_fd = open("/dev", O_RDONLY | O_DIRECTORY);
- ScopedFD dev_fd_closer(&dev_fd);
- EXPECT_TRUE(creds.HasOpenDirectory(proc_fd));
- }
-
- // The "/dev" file descriptor should now be closed, |proc_fd| is the only
- // directory file descriptor open.
- EXPECT_FALSE(creds.HasOpenDirectory(proc_fd));
-}
-
SANDBOX_TEST(Credentials, DropAllCaps) {
Credentials creds;
CHECK(creds.DropAllCapabilities());
« no previous file with comments | « trunk/src/sandbox/linux/services/credentials.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698