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

Unified Diff: chrome/browser/process_singleton_posix_unittest.cc

Issue 2811173003: ProcessSingletonPosix: don't CHECK if trying to connect to existing process with too long socket sy… (Closed)
Patch Set: updated comments Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/process_singleton_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/process_singleton_posix_unittest.cc
diff --git a/chrome/browser/process_singleton_posix_unittest.cc b/chrome/browser/process_singleton_posix_unittest.cc
index 56808a833e96345890a94d6c55a3716636122915..7c511739bb4f0a484f5d210fc943b8ac2b966532 100644
--- a/chrome/browser/process_singleton_posix_unittest.cc
+++ b/chrome/browser/process_singleton_posix_unittest.cc
@@ -408,6 +408,24 @@ TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessOrCreate_BadCookie) {
EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, NotifyOtherProcessOrCreate(url));
}
+TEST_F(ProcessSingletonPosixTest, IgnoreSocketSymlinkWithTooLongTarget) {
+ CreateProcessSingletonOnThread();
+ // Change the symlink to one with a too-long target.
+ char buf[PATH_MAX];
+ ssize_t len = readlink(socket_path_.value().c_str(), buf, PATH_MAX);
+ ASSERT_GT(len, 0);
+ base::FilePath socket_target_path = base::FilePath(std::string(buf, len));
+ base::FilePath long_socket_target_path = socket_target_path.DirName().Append(
+ std::string(sizeof(sockaddr_un::sun_path), 'b'));
+ ASSERT_EQ(0, unlink(socket_path_.value().c_str()));
+ ASSERT_EQ(0, symlink(long_socket_target_path.value().c_str(),
+ socket_path_.value().c_str()));
+
+ // A new ProcessSingleton should ignore the invalid socket path target.
+ std::string url("about:blank");
+ EXPECT_EQ(ProcessSingleton::PROCESS_NONE, NotifyOtherProcessOrCreate(url));
+}
+
#if defined(OS_MACOSX)
// Test that if there is an existing lock file, and we could not flock()
// it, then exit.
« no previous file with comments | « chrome/browser/process_singleton_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698