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

Side by Side Diff: ipc/ipc_channel_posix_unittest.cc

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « extensions/common/file_util_unittest.cc ('k') | ipc/unix_domain_socket_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // These tests are POSIX only. 5 // These tests are POSIX only.
6 6
7 #include "ipc/ipc_channel_posix.h" 7 #include "ipc/ipc_channel_posix.h"
8 8
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 DCHECK_EQ(static_cast<int>(name.length()), path_len); 152 DCHECK_EQ(static_cast<int>(name.length()), path_len);
153 size_t server_address_len = offsetof(struct sockaddr_un, 153 size_t server_address_len = offsetof(struct sockaddr_un,
154 sun_path) + path_len + 1; 154 sun_path) + path_len + 1;
155 155
156 if (mode == IPC::Channel::MODE_NAMED_SERVER) { 156 if (mode == IPC::Channel::MODE_NAMED_SERVER) {
157 // Only one server at a time. Cleanup garbage if it exists. 157 // Only one server at a time. Cleanup garbage if it exists.
158 unlink(name.c_str()); 158 unlink(name.c_str());
159 // Make sure the path we need exists. 159 // Make sure the path we need exists.
160 base::FilePath path(name); 160 base::FilePath path(name);
161 base::FilePath dir_path = path.DirName(); 161 base::FilePath dir_path = path.DirName();
162 ASSERT_TRUE(file_util::CreateDirectory(dir_path)); 162 ASSERT_TRUE(base::CreateDirectory(dir_path));
163 ASSERT_GE(bind(socket_fd, 163 ASSERT_GE(bind(socket_fd,
164 reinterpret_cast<struct sockaddr *>(&server_address), 164 reinterpret_cast<struct sockaddr *>(&server_address),
165 server_address_len), 0) << server_address.sun_path 165 server_address_len), 0) << server_address.sun_path
166 << ": " << strerror(errno) 166 << ": " << strerror(errno)
167 << "(" << errno << ")"; 167 << "(" << errno << ")";
168 ASSERT_GE(listen(socket_fd, SOMAXCONN), 0) << server_address.sun_path 168 ASSERT_GE(listen(socket_fd, SOMAXCONN), 0) << server_address.sun_path
169 << ": " << strerror(errno) 169 << ": " << strerror(errno)
170 << "(" << errno << ")"; 170 << "(" << errno << ")";
171 } else if (mode == IPC::Channel::MODE_NAMED_CLIENT) { 171 } else if (mode == IPC::Channel::MODE_NAMED_CLIENT) {
172 ASSERT_GE(connect(socket_fd, 172 ASSERT_GE(connect(socket_fd,
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 if (connected) { 417 if (connected) {
418 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout()); 418 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout());
419 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); 419 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status());
420 } else { 420 } else {
421 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status()); 421 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status());
422 } 422 }
423 return 0; 423 return 0;
424 } 424 }
425 425
426 } // namespace 426 } // namespace
OLDNEW
« no previous file with comments | « extensions/common/file_util_unittest.cc ('k') | ipc/unix_domain_socket_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698